Network config on SLES11 – No ifcfg-eth-id-* files anymore
| July 4th, 2009Howdy!
I’m currently adding support for SLES11 on the IBM Installation Toolkit (http://www14.software.ibm.com/webapp/set2/sas/f/lopdiags/installtools/home.html), and was stuck on some network configuration issues. In SLES10 we used to bind the network configs to a certain interface by using the interface’s MAC address to create the ifcg-eth-id-* files under /etc/sysconfig/network/.
This type of binding is necessary because the kernel gives names to the devices based on the order it loads the modules. Imagine you have a machine with 2 NICs, one using the e1000 module, and the other using tg3. If you do
[code]
#modprobe e1000
#modprobe tg3
[/code]
then you’ll have eth0 -> e1000, and eth1 -> tg3. If you change the modprobe order, then eth0 -> tg3 and eth1 -> e1000. This is a big issue when dealing with devices that can be hotplugged (or when running some strange types of installation, which is my case :D).
Beginning on OpenSuSE 10.3 they stopped using the ifcfg-eth-id-* approach and moved on to udev. With udev it is possible to rename the devices by using udev rules, and this is extremely useful to give persistent names to network interfaces, based on their MAC address, for instance. See http://www.reactivated.net/writing_udev_rules.html for more details.
Ok, so far so good, but this change broke my code that I used on SLES10 to configure network interfaces :P
Now, there are only ifcfg-<device> files under /etc/sysconfig/network. Inside each ifcfg-<device>, there’s an option called LLADDR, that is the MAC address for the interface. Also, the autoinst.xml file changed a little bit – below is the <interface> part of one SLES11 autoinst.xml file, note that there’s a <lladdr> entry there :) :
[code]
<interface>
<bootproto>dhcp4</bootproto>
<device>eth0</device>
<lladdr>aa:bb:cc:dd:ff:00</lladdr>
<name>Ethernet Network Card</name>
<startmode>auto</startmode>
</interface>
[/code]
This autoinst.xml config will result on file /etc/sysconfig/network/ifcfg-eth0, containing a LADDR variable with value aa:bb:cc:dd:ff:00, along with the correct udev rules to bind the name eth0 to the correct interface.
Hope this is useful to someone else!
See you :)



