Wednesday, January 22, 2014

pesky multiple eth addresses in suse 10 with same mac

pesky multiple eth addresses in SuSE 10 with same MAC.

Navigate to the hotplug file in the /etc/sysconfig directory:

# cd /etc/sysconfig
Open the hotplug file in an editor.

Set HOTPLUG_PCI_QUEUE_NIC_EVENTS to yes:

HOTPLUG_PCI_QUEUE_NIC_EVENTS=yes
Run the command:

ifconfig -a
Make sure that the interface name to MAC address mapping remains same across the reboots.

For each ethernet interface displayed, do the following:
If a file named /etc/sysconfig/network/ifcfg-eth-id-mac, where mac is the hardware address of that interface, does not exist, then do the following:

Create the file.

If a file exists for the same network interface with the name /etc/sysconfig/network/ifcfg-ethX, then copy the contents of that file into the newly created file. The variable ethX represents the interface name.

Add the following line at the end of the file /etc/sysconfig/network/ifcfg-eth-id-mac.

PERSISTENT_NAME=ethX
where ethX is the interface name.

For example:

# ifconfig -a
eth0    Link encap:Ethernet  HWaddr 00:02:B3:DB:38:FE
        inet addr:10.212.99.30  Bcast:10.212.99.255
        Mask:255.255.254.0 
        inet6 addr: fe80::202:b3ff:fedb:38fe/64 Scope:Link
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:453500 errors:0 dropped:0 overruns:0 frame:0
        TX packets:8131 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:35401016 (33.7 Mb)  TX bytes:999899 (976.4 Kb)
        Base address:0xdce0 Memory:fcf20000-fcf40000

If a file named etc/sysconfig/network/ifcfg-eth-id-00:02:B3:DB:38:FE does not exist, do the following task:
Create the file.

If the file /etc/sysconfig/network/ifcfg-eth0 exists, then copy the contents of this file into etc/sysconfig/network/ifcfg-eth-id-00:02:B3:DB:38:FE.

Add the following to the end of the file named etc/sysconfig/network/ifcfg-eth-id-00:02:B3:DB:38:FE,

PERSISTENT_NAME=eth0

Perform the procedure for all the interfaces that the ifconfig -a command displays that you need across boots.

To configure interfaces to be up before starting LLT

# ifconfig eth0
eth0    Link encap:Ethernet  HWaddr 00:02:B3:DB:38:FE
Where eth0 is the sample network interface name. The output displays 00:02:B3:DB:38:FE as the interface's MAC address.

Navigate to the config file in the /etc/sysconfig/network directory:

# cd /etc/sysconfig/network
Open the config file in an editor.

Append the string eth-id-macaddress to the MANDATORY_DEVICES list in the config file. Separate each address with a space, for example:

MANDATORY_DEVICES="eth-id-00:02:B3:DB:38:FE"

Next, edit /etc/udev/rules.d/70-persistent-net.rules

Add the following:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:02:B3:DB:38:FE", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

Finally, edit /etc/udev/30-net_persistent_names.rules and have the SYSFS address match the interface MAC.  Remove lines of interfaces that do not exist.
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:B3:DB:38:FE", IMPORT="/lib/udev/rename_netiface %k eth0"

Reboot!

No comments: