免费注册 查看新帖 |

Chinaunix

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

Linux 路由ping不通 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-07-20 22:38 |只看该作者 |正序浏览
我有两台linux rhel5x64, rhel5x86, 两台机器都有两块网卡,我打算用rhel5 x64作路由,rhel5 x86 通过rhel5 x64 上网,可是就是通不过:
rhel5 x64 两块网卡 eth0:   155.35.99.99   连在公司内网
                    eth1:  我设的IP: 192.168.1.10 和rhel5 x86 的 eth1 直连
rhel5 x86 两块网卡 eth0: 155.35.99.98  原来连在公司内网,现在我把网线断了
                    eth1:  我设的IP: 192.168.1.11 和rhel5 x64 的 eth1 直连

在rhel5 x64:
[root@qa6202amd-2 rc.d]# cat /etc/rc.d/router
#!/bin/bash

echo "1" > /proc/sys/net/ipv4/ip_forward
INET_IFACE="eth0"
INET_IP="155.35.99.99"
LAN_IFACE="eth1"
LAN_IP="192.168.1.10"
LAN_IP_RANGE="192.168.1.0/255"

IPT="/sbin/iptables"

/sbin/depmod -a
/sbin/modprobe ip_tables
/sbin/modprobe iptable_nat
/sbin/modprobe ip_nat_ftp
/sbin/modprobe ipt_LOG

$IPT -P INPUT ACCEPT
$IPT -P FORWARD ACCEPT
$IPT -P OUTPUT ACCEPT
$IPT -t nat -P PREROUTING ACCEPT
$IPT -t nat -P POSTROUTING ACCEPT
$IPT -t nat -P OUTPUT ACCEPT

for TABLE in filter nat mangle ; do
$IPT -t $TABLE -F
$IPT -t $TABLE -X
done


$IPT -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

for DNS in $(grep ^n /etc/resolv.conf|awk '{print $2}'); do
$IPT -A INPUT -p udp -s $DNS --sport domain -j ACCEPT
done

if [ "$INET_IFACE"=PPP0 ]; then
$IPT -t nat -A POSTROUTING -o $INET_IFACE -j MASQUERADE
else
$IPT -t nat -A POSTROUTING -o $INET_IFACE -j SNAT --to $INET_IP
fi

在rhel5 x64能直接通过 ssh 192.168.1.11 登上rhel5 x86, 可是登上去之后 ping 155.35.99.99
[root@laoku01-rhel5-1 ~]# ping 155.35.99.99
PING 155.35.99.99 (155.35.99.99) 56(84) bytes of data.
From 155.35.99.99 icmp_seq=2 Destination Host Unreachable
From 155.35.99.99 icmp_seq=3 Destination Host Unreachable
From 155.35.99.99 icmp_seq=4 Destination Host Unreachable

像是我的路由没有设置好,哪里的问题呢?

然后在非路由linux rhel5x86 上,我删除了路由155.35.0.0,结果ping变成了"Network is unreachable":
#ip route
192.168.1.0/24 dev eth1  proto kernel  scope link  src 192.168.1.11
155.35.0.0/16 dev eth0  proto kernel  scope link  src 155.35.99.98
# ip route delete 155.35.0.0/16
# ip route
192.168.1.0/24 dev eth1  proto kernel  scope link  src 192.168.1.11
# ping 155.35.99.99
connect: Network is unreachable
  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP