小小磊
还是关于linux的网关问题
不好意思,第一次做问题比较多。。。
linu主机
eth0:192.168.0.1
eth1:218.218.218.18
网关:218.218.218.17 是服务提供商给的网关
然后防火墙的设置
iptables -t mangle -P INPUT ACCEPT
iptables -t mangle -P OUTPUT ACCEPT
iptables -t mangle -P FORWARD ACCEPT
iptables -t mangle -P PREROUTING ACCEPT
iptables -t mangle -P POSTROUTING ACCEPT
iptables -t filter -P INPUT ACCEPT
iptables -t filter -P OUTPUT ACCEPT
iptables -t filter -P FORWARD ACCEPT
iptables -t nat -P PREROUTING DROP
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT
iptables -A INPUT -i eth1 -j DROP
iptables -t nat -A PREROUTING -i eth0 -j ACCEPT
iptables -t nat -A PREROUTING -i lo -j ACCEP
iptables -t nat -A POSTROUTING -o eth1 ! -s 218.218.218.17/29 -j SNAT --to 218.218.218.18
配置就这样了。但是接上以后ping不通0.1短的网络。。。而且也出不去
请各位帮忙看看会是哪里的原因
ssffzz1
[color=Yellow]iptables -t mangle -P INPUT ACCEPT
iptables -t mangle -P OUTPUT ACCEPT
iptables -t mangle -P FORWARD ACCEPT
iptables -t mangle -P PREROUTING ACCEPT
iptables -t mangle -P POSTROUTING ACCEPT
iptables -t filter -P INPUT ACCEPT
iptables -t filter -P OUTPUT ACCEPT
iptables -t filter -P FORWARD ACCEPT[/color]
[color=Red]iptables -t nat -P PREROUTING DROP[/color]
[color=Yellow]iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT[/color]
[color=Red]iptables -A INPUT -i eth1 -j DROP[/color]
iptables -t nat -A PREROUTING -i eth0 -j ACCEPT
iptables -t nat -A PREROUTING -i lo -j ACCEP
iptables -t nat -A POSTROUTING -o eth1 ! -s 218.218.218.17/29 -j SNAT --to 218.218.218.18
这句没明白什么意思。
[color=Yellow]黄色的[/color]:基本没用处,因为默认规则就是ACCEPT,重复设置。
[color=Red]红色的:[/color]不理解为什么要吧NAT表设置为DROP,还有INPUT也是DROP,这样你能通吗?记得原因已经给你分析过了。
最后,你还是要看IPTABLES的资料,系统的学习一下IPTABLES的规则。尽管这好像是我第三次提同样的建议了。
小小磊
[quote]原帖由 [i]ssffzz1[/i] 于 2008-2-19 07:11 发表 [url=http://linux.chinaunix.net/bbs/redirect.php?goto=findpost&pid=6513395&ptid=978511][img]http://linux.chinaunix.net/bbs/images/common/back.gif[/img][/url]
iptables -t mangle -P INPUT ACCEPT
iptables -t mangle -P OUTPUT ACCEPT
iptables -t mangle -P FORWARD ACCEPT
iptables -t mangle -P PREROUTING ACCEPT
iptables -t mangle -P POSTROUTING ACCEPT
i ... [/quote]
谢谢你!~
不过我那些规则是以前网关上面的,网络是通的
我现在做了个adsl网关,也是那些规则,就是地址转换那条不一样了,网络也是通的。
iptables -t nat -A POSTROUTING -o eth1 ! -s 218.218.218.17/29 -j SNAT --to 218.218.218.18
有的内网机器直接用外网ip出去,就不用进行转换了
[[i] 本帖最后由 小小磊 于 2008-2-20 21:50 编辑 [/i]]