===========================================================
$ sudo apt-get install ifrename
$ cat /etc/iftab
eth0 mac E0:*
Other ways are detailed at http://www.science.uva.nl/research/air/wiki/LogicalInterfaceNames
It's quite useful in case of install Linux on a virtual machine.
When we move the image to various hosts,
1) the interface name will keep running to eth1, eth2, eth3 and so on
2) the ip address will not automatically obtained.
because inside /etc/network/interfaces
....
iface eth0 inet dhcp
...
New method
=========
use the udev-sanctioned method of statically-naming each interface.
Create the following file to bind the MAC address of each of your cards to a certain interface name:
/etc/udev/rules.d/10-network.rules
SUBSYSTEM=="net" KERNEL=="eth*", ATTR{address}=="00:12:34:fe:dc:ba", NAME="eth0"
note:
- To get the MAC address of each card, use this command: cat /sys/class/net/device-name/address
- When syntax errors, look at /etc/udev/rules.d/70-persistent-net.rules
- Make sure to use the lower-case hex values in your udev rules. It doesn't like upper-case.
- When choosing the static names it should be avoided to use "ethX" and "wlanX", because this may lead to race conditions between the kernel and udev during boot. Instead, it is better to use interface names that are not used by the kernel as default, e.g. "net0, net1, wifi0, wifi1".
Ref:
http://www.debianhelp.co.uk/udev.htm
https://wiki.archlinux.org/index.php/Udev#Network_device
No comments:
Post a Comment