【问题标题】:IPTABLES error "iptables: No chain/target/match by that name"IPTABLES 错误“iptables:没有该名称的链/目标/匹配”
【发布时间】:2014-08-12 04:06:34
【问题描述】:
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 8080

当我尝试运行这个命令时,我遇到了错误:

iptables: No chain/target/match by that name

我的 iptables 版本是 v1.4.14。 在 linux 内核 3.8.11 上运行 debain。

iptables -L 输出:

Chain INPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     icmp --  anywhere             anywhere            
ACCEPT     udp  --  anywhere             224.0.0.251          udp dpt:mdns
NFQUEUE    udp  --  anywhere             anywhere             NFQUEUE num 10000

Chain FORWARD (policy DROP)
target     prot opt source               destination         

Chain OUTPUT (policy DROP)
target     prot opt source               destination         
NFQUEUE    udp  --  anywhere             239.255.255.250      udp dpt:1900 NFQUEUE num 10001
ACCEPT     all  --  anywhere             anywhere             ctstate NEW,RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere

iptables -t nat -L 输出:

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

我不知道问题出在哪里,我看了看,没有其他人在这个设置中遇到过这个错误。

【问题讨论】:

  • iptables -t nat -L 的输出是什么?
  • 更改了 OP 以添加该输出。

标签: debian iptables


【解决方案1】:

该错误意味着您缺少内核中的 iptables REDIRECT 模块。

也许你自己编译了内核?然后你需要启用/设置选项

CONFIG_IP_NF_TARGET_REDIRECT=m

在您的内核配置中,然后

make modules
make modules_install
depmod -ae 

【讨论】:

  • 我有这个问题,但我只是使用 centos 8 内核...什么?我有wireguard...也许它的内核模块与它有关
  • NVM,我错过了-t nat,因为我从 iptables-save 复制了命令。 ?
猜你喜欢
  • 1970-01-01
  • 2015-10-18
  • 2019-05-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-08-14
  • 2016-11-27
  • 2016-12-08
相关资源
最近更新 更多