欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

CentOS6虚拟机下面配置双网卡

发布时间:2024/4/15 编程问答 47 豆豆
生活随笔 收集整理的这篇文章主要介绍了 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虚拟机下面配置双网卡的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。