nat的转换问题

由 chrisyan 在 08-11-2004 11:32 发表:

nat的转换问题

我用nat做SNAT,有一个奇怪的现象我用

iptables -t nat -A POSTROUTING -s 192.168.0.2 -j SNAT --to-source xxx.xxx.xxx.xxx

转换就是可以的,但是对整个网段进行转换就不行了,像这样:

iptables -t nat -A POSTROUTING -s 192.168.0.0/32 -j SNAT --to-source xxx.xxx.xxx.xxx

外网的地址就一个,大家有没有碰到过这中情况?是为什么呢?


由 icybird_r 在 08-11-2004 15:32 发表:


是32还是24???


由 icybird_r 在 08-11-2004 16:05 发表:


/32肯定是错误的,网络号的位置到了32,那你没主机号了:))

如果你的是c类IP地址,主机号是有24位,主机号8位


由 smile787 在 08-11-2004 16:52 发表:


应该是:

iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j SNAT --to-source xxx.xxx.xxx.xxx

试试


由 chrisyan 在 08-12-2004 14:36 发表:

多谢大家

我来试

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus