RE: Re: Using the ifconfig resource with DHCP?


#1

Will do. On which github project should such a bug go?

Kevin Keane

The NetTech

760-721-8339

http://www.4nettech.com

Our values: Privacy, Liberty, Justice

See https://www.4nettech.com/corp/the-nettech-values.html

-----Original message-----
From: AJ Christensen aj@junglistheavy.industries
Sent: Friday 31st July 2015 13:49
To: chef@lists.opscode.com
Subject: [chef] Re: Using the ifconfig resource with DHCP?

I would be extremely surprised to learn that the ifconfig core resource/provider still functions at all. Please file a bug :slight_smile:

cheers,

–aj

On Sun, Aug 2, 2015 at 7:06 AM Kevin Keane Subscription <subscription@kkeane.com mailto:subscription@kkeane.com > wrote:

I’m trying to use the ifconfig resource to set up an interface to use DHCP (this is on CentOS 6, chef client 12.4.1).

However, I can’t figure out how to actually accomplish what I need.

Here is the resource I am using:

ifconfig “eth1” do
device "eth1"
onboot "yes"
bootproto "dhcp"
end

Which expands to:

ifconfig("eth1") do
  action [:add]
  retries 0
  retry_delay 2
  default_guard_interpreter :default
  target "eth1"
  device "eth1"
  onboot "yes"
  bootproto "dhcp"
  declared_type :ifconfig
  cookbook_name "main"
  recipe_name "default"
end

I have two problems with it. First, this generates a configuration file named “ifcfg-” instead of “ifcfg-eth1” and second, it copies the resource name into the IP address - which obviously makes no sense for a DHCP interface. Unfortunately, the examples in the documentation are less than helpful, because they all use the IP address as the resource name.

In fact, the documentation actually is self-contradictory when it comes to DHCP. There is an example “Specify a boot protocol” that claims that this is what I’d need - and later the identical code in another example claims to generate a different configuration in the sample “Update a static IP address with a boot protocol”

How do I correctly use the ifconfig resource?

Here is the configuration file it generates:

cat /etc/sysconfig/network-scripts/ifcfg-

ONBOOT=yes
BOOTPROTO=dhcp
IPADDR=eth1

Kevin Keane

The NetTech

http://www.4nettech.com http://www.4nettech.com

Our values: Privacy, Liberty, Justice

See https://www.4nettech.com/corp/the-nettech-values.html