免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4172 | 回复: 7
打印 上一主题 下一主题

为什么我外网可以访问主机,但是主机不能访问外网,主机ping外网也拼不通 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-11-10 11:29 |只看该作者 |倒序浏览
本帖最后由 hgwx 于 2010-11-10 11:55 编辑

如下图

[root@#~]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
113.105.65.128  0.0.0.0         255.255.255.192 U         0 0          0 eth0
58.251.128.0    0.0.0.0         255.255.255.192 U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
0.0.0.0         113.105.65.129  0.0.0.0         UG        0 0          0 eth0


ping www.qq.com
拼没有反映

[root@#~]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:1B:FC:91:77:3C
          inet addr:113.105.65.173  Bcast:113.105.65.191  Mask:255.255.255.192
          inet6 addr: fe80::21b:fcff:fe91:773c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1184802 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1451445 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:132059260 (125.9 MiB)  TX bytes:1800417557 (1.6 GiB)
          Interrupt:169

eth0:0    Link encap:Ethernet  HWaddr 00:1B:FC:91:77:3C
          inet addr:58.251.128.46  Bcast:58.251.128.63  Mask:255.255.255.192
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:169


网关可以ping 通,但同一网段的其它机器也ping 不通


拼网关
[root@#~]# ping 58.251.128.63 -b  
WARNING: pinging broadcast address
PING 58.251.128.63 (58.251.128.63) 56(84) bytes of data.
64 bytes from 58.251.128.46: icmp_seq=0 ttl=64 time=0.048 ms
64 bytes from 58.251.128.46: icmp_seq=1 ttl=64 time=0.042 ms
64 bytes from 58.251.128.46: icmp_seq=2 ttl=64 time=0.029 ms
64 bytes from 58.251.128.46: icmp_seq=3 ttl=64 time=0.038 ms
64 bytes from 58.251.128.46: icmp_seq=4 ttl=64 time=0.034 ms
64 bytes from 58.251.128.46: icmp_seq=5 ttl=64 time=0.031 ms
64 bytes from 58.251.128.46: icmp_seq=6 ttl=64 time=0.032 ms
64 bytes from 58.251.128.46: icmp_seq=7 ttl=64 time=0.036 ms
64 bytes from 58.251.128.46: icmp_seq=8 ttl=64 time=0.026 ms


同一网段的其它主机
[root@#~]# ping 58.251.128.47
PING 58.251.128.47 (58.251.128.47) 56(84) bytes of data.
From 58.251.128.46 icmp_seq=1 Destination Host Unreachable
From 58.251.128.46 icmp_seq=2 Destination Host Unreachable
From 58.251.128.46 icmp_seq=3 Destination Host Unreachable




DNS肯定没问题,在说Ping IP与DNS也没多大关系

论坛徽章:
0
2 [报告]
发表于 2010-11-10 12:29 |只看该作者
WARNING: pinging broadcast address

论坛徽章:
20
CU大牛徽章
日期:2013-03-13 15:29:072015亚冠之阿尔希拉尔
日期:2015-09-12 09:33:562015年亚冠纪念徽章
日期:2015-09-22 17:12:202015亚冠之本尤德科
日期:2015-10-29 16:18:18神斗士
日期:2015-11-23 13:37:23青铜圣斗士
日期:2015-12-07 10:14:28平安夜徽章
日期:2015-12-26 00:06:3015-16赛季CBA联赛之佛山
日期:2016-01-18 08:59:06shanzhi
日期:2016-06-17 17:59:3115-16赛季CBA联赛之同曦
日期:2016-11-03 14:43:552015七夕节徽章
日期:2015-08-21 11:06:17丑牛
日期:2014-12-30 16:06:17
3 [报告]
发表于 2010-11-10 12:43 |只看该作者
配置有问题
确定外网可以访问你的主机?

论坛徽章:
0
4 [报告]
发表于 2010-11-10 13:08 |只看该作者
首先,你ping的广播地址,而不是网关,其实那个返回的数据包应该是自己返回给自己的
其次,ping不通不代表网络不通,有可能禁止了icmp

论坛徽章:
0
5 [报告]
发表于 2010-11-10 15:56 |只看该作者
之前有一次我ping www.qq.com 是不通的。 刚才ping通了。  可能不通的服务器吧。
然后,那个广播地址的警告可能你没看到。

论坛徽章:
0
6 [报告]
发表于 2010-11-10 18:44 |只看该作者
nslookup dns ,ping dns

论坛徽章:
0
7 [报告]
发表于 2010-11-17 12:08 |只看该作者
  1. iptables -vnL
复制代码
看看

论坛徽章:
0
8 [报告]
发表于 2010-11-18 16:27 |只看该作者
nslookup dns ,ping dns
版主杀手 发表于 2010-11-10 18:44



    正解!测试再看结果
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP