ubuntu 上配置端口转发

Enable IP Forwarding:

sysctl net.ipv4.ip_forward=1
等同于
编辑/etc/sysctl.conf文件,将net.ipv4.ip_forward=1前面的#注释去掉,保存文件,然后执行sudo sysctl -p使其生效

Add your forwarding rule (use n.n.n.n:port):

iptables -t nat -A PREROUTING -p tcp -d 10.0.0.132 --dport 29418 -j DNAT --to-destination 10.0.0.133:29418

Ask IPtables to Masquerade:

iptables -t nat -A POSTROUTING -j MASQUERADE

And that's it! It worked for me in any case :)

上一篇:4_叠加三角形


下一篇:深度学习入门之4--误差反向传播法