我目前正在使用AWS设置一个OpenVPN访问服务器。 除了当我尝试使用networkingGUI将VPN连接添加到Ubuntu时,大部分情况下我都能正常工作。
这是我的routes -n输出,当我没有连接到VPN,
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 wlan0 192.168.0.0 0.0.0.0 255.255.255.0 U 9 0 0 wlan0
VPNconfiguration为不路由互联网stream量。 所以当我通过命令行使用sudo openvpn client.ovpn一切都按预期工作,我的routes -n如下所示,
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 wlan0 54.173.232.46 192.168.0.1 255.255.255.255 UGH 0 0 0 wlan0 172.16.0.0 172.16.224.129 255.255.254.0 UG 101 0 0 tun0 172.16.224.0 172.16.224.129 255.255.255.0 UG 101 0 0 tun0 172.16.224.128 0.0.0.0 255.255.255.128 U 0 0 0 tun0 192.168.0.0 0.0.0.0 255.255.255.0 U 9 0 0 wlan0
记下默认路由0.0.0.0命中我的路由器192.168.0.1 。 如果我尝试击中Google,那么所有工作都按预期工作。
我不想每次都通过命令行连接到VPN,因此我在创buildVPN时安装了network-manager-openvpn-gnome并导入了client.ovpn 。
现在,当我通过工具栏中的networking下拉菜单进行连接时,VPN连接正常,但无法访问Google或任何其他网站。 我可以访问我的AWS VPC中的服务器,但就是这样。
有趣的是我的routes -n现在看起来像下面,
Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 172.16.224.129 0.0.0.0 UG 0 0 0 tun0 54.173.232.46 192.168.0.1 255.255.255.255 UGH 0 0 0 wlan0 172.16.0.0 172.16.224.129 255.255.254.0 UG 101 0 0 tun0 172.16.224.0 172.16.224.129 255.255.255.0 UG 101 0 0 tun0 172.16.224.128 0.0.0.0 255.255.255.128 U 0 0 0 tun0 192.168.0.0 0.0.0.0 255.255.255.0 U 9 0 0 wlan0
请注意,默认路由不再指向我的路由器。
除非我失明,否则我无法在networkingGUI中find一个可以解决这个问题的选项。
有任何想法吗?
谢谢
原来我是失明的。
编辑VPN连接 – > IPv4设置 – >单击“路由”,最后选中“仅使用此连接用于其networking上的资源”。