Sunday, September 13, 2009

create a fixed device for udev

i stole this from
http://www.debianhelp.co.uk/udev.htm

fconfig eth0
eth0 Link encap:Ethernet HWaddr 00:AB:CD:12:34:56
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:3
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:180 (180.0 b)
Interrupt:185 Base address:0xc000

In the above example HWaddr is your MAC address 00:AB:CD:12:34:56

Using udev

Create a new file in the udev rules directory, e.g. /etc/udev/rules.d/010_netinterfaces.rules

In it specify the renaming in the following way for each interface on its own line

KERNEL="oldnameprefix*", SYSFS{address}=="MACaddress", NAME="newname"

where the oldnameprefix is typically eth. Note that in the MAC address, the hexadecimal digits should be in lowercase, otherwise udev fails to match them properly with the network interface.

You have quite a bit of freedom in choosing the new name, We recommend to keep it short and without any spaces or weird characters though. You can e.g. specify a fixed eth0, eth1, eth2 for specific MAC addresses, or you can name them after their use, or anything really. Remember that some applications that poke on a low level may dislike them not being called in the normal fashion of eth0, eth1..etc

Examples using udev

Example: Three network interfaces being present on a computer, setting a fixed eth0, eth1 and eth2 as their names.

KERNEL=="eth*", SYSFS{address}=="00:12:34:fe:dc:ba", NAME="eth0"
KERNEL=="eth*", SYSFS{address}=="00:56:78:98:76:54", NAME="eth1"
KERNEL=="eth*", SYSFS{address}=="00:90:ab:32:10:fe", NAME="eth2"Example: Three network interfaces (one Intel, one NVIDIA, and one 3Com) being present on a computer, naming them after the manufacturer of the interfaces.

KERNEL=="eth*", SYSFS{address}=="00:12:34:fe:dc:ba", NAME="eth-intel"
KERNEL=="eth*", SYSFS{address}=="00:56:78:98:76:54", NAME="eth-nv"
KERNEL=="eth*", SYSFS{address}=="00:90:ab:32:10:fe", NAME="eth-3com"

Updating network configuration

If you named the interfaces in a different fashion as they were named before, the network configuration needs to be updated for the new interface device names to be used.

Edit the /etc/network/interfaces file, and change all instances of the old names to the new names.

E.g. if you previously used eth0 and have renamed it newname, you'd replace all instances of eth0 in that file with newname

But if you just put a fixed eth0, eth1, ... as their names, you just need to make sure the one you want to have as the primary network interface is set to the one you want in the file.

Example

Having renamed the existing eth0, eth1, and eth2 to eth-intel, eth-nv and eth-3com, choosing to use the eth-intel one as the primary interface

The /etc/network/interfaces file before changes

# The primary network interface
auto eth0
iface eth0 inet dhcp

# Currently unused network interfaces
iface eth1 inet dhcp
iface eth2 inet dhcpThe file after changes:

# The primary network interface
auto eth-intel
iface eth-intel inet dhcp

# Currently unused network interfaces
iface eth-nv inet dhcp
iface eth-3com inet dhcp

Reboot and verify your configuration

Reboot the computer and verify that the new network interface names are in use with e.g. ifconfig

#ifconfig newname

Where newname is the new interface name you specified. Repeat procedure for each one you renamed.

4 comments:

VIVI 情趣精品 said...

情趣商品,情趣精品,情趣用品,情趣味用品,情趣用品坊,情趣用品店,情趣用品網站,情趣用品專賣店,情人趣味,情色遊戲

情人趣味用品,情趣,情色,色情,色遊戲,一夜情,色情網站,情色自拍,情人趣味愛蜜莉,情人趣味用品液,情人趣味用品轉

情人趣味用品娃,情人趣味用品珠,情人趣味用品店,情人趣味用品控制,情人趣味用品轉珠,情去商品,情趣禮物,情人節

情趣用具,情趣網,情趣用性品,情趣性用品,情趣用品爽翻天,情趣爽翻天,情趣內衣,情趣椅,情趣貼圖,情趣睡衣,情色小說

VIVI 情趣精品 said...

飛機杯,按摩棒,自慰套,SM,吊帶襪,潤滑液,跳蛋,性感睡衣,充氣娃娃,角色扮演,G點,高潮,性感,威而柔,跳蛋情人趣味

跳蛋情人,跳蛋影片,跳蛋變頻,跳蛋調情,按摩情人趣味,按摩器,按摩椅,按摩半套,按摩全套,按摩精油,吊帶襪影片

自衛方法,自衛棒,自慰器專賣店,自衛器,自衛杯,自慰器,自慰杯,自慰棒,吊帶襪美女,潤滑情人趣味,潤滑油,潤滑劑

潤滑液用品,充氣情人趣味,充氣玩具,角色情人趣味,角色扮演遊戲,角色扮演服裝,震動情人趣味,震動保險套,震動器

逼真情人趣味,保險套,保險套情人趣味,性感內衣

VIVI 情趣精品 said...

情趣商品,情趣精品,情趣用品,情趣味用品,情趣用品坊,情趣用品店,情趣用品網站,情趣用品專賣店,情人趣味,情色遊戲

情人趣味用品,情趣,情色,色情,色遊戲,一夜情,色情網站,情色自拍,情人趣味愛蜜莉,情人趣味用品液,情人趣味用品轉

情人趣味用品娃,情人趣味用品珠,情人趣味用品店,情人趣味用品控制,情人趣味用品轉珠,情去商品,情趣禮物,情人節

情趣用具,情趣網,情趣用性品,情趣性用品,情趣用品爽翻天,情趣爽翻天,情趣內衣,情趣椅,情趣貼圖,情趣睡衣,情色小說

VIVI 情趣精品 said...

飛機杯,按摩棒,自慰套,SM,吊帶襪,潤滑液,跳蛋,性感睡衣,充氣娃娃,角色扮演,G點,威而柔,自慰器,震動套

性感內衣,情趣按摩棒,丁字褲,丁字褲情人趣味,C字褲,C字褲情人趣味,情趣按摩棒

性愛,做愛,作愛,網愛,性愛,愛情,性交,性行為,愛愛,性騷擾,性功能,性知識,性交易,性冷感,性感帶

露點,視訊,正妹,熟女,走光,自拍,辣妹,夜店,汽車旅館,av,成人,av女優,交友,視訊美女,外遇,sex,無碼,同志,gay