我已经安装了 CentOS 7,除非我将镜像列表添加到我的,否则我无法更新/etc/hosts
。
我可以 ping 到任何域,但除非我将地址放入我的主机文件中,否则无法浏览。
ping 命令成功:
$ ping yahoo.com
PING yahoo.com (98.138.253.109) 56(84) bytes of data.
64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_seq=1 ttl=56 time=242 ms
64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_seq=2 ttl=56 time=242 ms
64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_seq=3 ttl=56 time=241 ms
^C
--- yahoo.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 241.374/241.939/242.420/0.713 ms
curl 命令失败:
$ curl yahoo.com
curl: (6) Could not resolve host: yahoo.com; Unknown error
答案1
- 停止防火墙
service firewalld stop
- 启动 iptables
service iptables start
- 添加以下规则:
iptables -I INPUT -j ACCEPT
,和iptables -I OUTPUT -j ACCEPT
- 如果有效,请使用以下命令保存命令:
service iptables save