当前位置: 技术问答>linux和unix
新手求教,iptables无法识别--to-source
来源: 互联网 发布时间:2017-04-11
本文导语: 各位好,小弟最近在linux上开发时,遇到一个问题 我执行命令: iptables -t nat -A POSTROUTING -s 192.168.2.1/255.255.255.0 -o eth0 -j SNAT --to-source 192.168.3.4 执行后得到的结果是: iptables v1.4.12: unknown option "--to-source" 很诡...
各位好,小弟最近在linux上开发时,遇到一个问题
我执行命令:
iptables -t nat -A POSTROUTING -s 192.168.2.1/255.255.255.0 -o eth0 -j SNAT --to-source 192.168.3.4
执行后得到的结果是:
iptables v1.4.12: unknown option "--to-source"
很诡异啊,网上查了半天,也没明白这个问题是怎么出来的
有没有高手遇到过这种问题啊?帮忙解答下,非常感谢
我执行命令:
iptables -t nat -A POSTROUTING -s 192.168.2.1/255.255.255.0 -o eth0 -j SNAT --to-source 192.168.3.4
执行后得到的结果是:
iptables v1.4.12: unknown option "--to-source"
很诡异啊,网上查了半天,也没明白这个问题是怎么出来的
有没有高手遇到过这种问题啊?帮忙解答下,非常感谢
|
好久不来。。。这个版块越发冷清了。。。。
我试了一下你的语句,可以直常执行啊。而且我iptables版本比你低,是v1.4.0
#
#
# iptables -t nat -A POSTROUTING -s 192.168.2.1/255.255.255.0 -o eth0 -j SNAT --
to-source 192.168.3.4
#
#
#
# iptables -t nat -nL
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DNAT tcp -- 0.0.0.0/0 !192.168.1.1 tcp dpt:80 to:192.168.1.1:49153
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
SNAT all -- 192.168.2.0/24 0.0.0.0/0 to:192.168.3.4
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
#
我试了一下你的语句,可以直常执行啊。而且我iptables版本比你低,是v1.4.0
#
#
# iptables -t nat -A POSTROUTING -s 192.168.2.1/255.255.255.0 -o eth0 -j SNAT --
to-source 192.168.3.4
#
#
#
# iptables -t nat -nL
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DNAT tcp -- 0.0.0.0/0 !192.168.1.1 tcp dpt:80 to:192.168.1.1:49153
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
SNAT all -- 192.168.2.0/24 0.0.0.0/0 to:192.168.3.4
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
#