【发布时间】:2016-11-08 21:26:07
【问题描述】:
我尝试设置我的服务器,以便将端口 80 的流量重定向到端口 8080,但它不起作用。 (如果我 telnet 到端口 80,我会收到“连接被拒绝”错误,并且使用 firefox 会出现“无法连接”。)
我已经能够使用 iptables 让它工作,但更喜欢使用 nftables。有人知道问题可能是什么吗? (如果相关,服务器在 linode.com 上运行,内核由 linode 提供。)
我在 /etc/nftables.conf 中有以下内容:
#!/usr/sbin/nft -f
flush ruleset
table ip fw {
chain in {
type filter hook input priority 0;
# accept any localhost traffic
iif lo accept
# accept traffic originated from us
ct state established,related accept
# accept ssh, alternative http
tcp dport { ssh, http, http-alt } ct state new counter accept
counter drop
}
}
table ip nat {
chain prerouting {
type nat hook prerouting priority 0;
tcp dport http redirect to http-alt
}
chain postrouting {
type nat hook postrouting priority 0;
}
}
【问题讨论】:
标签: linux redirect iptables nat netfilter