![无法 ping 通本地主机以及 Ubuntu 中的任何主机](https://linux22.com/image/694692/%E6%97%A0%E6%B3%95%20ping%20%E9%80%9A%E6%9C%AC%E5%9C%B0%E4%B8%BB%E6%9C%BA%E4%BB%A5%E5%8F%8A%20Ubuntu%20%E4%B8%AD%E7%9A%84%E4%BB%BB%E4%BD%95%E4%B8%BB%E6%9C%BA.png)
我正在使用 ssh 连接到服务器(Ubuntu),并尝试 ping 到 localhost127.0.0.1
或 google.com、bitbucket.org、8.8.8.8,但它不起作用
ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
^C
--- 127.0.0.1 ping statistics ---
308 packets transmitted, 0 received, 100% packet loss, time 309454ms
ping 至 bitbucket
ping bitbucket.org
PING bitbucket.org (104.192.143.2) 56(84) bytes of data.
^C
--- bitbucket.org ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3024m
去谷歌
ping google.com
ping: unknown host google.com
这是我的主机文件
127.0.0.1 localhost
127.0.1.1 odoo9-test odoo9-test.com
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
104.192.143.2 bitbucket.org
路线-n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.10.1.1 0.0.0.0 UG 0 0 0 eth0
10.10.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
/etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 10.10.1.103
iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:8069
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:http
Chain FORWARD (policy DROP)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain ufw-after-forward (0 references)
target prot opt source destination
....
并/proc/sys/net/ipv4/icmp_echo_ignore_all
设置为 0
我是服务器和网络方面的新手,我研究了很多与我的问题相关的链接,但找不到如何解决这个问题,请帮帮我
答案1
删除除 TCP 端口 22、80、8069 之外的所有输入流量。
Chain INPUT (policy DROP)
不建议设置整个策略drop
,除非您确实知道自己在做什么。