CentOS6虚拟机下面配置双网卡
虛擬機上面安裝CentOS 6,添加一塊網卡之后發現新添加的網卡無法自動啟動,在CentOS 5中新添加網卡之后是可以直接自動啟動的。
輸入ifconfig之后如下:
eth0 ? ? ?Link encap:Ethernet ?HWaddr 00:0C:29:D4:80:93 ?
? ? ? ? ?inet addr:192.168.0.204 ?Bcast:192.168.0.255 ?Mask:255.255.255.0
? ? ? ? ?inet6 addr: fe80::20c:29ff:fed4:8093/64 Scope:Link
? ? ? ? ?UP BROADCAST RUNNING MULTICAST ?MTU:1500 ?Metric:1
? ? ? ? ?RX packets:300 errors:0 dropped:0 overruns:0 frame:0
? ? ? ? ?TX packets:128 errors:0 dropped:0 overruns:0 carrier:0
? ? ? ? ?collisions:0 txqueuelen:1000
? ? ? ? ?RX bytes:29737 (29.0 KiB) ?TX bytes:14667 (14.3 KiB)
? ? ? ? ?Interrupt:19 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:0 errors:0 dropped:0 overruns:0 frame:0
? ? ? ? ?TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
? ? ? ? ?collisions:0 txqueuelen:0
? ? ? ? ?RX bytes:0 (0.0 b) ?TX bytes:0 (0.0 b)
可見沒有eth1的信息
再輸入dmesg | grep eth
[root@localhost ~]# dmesg | grep eth
eth0: registered as PCnet/PCI II 79C970A
eth1: registered as PCnet/PCI II 79C970A
eth0: link up
說明eth1網卡已經被系統所識別,這樣我們就可以查看關于網絡的udev,這個udev的具體網卡序號的配置文件是:/etc/udev/rules.d/70-persistent-net.rules
cat ?/etc/udev/rules.d/70-persistent-net.rules ?結果如下:
[root@localhost ~]# 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 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:d4:80:93", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:d4:80:9d", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
這樣我們就找到了eth1的mac地址了,然后把eth0的配置文件ifcfg-eth0復制一份改成ifcfg-eth1修改設備名、mac地址、IP地址重新啟動網絡服務就OK了!
轉載于:https://blog.51cto.com/mofeihu/1263709
總結
以上是生活随笔為你收集整理的CentOS6虚拟机下面配置双网卡的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 配置管理小报110904:htpassw
- 下一篇: 注册用户模块 password bug