300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > VM虚拟机双网卡配置

VM虚拟机双网卡配置

时间:2020-01-11 19:21:38

相关推荐

VM虚拟机双网卡配置

问题:

1、因为虚拟架构环境,所以使用VM虚拟机模拟linux centos6.10双网卡,模拟内外网卡。但是我在使用VM为Centos添加第二块网卡时,发现系统却无法识别不到第二块网卡。

2、问题1解决后,发现了第二个问题,网卡都可以ping通,并且可以ping通网关,但是无法ping通外网。

解决方法:

1、添加第二块网卡,并且设置上网方式,第二块网卡建议设置仅主机模式,第一块网卡设置成外网网卡,第二块设置成内网网卡。

2、配置虚拟网络编辑器。

内网网络不能设置DHCP自动分配,设置子网网段以及子网掩码。

3、开机配置网卡信息

4、检查网卡信息

[root@nginx ~]# ping PING www. (58.217.200.15) 56(84) bytes of data.64 bytes from 58.217.200.15: icmp_seq=1 ttl=128 time=10.8 ms64 bytes from 58.217.200.15: icmp_seq=2 ttl=128 time=9.32 ms64 bytes from 58.217.200.15: icmp_seq=3 ttl=128 time=11.1 ms网络通畅[root@nginx ~]# cd /etc/sysconfig/network-scripts/[root@nginx network-scripts]# ll总用量 224-rw-r--r--. 1 root root 231 5月 23 09:45 ifcfg-eth0-rw-r--r--. 1 root root 254 4月 27 18:58 ifcfg-lolrwxrwxrwx. 1 root root 20 5月 30 23:02 ifdown -> ../../../sbin/ifdown-rwxr-xr-x. 1 root root 627 4月 27 18:58 ifdown-bnep-rwxr-xr-x. 1 root root 5891 4月 27 18:58 ifdown-eth-rwxr-xr-x. 1 root root 6195 3月 23 ifdown-ib-rwxr-xr-x. 1 root root 781 4月 27 18:58 ifdown-ippp-rwxr-xr-x. 1 root root 4168 4月 27 18:58 ifdown-ipv6lrwxrwxrwx. 1 root root 11 5月 30 23:02 ifdown-isdn -> ifdown-ippp-rwxr-xr-x. 1 root root 1617 4月 27 18:58 ifdown-post-rwxr-xr-x. 1 root root 1064 4月 27 18:58 ifdown-ppp-rwxr-xr-x. 1 root root 835 4月 27 18:58 ifdown-routes-rwxr-xr-x. 1 root root 1465 4月 27 18:58 ifdown-sit-rwxr-xr-x. 1 root root 1434 4月 27 18:58 ifdown-tunnellrwxrwxrwx. 1 root root 18 5月 30 23:02 ifup -> ../../../sbin/ifup-rwxr-xr-x. 1 root root 13226 4月 27 18:58 ifup-aliases-rwxr-xr-x. 1 root root 859 4月 27 18:58 ifup-bnep-rwxr-xr-x. 1 root root 12119 4月 27 18:58 ifup-eth-rwxr-xr-x. 1 root root 11339 3月 23 ifup-ib-rwxr-xr-x. 1 root root 11971 4月 27 18:58 ifup-ippp-rwxr-xr-x. 1 root root 10490 4月 27 18:58 ifup-ipv6lrwxrwxrwx. 1 root root9 5月 30 23:02 ifup-isdn -> ifup-ippp-rwxr-xr-x. 1 root root 727 4月 27 18:58 ifup-plip-rwxr-xr-x. 1 root root 954 4月 27 18:58 ifup-plusb-rwxr-xr-x. 1 root root 2527 4月 27 18:58 ifup-post-rwxr-xr-x. 1 root root 4154 4月 27 18:58 ifup-ppp-rwxr-xr-x. 1 root root 1925 4月 27 18:58 ifup-routes-rwxr-xr-x. 1 root root 3289 4月 27 18:58 ifup-sit-rwxr-xr-x. 1 root root 2563 4月 27 18:58 ifup-tunnel-rwxr-xr-x. 1 root root 4011 4月 27 18:58 ifup-wireless-rwxr-xr-x. 1 root root 4623 4月 27 18:58 init.ipv6-global-rwxr-xr-x. 1 root root 1219 4月 27 18:58 net.hotplug-rw-r--r--. 1 root root 15360 4月 27 18:58 network-functions-rw-r--r--. 1 root root 29857 4月 27 18:58 network-functions-ipv6

发现却没有新添加网卡的信息,所以我们需要添加网卡配置。并且对第二块网卡进行配置。

5、配置第二块网卡

[root@nginx network-scripts]# cp ifcfg-eth0 ifcfg-eth1[root@nginx network-scripts]# vim ifcfg-eth1[root@nginx network-scripts]# cat ifcfg-eth1DEVICE=eth1#HWADDR=00:0C:29:D8:83:E9TYPE=Ethernet#UUID=83ad6605-21a0-426f-9aba-7d66fe2a5845ONBOOT=yesNM_CONTROLLED=yesBOOTPROTO=staticIPADDR=192.168.184.10NETMASK=255.255.255.0

将第一块网卡配置cp,并且编辑第二块网卡信息,配置文件中的DEVICE=eth1要修改(注意DEVICE是设备名,要与第二块网卡的名字相同,不要忘记修改,如果设备名称和eth0相同,会造成网络问题)。注释掉HWADDR以及UUID两项。并且添加修改BOOTPROTO为static(静态IP)。添加IPADDR=IP (与之前的虚拟网络编辑器中的网段相同,不同即网络不同),NETMASK=255.255.255.0 (子网掩码,与之前的虚拟网络编辑器中的子网掩码相同,不同即网络不同),本次模拟不使用网关。

[root@nginx network-scripts]# rm /etc/udev/rules.d/70-persistent-net.rules [root@nginx ~]# rm /etc/udev/rules.d/70-persistent-cd.rules

删除这两个文件,不需要备份,系统重启后会自动生成。

到此配置就已经修改完成了,需要reboot然后查看。

[root@nginx ~]# ifconfigeth0Link encap:Ethernet HWaddr 00:0C:29:D8:83:E9 inet addr:192.168.23.128 Bcast:192.168.23.255 Mask:255.255.255.0inet6 addr: fe80::20c:29ff:fed8:83e9/64 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:111 errors:0 dropped:0 overruns:0 frame:0TX packets:96 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000 RX bytes:12972 (12.6 KiB) TX bytes:14284 (13.9 KiB)eth1Link encap:Ethernet HWaddr 00:0C:29:D8:83:F3 inet addr:192.168.184.10 Bcast:192.168.184.255 Mask:255.255.255.0inet6 addr: fe80::20c:29ff:fed8:83f3/64 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:13 errors:0 dropped:0 overruns:0 frame:0TX packets:16 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000 RX bytes:1347 (1.3 KiB) TX bytes:1128 (1.1 KiB)lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0inet6 addr: ::1/128 Scope:HostUP LOOPBACK RUNNING MTU:65536 Metric:1RX packets:4 errors:0 dropped:0 overruns:0 frame:0TX packets:4 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:0 RX bytes:240 (240.0 b) TX bytes:240 (240.0 b)[root@nginx ~]# ping PING www. (58.217.200.13) 56(84) bytes of data.64 bytes from 58.217.200.13: icmp_seq=1 ttl=128 time=11.3 ms64 bytes from 58.217.200.13: icmp_seq=2 ttl=128 time=9.57 ms64 bytes from 58.217.200.13: icmp_seq=3 ttl=128 time=12.7 ms

配置完成!!!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。