Swapping interface names in Debian Etch with ifrename

After setup of several new boxes with Debian Etch (each box has 2 network interfaces), i noticed, that some boxes has internal address bound to eth0 and other boxes has it on eth1. That's not a problem when you can reconnect patchcords, but if you setup everything remotely...

I build a cluster of linux boxes, and trying to automate everything with cfengine. One thing that i want it to do, is to make sure that every node has following lines in /etc/sysctl.conf:

 net.ipv4.conf.eth1.arp_ignore=1
 net.ipv4.conf.eth1.arp_announce=2

These lines are needed when IPVS used with either DirectRouting or Tunneling. That's why i need the same interface order on every node.

Binding interface name to specific MAC address available in Ubuntu with udev package and its iftab_helper. You just need to add several lines into /etc/iftab:

eth0 mac 00:11:22:33:44:55
eth1 mac 00:11:22:33:44:66

But in Debian, you also need to install additional tool, called ifrename. It uses iftab config file with the same format.
When i tried to invoke-rc.d ifrename start/restart it told me that resource is busy and it can't rename it. Reboot didn't help.
What i had to do to make it work is to add -t flag to its options in /etc/init.d/ifrename:

#!/bin/sh

NAME=ifrename
IFRENAME=/sbin/ifrename
IFTAB=/etc/iftab

test -x $IFRENAME || exit 0
test -f $IFTAB || exit 0

case "$1" in
        start|reload|force-reload|restart)
                $IFRENAME -d -p -t
        ;;
        stop)
        ;;
        *)
                echo "Usage: invoke-rc.d $NAME {start|stop|reload|force-reload|restart}"
        ;;
esac

exit 0

0 responses to «Swapping interface names in Debian Etch with ifrename»

Post a comment