March 13, 2008 10:44 am





Network-wrapper is a script that runs before the network init script. It allows the name of an ethernet device to be changed based on MAC addresses.

The script works by checking to see if /etc/mactab exists. If it does, then it calls the nameif program, which changes the device names based on /etc/mactab.

/etc/mactab has two parameters per line. The device name and the MAC address.

Example /etc/mactab:

eth0 00:50:20:A1:9E:A1
eth1 00:05:02:1A:E9:1A

Enabling it:

  1. Place the attached script, network-wrapper, in /etc/init.d
  2. Make it executable

    chmod 0755 /etc/init.d/network-wrapper
  3. Edit /etc/insserv.conf
  4. Find the line reading
  5. $network	    network +pcmcia +hotplug
  6. Change it to:
  7. $network	    network-wrapper network +pcmcia +hotplug

    This changes the network service to include the network-wrapper script before the traditional network script is run. Any service that relies on the network will require that network-wrapper be started before the traditional network script. Further, this method does will not be affected by any updates.

  8. The script is will run if /etc/mactab is present. The file format is simple, the ethX identifier and the MAC address. Create a new /etc/mactab. Populate it. For example
    eth0 00:50:9A:2C:FF
    eth1 00:50:8E:2E:EE
  9. Add the new script using insserv
  10. insserv /etc/init.d/network-wrapper
  11. Reboot a couple of times to test it
  12. Please let me know whether it works or not.
0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.

Categories: Free Tools, Technical Solutions

Disclaimer: As with everything else in the SUSE Blog, this content is definitely not supported by SUSE (so don't even think of calling Support if you try something and it blows up).  It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.