论坛风格切换切换到宽版
  • 741阅读
  • 9回复

[问题求助]Linux下NAT是否支持多个内部网段? [复制链接]

上一主题 下一主题
 
发帖
2016
C币
-235786
威望
365
贡献值
1
银元
-2
铜钱
4486
人人网人气币
0
只看楼主 倒序阅读 使用道具 楼主  发表于: 2009-05-01
PPPoE拨号后,iptables设置.SNAT,本网.段内机器可以上网;            杀毒

其它网段不行,Linux机器上已添加到这些网段的路由(交给三层交换机处理),其它网段的数据包只能.到Linux机器的内网接.口<性病>

#iptables -t nat -A POST.ROUTING -s 192..168.2.0/24 -o ppp0 -j MASQUERADE--- 印刷
针对该.网段的已经添加,但该网段机器访问不了.Internet           鲜花

还缺什么?

评价一下你浏览此帖子的感受

精彩

感动

搞笑

开心

愤怒

无聊

灌水
离线mxdkey.
发帖
2108
C币
-60626
威望
400
贡献值
1
银元
-2
铜钱
4685
人人网人气币
0
只看该作者 沙发  发表于: 2010-04-13
难道是俺描述得不清楚?

现在需要是把192.168.2.0/24网段也做SNAT,我已经添加了#iptables -A FORWARD -s 192.168.2.0/24 -j ACCEPT 还是不生效,数据包只到达了内网接口

离线alantam.
发帖
2031
C币
-60567
威望
364
贡献值
1
银元
-2
铜钱
4519
人人网人气币
0
只看该作者 板凳  发表于: 2010-04-13
#iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o ppp0 -j MASQUERADE

#iptables -A FORWARD -i ppp0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
#iptables -A FORWARD -i eth0 -o ppp0 -j ACCEPT

where eth0 is the NIC to the subnet of 192.168.2.0

发帖
2081
C币
-60611
威望
377
贡献值
1
银元
-3
铜钱
4767
人人网人气币
0
只看该作者 地板  发表于: 2010-04-13


QUOTE:原帖由 "yunqing" 发表:
#iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o ppp0 -j MASQUERADE

#iptables -A FORWARD -i ppp0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
#iptables -A FORWARD -i eth0 -o ppp0 -j ..........


这样如何?应该可以解决了吧

离线超超.
发帖
2182
C币
-60297
威望
374
贡献值
1
银元
-7
铜钱
4720
人人网人气币
0
只看该作者 4楼 发表于: 2010-04-13
应该是路由问题
既然服务器上已经加了到内部其他网段的路由
三层交换上加了指向服务器的缺省路由了吗?

离线ygzhd.
发帖
1968
C币
-236010
威望
330
贡献值
6
银元
0
铜钱
4280
人人网人气币
0
只看该作者 5楼 发表于: 2010-04-13
内部能到服务器的内网卡,就应该是三层交换上的路由问题了

cisco 的话看看 sh run里边有没有
ip route 0.0.0.0 0.0.0.0 服务器IP

离线dorgel.
发帖
2169
C币
-193168
威望
399
贡献值
1
银元
-1
铜钱
4859
人人网人气币
0
只看该作者 6楼 发表于: 2010-04-13
还是没生效!

交换机上设置#ip route 0.0.0.0 0.0.0.0 服务器内网IP

#show ip route 默认路由是存在的

我不同网段的数据包都能到达这个机器的内网口了。。。

离线纸风铃.
发帖
2171
C币
-234920
威望
418
贡献值
1
银元
0
铜钱
4977
人人网人气币
0
只看该作者 7楼 发表于: 2010-04-13
[root@proxy ~]# iptables --list
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
RH-Firewall-1-INPUT  all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  192.168.2.0/24       anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere

Chain L (0 references)
target     prot opt source               destination

Chain RH-Firewall-1-INPUT (1 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     icmp --  anywhere             anywhere            icmp any
ACCEPT     ipv6-crypt--  anywhere             anywhere
ACCEPT     ipv6-auth--  anywhere             anywhere
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:5353
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited


差哪儿呢...

发帖
2021
C币
-132535
威望
366
贡献值
1
银元
-3
铜钱
4503
人人网人气币
0
只看该作者 8楼 发表于: 2010-04-13
可以支持!

离线iolia1789.
发帖
2112
C币
-235624
威望
397
贡献值
1
银元
-1
铜钱
4728
人人网人气币
0
只看该作者 9楼 发表于: 2010-04-13
好久没看,看见iptables还是那么头疼!

把iptables全都 -F 了
然后只加一个SNAT的,要是还不行就是你的网络结构问题,从最简单处入手把。或者你tracert
另:“Linux机器上已添加到这些网段的路由(交给三层交换机处理),”这句话什么意思?
快速回复
限100 字节
批量上传需要先选择文件,再选择上传
 
上一个 下一个