我正在尝试让我的 Ubuntu 服务器 (16.04) 在 VPN 后面运行。我订阅了 NordVPN,并按照他们的程序通过 OpenVPN 连接到 VPN - 它成功连接。
然后,我使用 Screen 继续在后台运行 OpenVPN,当我尝试检查服务器外部 IP 或 ping google.com 时,它会失败,就好像没有连接到 VPN 一样。我尝试过多个 VPN 服务器。我究竟做错了什么?
编辑: 如果配置
enp2s0 Link encap:Ethernet HWaddr a0:b3:cc:df:31:91
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a2b3:ccff:fedf:3191/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2190765 errors:0 dropped:16 overruns:0 frame:0
TX packets:2347458 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2100301066 (2.1 GB) TX bytes:1710956391 (1.7 GB)
Interrupt:18
> 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:132225 errors:0 dropped:0 overruns:0 frame:0
TX packets:132225 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:37777958 (37.7 MB) TX bytes:37777958 (37.7 MB)
> tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.7.7.242 P-t-P:10.7.7.241 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:144 errors:0 dropped:0 overruns:0 frame:0
TX packets:598 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:21997 (21.9 KB) TX bytes:62173 (62.1 KB)
尝试 ping google.com - 未能得到响应。
使用 wget get 下载文件:
wget:无法解析主机地址
ping 8.8.8.8:
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=48 time=404 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=48 time=370 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=48 time=369 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=48 time=369 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=48 time=404 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=48 time=369 ms
^C
--- 8.8.8.8 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5007ms
rtt min/avg/max/mdev = 369.680/381.456/404.838/16.344 ms
编辑2: 挖一个 google.com @8.8.8.8:
; <<>> DiG 9.10.3-P4-Ubuntu <<>> a google.com @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15859
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 203 IN A 216.58.216.238
;; Query time: 388 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Wed Aug 31 15:00:37 AEST 2016
;; MSG SIZE rcvd: 55
答案1
要使一切正常运行,您所需要做的就是正确设置本地 DNS 设置。
最简单的方法是备份后放入(nameserver 8.8.8.8
)。/etc/resolv.conf
mv /etc/resolv.conf /etc/resolv.conf.bak