我现在正面临着iptables的奇怪问题。简单地说,我想将交通从端口514重定向到端口5140。我使用这个IPTables命令来实现它:
iptables -t nat -A PREROUTING -p tcp --dport 514 -j REDIRECT --to-port 5140但我还是发现没有链子的错误
iptables: No chain/target/match by that name.nat表中有明确的预处理链,这是iptables -t nat -nL
root@VPS-LOGGER-TMP:~# iptables -t nat -nL
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination 我使用Debian并加载了所有需要的模块:
root@VPS-LOGGER-TMP:~# lsmod |grep nat
iptable_nat 12928 0
nf_nat 18242 1 iptable_nat
nf_conntrack_ipv4 14078 4 nf_nat,iptable_nat
nf_conntrack 52720 4 xt_state,nf_conntrack_ipv4,nf_nat,iptable_nat
ip_tables 22042 2 iptable_filter,iptable_nat
x_tables 19118 9 ip_tables,iptable_filter,xt_multiport,ip6_tables,ip6table_filter,xt_state,xt_tcpudp,ipt_REJECT,iptable_nat你能告诉我我做错了什么吗?据我所知,这应该是完美的。非常感谢。
发布于 2016-03-04 09:43:45
你需要
CONFIG_IP_NF_TARGET_REDIRECT在内核配置中设置为y或m,以便使用-j重定向。
这个模块将被称为xt_REDIRECT,这在您的机器上似乎是缺失的。
https://serverfault.com/questions/761526
复制相似问题