β

Linux Network Device Name issue

Lee-Jane的个人页面 177 阅读

[root@olinfa961 opt]# ifconfig

eth2 Link encap:Ethernet  HWaddr 00:0C:29:80:46:66

inet addr:192.168.0.109  Bcast:192.168.0.255  Mask:255.255.255.0

inet6 addr: fe80::20c:29ff:fe80:4666/64 Scope:Link

UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

RX packets:412 errors:0 dropped:0 overruns:0 frame:0

TX packets:21 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:53002 (51.7 KiB)  TX bytes:4314 (4.2 KiB)


eth3 Link encap:Ethernet  HWaddr 00:0C:29:80:46:70

inet addr:192.168.146.110  Bcast:192.168.146.255  Mask:255.255.255.0

inet6 addr: fe80::20c:29ff:fe80:4670/64 Scope:Link

UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

RX packets:548 errors:0 dropped:0 overruns:0 frame:0

TX packets:269 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:51810 (50.5 KiB)  TX bytes:32119 (31.3 KiB)

Interrupt:16 Base address:0x2000


lo        Link encap:Local Loopback

inet addr:127.0.0.1  Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING  MTU:16436  Metric:1

RX packets:4 errors:0 dropped:0 overruns:0 frame:0

TX packets:4 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:240 (240.0 b)  TX bytes:240 (240.0 b)


actually there's no such device in your machine. so you should revise it.

  1. Write down the MAC Address

    Device Name     Mac Address        the right Device Name

    eth2 ===> 00:0C:29:80:46:66 ==> eth0

    eth3 ===> 00:0C:29:80:46:70 ==> eth1

  2. Modify the file /etc/udev/rules.d/70-persistent-net.rules , keep the top 2 non-commented lines .

[root@olinfa961 opt]# cat /etc/udev/rules.d/70-persistent-net.rules

# This file was automatically generated by the /lib/udev/write_net_rules

# program, run by the persistent-net-generator.rules rules file.

#

# You can modify it, as long as you keep each rule on a single

# line, and change only the value of the NAME= key.


# PCI device 0x8086:0x100f (e1000)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}==" 00:0c:29:80:46:66 ", ATTR{type}=="1", KERNEL=="eth*", NAME=" eth0 "


# PCI device 0x1022:0x2000 (pcnet32)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}==" 00:0c:29:80:46:70 ", ATTR{type}=="1", KERNEL=="eth*", NAME=" eth1 "

3.  Modify the ifcfg-eth0 and ifcfg-eth1 files:

[root@olinfa961 opt]# cd /etc/sysconfig/network-scripts/

[root@olinfa961 network-scripts]# ls

ifcfg-eth0   ifdown-eth   ifdown-ppp     ifup-aliases  ifup-isdn   ifup-routes       net.hotplug

ifcfg-eth1   ifdown-ippp  ifdown-routes  ifup-bnep     ifup-plip   ifup-sit          network-functions

ifcfg-lo     ifdown-ipv6  ifdown-sit     ifup-eth      ifup-plusb  ifup-tunnel       network-functions-ipv6

ifdown       ifdown-isdn  ifdown-tunnel  ifup-ippp     ifup-post   ifup-wireless

ifdown-bnep  ifdown-post  ifup           ifup-ipv6     ifup-ppp    init.ipv6-global

[root@olinfa961 network-scripts]# cat ifcfg-eth 0

DEVICE=" eth0 "

HWADDR=" 00:0C:29:80:46:66 "

NM_CONTROLLED="yes"

ONBOOT="yes"

4. reboot


作者:Lee-Jane的个人页面
66号公路的博客
原文地址:Linux Network Device Name issue, 感谢原作者分享。