端口重定向

来源:互联网 发布:淘宝号登不上去 编辑:程序博客网 时间:2024/05/18 03:12

端口重定向命令:iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8081


先将防火墙规则保存到/etc/iptables.up.rules文件中

# iptables-save > /etc/iptables.up.rules   #需要sudo su - root切换用户后执行,直接sudo cmd是不行的

Then modify the/etc/network/interfacesscript to apply the rulesautomatically (the bottom line is added)

然后修改脚本/etc/network/interfaces,使系统能自动应用这些规则(最后一行是我们手工添加的)。

auto eth0

iface eth0 inet dhcp

pre-up iptables-restore < /etc/iptables.up.rules


0 0
原创粉丝点击