虚拟机CentOS 7设置静态IP且联网

(1)编辑网卡vmnet8

在这里插入图片描述
在这里插入图片描述
上图中,子网IP也就是网段地址,可以自己设置,不影响。

如下图查看并记住网关
在这里插入图片描述

(2)编辑网卡文件

在这里插入图片描述

(3)修改resolv.conf文件

在这里插入图片描述

(4)重启network并测试

[root@dell ~]#systemctl restart network
[root@dell ~]# 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=128 time=26.1 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=2 ttl=128 time=25.4 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=3 ttl=128 time=23.6 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=4 ttl=128 time=24.1 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=5 ttl=128 time=23.5 ms
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=6 ttl=128 time=23.0 ms
^C
--- www.a.shifen.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5007ms
rtt min/avg/max/mdev = 23.074/24.331/26.142/1.089 ms
[root@dell ~]# 
发布了7 篇原创文章 · 获赞 8 · 访问量 288

猜你喜欢

转载自blog.csdn.net/zmr123zmr/article/details/104626747