免费注册 查看新帖 |

Chinaunix

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

网络ping不通 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-08-06 20:26 |只看该作者 |倒序浏览
网络拓朴如下:

光纤---->cisco 851(10.92.x.209)---->(10.96.x.211)FreeBSD(192.168.2.1)---->三层交换机(192.168.2.2)---客户端PC(192.168.10.2)

因为多个固定IP,我打算在FreeBSD上配置了squid,让这台机做代理上网用的。

所有配置都如上图所示,我在 FreeBSD 上配置后可以 ping 通10.92.x.209,也可以 ping 通 192.168.10.2,ping 163.com 等外部网站也没有任何问题。
客户端PC(192.168.10.2) 可以 ping 通 10.96.x.211,就是 ping 不通 10.92.x.209,搞了好久,没搞明白是怎么回事。

希望各位给与帮助。


# cat /etc/rc.conf
defaultrouter="10.92.x.209"
hostname="test.org"
ifconfig_em0="inet 10.92.x.211  netmask 255.255.255.248"
ifconfig_em1="inet 192.168.2.1  netmask 255.255.255.0"

gateway_enable="YES"



# cat /etc/rc.local
route add -net 192.168.0.0 -netmask 255.255.0.0 192.168.2.2



另外,如果我把BSD这台机换成一个普通的宽带路由器,再设定和FreeBSD一样的IP地址,却是完全可以ping 通的。

[ 本帖最后由 Bg 于 2008-8-6 20:33 编辑 ]

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
2 [报告]
发表于 2008-08-06 20:40 |只看该作者
你traceroute  一下 看到哪里有问题

论坛徽章:
0
3 [报告]
发表于 2008-08-06 21:01 |只看该作者
需要在freebsd上做nat

论坛徽章:
0
4 [报告]
发表于 2008-08-06 21:04 |只看该作者
在客户端PC (XP)上ping

Pinging 10.92.x.211 with 32 bytes of data:
Reply from 10.92.x.211: bytes=32 time=83ms TTL=63
Reply from 10.92.x.211: bytes=32 time=82ms TTL=63
Reply from 10.92.x.211: bytes=32 time<1ms TTL=63
Reply from 10.92.x.211: bytes=32 time<1ms TTL=63

Ping statistics for 10.92.66.211:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 83ms, Average = 41ms



ping 10.92.x.209
提示超时。


在客户端PC (XP)上tracert 10.92.x.209

Tracing route to 10.92.x.209 over a maximum of 30 hops

  1    84 ms    93 ms    99 ms  192.168.10.244

  2    <1 ms    82 ms    82 ms  192.168.2.1
  3     *        *        *     Request timed out.
  4     *        *        *     Request timed out.
  5     *        *        *     Request timed out.
  6     *        *        *     Request timed out.
  7     *        *        *     Request timed out.
  8     *        *        *     Request timed out.
  9     *        *        *     Request timed out.
10     *        *        *     Request timed out.
11     *        *        *     Request timed out.
12     *        *        *     Request timed out.




在客户端PC (XP)上tracert 10.92.x.211
racing route to 10.92.x.211 over a maximum of 30 hops

  1    84 ms     4 ms    99 ms  192.168.10.244
  2    83 ms    83 ms    83 ms  10.92.x.211

Trace complete.





在 FreeBSD 上 ping 192.168.10.113

ING 192.168.10.113 (192.168.10.113): 56 data bytes
64 bytes from 192.168.10.113: icmp_seq=0 ttl=127 time=0.391 ms
64 bytes from 192.168.10.113: icmp_seq=1 ttl=127 time=0.292 ms
64 bytes from 192.168.10.113: icmp_seq=2 ttl=127 time=0.373 ms



在 FreeBSD 上 tracert 192.168.10.113

traceroute 192.168.10.113
traceroute to 192.168.10.113 (192.168.10.113), 64 hops max, 52 byte packets
1  192.168.2.2 (192.168.2.2)  1.356 ms  11.813 ms  16.730 ms
2  * * *
3  * * *



在 FreeBSD 上 tracert 192.168.10.244(10网段的网关)

traceroute 192.168.10.244
traceroute to 192.168.10.244 (192.168.10.244), 64 hops max, 52 byte packets
1  192.168.2.2 (192.168.2.2)  1.276 ms  8.332 ms  16.720 ms

论坛徽章:
0
5 [报告]
发表于 2008-08-06 21:16 |只看该作者

回复 #3 feillex 的帖子

感谢您的回复和提示。

我本来一直是用PF上的NAT功能,配置好后一直没有注意。

刚才换成 ipfw 的 NAT ,居然可以ping 通了,不知是不是我的PF配置错误了。


最后成功的做法是:

cat /etc/rc.conf
gateway_enable="YES"
firewall_enable="YES"
firewall_type="open"
natd_enable="YES"
natd_interface="em0"
natd_flags="-dynamic -m"

感谢所有给与帮助的朋友,谢谢你们。

论坛徽章:
0
6 [报告]
发表于 2008-08-07 12:07 |只看该作者
十有八九是你的pf有问题。
排查时可分别查看
pfctl -sn

pfctl -sr

来查看nat和过滤规则。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP