ubuntu 16.04 配置NAT失败 无法转发

来源:互联网 发布:杭州网络推广红四 编辑:程序博客网 时间:2024/06/05 23:00

配置iptables

sudo iptables -t nat -A POSTROUTING -s "192.168.0.1/24" -o eth0 -j MASQUERADE

打开转发功能

取消/etc/resolv.conf里面net.ipv4.ip_forward = 1的注释
使命令生效:
sudo sysctl -p

关键:关闭Ubuntu 16.04 的防火墙

sudo ufw disable

参考资料

https://help.ubuntu.com/lts/serverguide/firewall.html

0 0
原创粉丝点击