配置VMware的网卡
虚拟机的网卡配置保证虚拟机的虚拟网络中桥接配置用的网卡是正确的物理网卡,不要用自动
虚拟网络的参考配置CentOS 7的网卡配置
修改网卡配置文件
vi /etc/sysconfig/network-scripts/ifcfg-ens33
修改要点:
BOOTPROTO=dhcp
ONBOOT=yes
参考配置
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=b33414b9-31b2-4591-9ce6-d1dbbcc46870
DEVICE=ens33
ONBOOT=yes
~
~
~
~
~
~
~
~
"/etc/sysconfig/network-scripts/ifcfg-ens33" 15L, 280C
重启网络服务
service network restart
Restarting network (via systemctl): [ 确定 ]
检查ip是否获取成功
ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:8e:dc:62 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.105/24 brd 192.168.1.255 scope global dynamic ens33
valid_lft 7157sec preferred_lft 7157sec
inet6 fe80::58a2:2308:de31:a9b0/64 scope link
valid_lft forever preferred_lft forever
检查网络是否正常
ping www.baidu.com
PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data.
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=1 ttl=49 time=40.1 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=1 ttl=48 time=40.2 ms (DUP!)
From 192.168.1.101 (192.168.1.101) icmp_seq=2 Redirect Network(New nexthop: gateway (192.168.1.253))
From 192.168.1.101 (192.168.1.101): icmp_seq=2 Redirect Network(New nexthop: gateway (192.168.1.253))
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=2 ttl=49 time=45.8 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=2 ttl=49 time=45.8 ms (DUP!)
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=2 ttl=48 time=45.8 ms (DUP!)
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=2 ttl=48 time=45.8 ms (DUP!)
From 192.168.1.101 (192.168.1.101) icmp_seq=3 Redirect Network(New nexthop: gateway (192.168.1.253))
From 192.168.1.101 (192.168.1.101): icmp_seq=3 Redirect Network(New nexthop: gateway (192.168.1.253))
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=3 ttl=49 time=44.4 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=3 ttl=48 time=44.5 ms (DUP!)
From 192.168.1.101 (192.168.1.101) icmp_seq=4 Redirect Network(New nexthop: gateway (192.168.1.253))
From 192.168.1.101 (192.168.1.101): icmp_seq=4 Redirect Network(New nexthop: gateway (192.168.1.253))
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=4 ttl=49 time=46.0 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=4 ttl=48 time=46.0 ms (DUP!)
^C
--- www.a.shifen.com ping statistics ---
4 packets transmitted, 4 received, +6 duplicates, +3 errors, 0% packet loss, time 3015ms
rtt min/avg/max/mdev = 40.199/44.488/46.080/2.217 ms
网友评论