Interface naming

04 Jul 2005 • 2 min read

OK - the number of forum posts regarding being able to specify the name of an interface and the kludgy solutions they came up with was making me cry too much :sick:

So, I wanged a new net-scripts module into baselayout svn today which should remedy the situation. net-tools (ifconfig) ships with nameif and I finally discovered that ip (iproute2) can do the same with the "ip link set name" command.

You'll be able to do the following in the next alpha release of baselayout 8)

rename_001122334455="foo1" # Rename based on MAC address
rename_eth1="foo2" # Rename based on current name

Please note that it is preferable to ensure the device has it's correct name before any scripts are called - you can do this by writing udev rules.

The reason for this is that we have to create a net.$newname link to net.lo in /etc/init.d if it doesn't exist, mark ourselves as stopped and then start net.$newname - which of course takes a lot longer (in CPU terms) than using a udev rule or similar.

Of course, if you have wireless-tools installed then you get a 3rd way of renameing things - ifrename which can be used by hotplug automatically.

Hopefully I've now satisified all our grumpy users :p