我曾经将 Ubuntu 14.04 trusty 用于我们的 NAT 服务器(构建在 Google Cloud Platform 上),但最近我尝试使用 Ubuntu 16.04 xenial。
我的配置与我在 14.04 中所做的完全相同,但它不能用作 NAT 服务器。唯一的区别是操作系统和库的版本。
配置很简单,在谷歌的文档中有描述:
sudo sysctl -w net.ipv4.ip_forward=1和sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADEhttps://cloud.google.com/compute/docs/networking#natgateway
就是这样。在 Ubuntu 14.04 中,它有效。在 Ubuntu 16.04 中,它没有。
有人可以帮我正确配置它吗?我不知道我错过了什么,也不知道我应该检查什么。
提前致谢!
这是附加信息
在 Ubuntu 14.04 中
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"
$
$ sudo dpkg -l iptables
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name …Run Code Online (Sandbox Code Playgroud)