
问题:
centos7 虚拟机不能访问外网
[root@localhost ~]# curl www.baidu.com curl: (6) Could not resolve host: www.baidu.com; 未知的错误
(推荐教程:centos使用教程)
解决方法:
[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 ~ ~
添加路由:
SHOPEX简灰服装商城整站源码下载。 安装方法:1.解压上传程序至网站根目录.. 访问:域名/bak.(用户名:admin 密码:123456)2.进入帝国备份王后,配置数据库数据库信息.选择-www.taomoban.net目录.还原数据库.3.修改FTP目录下的config/config.phpphp 数据库连接信息.4.登陆网站后台--清空缓存..5.删除bak文件夹 后台:shopadm
[root@localhost ~]# route add default gw 192.168.1.1
再测是否可以访问百度
[root@localhost ~]# curl www.baidu.com百度一下,你就知道
OK,可以正常访问了。
相关视频教程推荐:linux视频教程









