1、找不到eth0檔案
在使用redhat6.5,新裝好的系統,發現沒有eth0網卡,預設的第一個網卡是auto-eth0
[root@rac01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-auto_eth0
type=ethernet
bootproto=none
ipaddr=10.10.10.110
prefix=24
gateway=10.10.10.111
defroute=yes
ipv4_failure_fatal=yes
ipv6init=no
name=eth0
uuid=86d44060-4579-48cc-b85b-219a206ca37c
onboot=yes
hwaddr=00:50:56:95:09:76
last_connect=1411004329
解決方法:
直接更名ifcfg-auto_eth0檔案為eth0,重新開機網卡後會發現,網卡名已經變為eth0
[root@rac01 ~]# service network restart
bringing up loopback interface: [ ok ]
bringing up interface eth0: active connection state: activated
2、ifconfig 發現網卡服務名并未更改
[root@rac01 ~]# ifconfig
auto_eth0 link encap:ethernet hwaddr 00:50:56:95:09:76
inet addr:10.10.10.110 bcast:10.10.10.111 mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe95:976/64 scope:link
up broadcast running multicast mtu:1500 metric:1
rx packets:484 errors:0 dropped:0 overruns:0 frame:0
tx packets:57 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
rx bytes:40095 (39.1 kib) tx bytes:6271 (6.1 kib)
每次更改redhat的網卡資訊,redhat會自動的将網卡的mac位址和對應的網卡服務名關系記錄在/etc/udev/rules.d/70-persistent-net.rules中,修改裡面的對應服務名即可
[root@rac01 ~]# vim /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 0x15ad:0x07b0 (vmxnet3)
subsystem=="net", action=="add", drivers=="?*", attr{address}=="00:0c:29:1e:f6:ad", attr{type}=="1", kernel=="eth*", name="eth0"
修改完成後需重新開機一下系統,再次檢視網卡服務名已經更改
eth0 link encap:ethernet hwaddr 00:50:56:95:09:76
inet addr:10.109.67.81 bcast:10.109.67.255 mask:255.255.255.0
rx packets:985 errors:0 dropped:0 overruns:0 frame:0
tx packets:61 errors:0 dropped:0 overruns:0 carrier:0
rx bytes:74395 (72.6 kib) tx bytes:6527 (6.3 kib)
3、網卡eth0被删除後,新加的網卡成了eth1,如何讓從eth0開始
eth1 link encap:ethernet hwaddr 00:50:56:95:09:76
inet addr:10.10.10.110 bcast:10.10.10.111 mask:255.255.255.0
rx packets:830 errors:0 dropped:0 overruns:0 frame:0
rx bytes:63700 (62.2 kib) tx bytes:6259 (6.1 kib)
eth2 link encap:ethernet hwaddr 00:0c:29:1e:f6:b7
inet addr:10.10.10.120 bcast:10.10.10.111mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe1e:f6b7/64 scope:link
rx packets:777 errors:0 dropped:0 overruns:0 frame:0
tx packets:11 errors:0 dropped:0 overruns:0 carrier:0
rx bytes:54938 (53.6 kib) tx bytes:746 (746.0 b)
同2問題類似,即可以手動的修改70-persistent-net.rules檔案,将對應的mac位址與網卡序号改成想要的,也可以直接删除該檔案,重新開機系統後,redhat會自動的建立該檔案,并從0開始計數。
删除檔案,重新開機系統
[root@rac01 ~]# mv /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/7
0-persistent-net.rules.bak
[root@rac01 ~]# reboot
再次檢視,會發現已經從eht0開始
rx packets:206 errors:0 dropped:0 overruns:0 frame:0
tx packets:68 errors:0 dropped:0 overruns:0 carrier:0
rx bytes:19282 (18.8 kib) tx bytes:7215 (7.0 kib)
eth1 link encap:ethernet hwaddr 00:0c:29:1e:f6:b7
inet addr:10.109.67.83 bcast:10.109.67.255 mask:255.255.255.0
rx packets:131 errors:0 dropped:0 overruns:0 frame:0
rx bytes:8736 (8.5 kib) tx bytes:746 (746.0 b)
4、每次重新開機網卡,總是提示
active connection path: /org/freedesktop/networkmanager/activeconnection/9
此時網卡也可以正常通信,這個是因為redhat自己開發的networkmanager管理工具和/etc/sysconfig/network-scripts/ifcfg-ethx配置不同步造成的。
要消除這個提示,請關閉networkmanager服務即可:
[root@rac01 ~]# service network restart
shutting down loopback interface: [ ok ]
bringing up loopback interface: [ ok ]
bringing up interface eth0: active connection state: activated
active connection path: /org/freedesktop/networkmanager/activeconnection/2 [ ok ]
bringing up interface eth1: active connection state: activated
active connection path: /org/freedesktop/networkmanager/activeconnection/3 [ ok ]
關閉networkmanager服務
[root@rac01 ~]# service networkmanager stop
stopping networkmanager daemon: [ ok ]
再次重新開機網卡
shutting down loopback interface: [ ok ]
bringing up loopback interface: [ ok ]
bringing up interface eth0: [ ok ]
bringing up interface eth1: [ ok ]
5、重新開機網卡出現提示:
bringing up interface eth0: determining if ip address 10.109.67.81 is already in use for device eth0...
[ ok ]
bringing up interface eth1: determining if ip address 10.109.67.83 is already in use for device eth1...
該警告一般是由于網卡解析arp協定導緻的,可在網卡的配置檔案中加入arpcheck=no參數來屏蔽該檢查
[root@rac01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
ipaddr=10.109.67.81
gateway=10.109.67.254
arpcheck=no
再次啟動網卡,一切正常
shutting down interface eth0: [ ok ]
shutting down interface eth1: [ ok ]
shutting down loopback interface: [ ok ]
最新内容請見作者的github頁:http://qaseven.github.io/