启动 VPN 连接后,我无法访问互联网。我可以 ping 通 Google,但无法进行其他操作。VPN 连接前:
# ip route show
default via 10.0.2.2 dev enp0s3 proto static metric 100
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15 metric 100
169.254.0.0/16 dev enp0s3 scope link metric 1000
使用 VPN 连接:
default dev vpn0 proto static scope link metric 50
default via 10.0.2.2 dev enp0s3 proto static metric 100
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15 metric 100
10.129.224.0/20 dev vpn0 proto kernel scope link src 10.129.233.224 metric 50
159.222.160.20 via 10.0.2.2 dev enp0s3 proto static metric 100
169.254.0.0/16 dev enp0s3 scope link metric 1000
# ifconfig
enp0s3 Link encap:Ethernet HWaddr 08:00:27:dc:a3:f2
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::352c:aacf:d49d:9ead/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:158315 errors:0 dropped:0 overruns:0 frame:0
TX packets:76106 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:130972073 (130.9 MB) TX bytes:6823278 (6.8 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:1332 errors:0 dropped:0 overruns:0 frame:0
TX packets:1332 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:149950 (149.9 KB) TX bytes:149950 (149.9 KB)
vpn0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.129.233.224 P-t-P:10.129.233.224 Mask:255.255.240.0
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1406 Metric:1
RX packets:38 errors:0 dropped:0 overruns:0 frame:0
TX packets:2140 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:12836 (12.8 KB) TX bytes:152275 (152.2 KB)
如何在 VPN 连接期间访问互联网?谢谢。
答案1
您有两个选择:
1.删除指向VPN服务器的默认网关,并添加用于访问VPN服务器后面子网的静态路由。
2.确保VPN客户端的流量可以正确NAT到Internet。