Roy*_*ley 12 iptables port-forwarding
我正在尝试在我的 Ubuntu 12.04 LTS 服务器上配置 iptables 以将端口 443 转发到 8443。
但是当我运行这个命令时:
sudo iptables -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
iptables: No chain/target/match by that name.
Run Code Online (Sandbox Code Playgroud)
我的 iptables 当前配置:
$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:https
DROP tcp -- anywhere anywhere tcp dpt:http
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Run Code Online (Sandbox Code Playgroud)
我错过了什么或做错了什么?
hee*_*ayl 18
因为PREROUTING
链属于NAT
表,而不是FILTER
表。如果您没有通过-t
选项明确提及任何表,则FILTER
假定。
因此,您需要使用以下内容提及表类型-t nat
:
sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443
Run Code Online (Sandbox Code Playgroud)
需要注意的是,MANGLE
并RAW
表也有PREROUTING
链条但你只重定向端口,你可能寻找的NAT
表格。
归档时间: |
|
查看次数: |
56341 次 |
最近记录: |