Linux 虚拟机访问外网设置@TOC
centos7 虚拟机不能访问外网
新作的centos7 虚拟机发现不能访问外网:
[root@localhost ~]# curl www.baidu.com
curl: (6) Could not resolve host: www.baidu.com; 未知的错误
然后开始解决问题:
[root@localhost ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 100 0 0 ens192
192.168.1.0 0.0.0.0 255.255.255.0 U 100 0 0 ens192
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
然后编辑resolv.conf文件,添加内容如下:
[root@localhost ~]# vim /etc/resolv.conf
# Generated by NetworkManager
nameserver 218.30.19.50
nameserver 8.8.8.8
~