LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 873|回复: 4

折腾了半天了,还是不能实现单网卡共享ADSL上网

[复制链接]
发表于 2006-9-16 09:22:05 | 显示全部楼层 |阅读模式
拓扑如下:
ADSL MODEM接的是HUB的uplink口,FC5(ip:192.168.0.12)和一台windows(ip:192.168.0.13)接在hub上
现在使用FC5作主机,按照置顶的帖子设置了
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o ppp0 -j MASQUERADE

ADSL拨号上去以后,FC5本机可以访问外网,WINDOWS机器可以ping通FC5,但是无法访问外网,从tcpdump的抓包来看,FC5的eth0上收到了WINDOWS的ping包,但是ppp0这个虚拟网卡上抓不到ping包,也就是说FC5收到以后没有进行转发,

请各位帮我分析一下是什么原因?谢谢先
发表于 2006-9-16 10:44:35 | 显示全部楼层
WINDOWS设置网关为192.168.0.12,如果已经设置,贴一下如下内容:
windows下:
  1. route print(是不是这样?)
复制代码
FC5下:
  1. #iptables -nL
  2. #iptables -t nat -nL
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-9-16 17:10:46 | 显示全部楼层
[root@localhost wine-0.9.21]# iptables -t nat -nL
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  192.168.0.0/24       0.0.0.0/0

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

[root@localhost wine-0.9.21]# iptables -nL
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-9-16 17:16:49 | 显示全部楼层
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:\Documents and Settings\>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 50 ba 41 1a ab ...... D-Link DE-528 Ethernet PCI Adapter - 数据包计划
程序微型端口
===========================================================================
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0     192.168.0.12    192.168.0.13       30
        127.0.0.0        255.0.0.0        127.0.0.1       127.0.0.1       1
      192.168.0.0    255.255.255.0     192.168.0.13    192.168.0.13       30
     192.168.0.13  255.255.255.255        127.0.0.1       127.0.0.1       30
    192.168.0.255  255.255.255.255     192.168.0.13    192.168.0.13       30
        224.0.0.0        240.0.0.0     192.168.0.13    192.168.0.13       30
  255.255.255.255  255.255.255.255     192.168.0.13    192.168.0.13       1
Default Gateway:      192.168.0.12
===========================================================================
Persistent Routes:
  None

C:\Documents and Settings\
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-9-16 17:19:07 | 显示全部楼层
比较奇怪的时候,我用第三台机器(windows,192.168.0.2)拨号上去,192.168.0.13网关还是设置成192.168.0.12,然后192.168.0.12网关设置成192.168.0.2,那么192.168.0.13这台机器就可以上网,说明转发还是可以进行的
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表