我搜索了所有我能搜索到的资料,但一无所获。
我会尽可能简化我的问题。
openvpn连接前的路由:
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 178.xxx.xxx.xxx 0.0.0.0 UG 0 0 0 enp5s0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
VPN连接后的路由:
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.8.0.1 128.0.0.0 UG 0 0 0 tun0
0.0.0.0 178.xxx.xxx.xxx 0.0.0.0 UG 0 0 0 enp5s0
10.8.0.0 0.0.0.0 255.255.255.0 U 0 0 0 tun0
128.0.0.0 10.8.0.1 128.0.0.0 UG 0 0 0 tun0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
问题:
连接到 VPN 后 -> 我的网络完全“中断”。
我无法 ping 通 openvpn 服务器 ( 10.8.0.1 ),也无法 ping 通 google dns ( 8.8.8.8 ),也无法 ping 通我的互联网网关 ( 178.xxx.xxx.xxx )。
当我停止 VPN 客户端时,一切又恢复正常。
您知道如何解决该问题吗?
谢谢。
ip route show(VPN 连接之前=网络工作正常):
ip route show
default via 178.xxx.xxx.xxx dev enp5s0 proto static onlink
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
ip route show(VPN 连接后=网络根本不工作):
0.0.0.0/1 via 10.8.0.1 dev tun0
default via 178.xxx.xxx.xxx dev enp5s0 proto static onlink
10.8.0.0/24 dev tun0 proto kernel scope link src 10.8.0.2
128.0.0.0/1 via 10.8.0.1 dev tun0
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
ifconfig enp5s0(带互联网访问接口)
enp5s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 178.xxx.xxx.xxx netmask 255.255.255.255 broadcast 0.0.0.0
inet6 2a01:xxx:xxx:xxx::2 prefixlen 64 scopeid 0x0<global>
inet6 fe80::xxx:xxx:xxx:c860 prefixlen 64 scopeid 0x20<link>
ether a0:36:bc:ca:c8:60 txqueuelen 1000 (Ethernet)
RX packets 110506 bytes 18354128 (18.3 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 117994 bytes 17466604 (17.4 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0x81c00000-81cfffff
VPN 客户端日志(已建立连接,但由于没有网络而断开):
May 30 16:54:35 client openvpn3-service-logger[20691]: {tag:5238658794065795403} Adding IP Adress 10.8.0.2/24 gw 10.8.0.1 ipv6: no
May 30 16:54:35 client openvpn3-service-logger[20691]: {tag:5238658794065795403} Setting remote IP address to 195.xxx.xxx.xxx ipv6: no
May 30 16:54:35 client openvpn3-service-logger[20691]: {tag:17752863769272376516} Connected: 195.xxx.xxx.xxx:1194 (195.xxx.xxx.xxx) via /TCPv4 on tun/10.8.0.2/ gw=[10.8.0.1/]
VPN 服务器日志(相同情况):
May 30 16:54:34 server ovpn-server[62795]: 178.xxx.xxx.xxx:41434 [client] Peer Connection Initiated with [AF_INET]178.xxx.xxx.xxx:41434
May 30 16:54:34 server ovpn-server[62795]: client/178.xxx.xxx.xxx:41434 MULTI_sva: pool returned IPv4=10.8.0.2, IPv6=(Not enabled)
May 30 16:54:34 server ovpn-server[62795]: client/178.xxx.xxx.xxx:41434 MULTI: Learn: 10.8.0.2 -> client/178.xxx.xxx.xxx:41434
May 30 16:54:34 server ovpn-server[62795]: client/178.xxx.xxx.xxx:41434 MULTI: primary virtual IP for client/178.xxx.xxx.xxx:41434: 10.8.0.2
...
May 30 16:54:48 server ovpn-server[62795]: client/178.xxx.xxx.xxx:41434 SIGUSR1[soft,connection-reset] received, client-instance restarting
/etc/openvpn/server.conf:
port 1194
proto tcp
dev tun
user nobody
group nogroup
persist-key
persist-tun
keepalive 10 120
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
push "redirect-gateway def1"
dh none
ecdh-curve prime256v1
tls-crypt tls-crypt.key
crl-verify crl.pem
ca ca.crt
cert server_au1Yf0HuxvBTSYQS.crt
key server_au1Yf0HuxvBTSYQS.key
auth SHA256
cipher AES-128-GCM
ncp-ciphers AES-128-GCM
tls-server
tls-version-min 1.2
tls-cipher TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256
client-config-dir /etc/openvpn/ccd
status /var/log/openvpn/status.log
verb 3
.ovpn:
client
proto tcp-client
remote 195.xxx.xxx.xxx
dev tun
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
verify-x509-name server_au1Yf0HuxvBTSYQS name
auth SHA256
auth-nocache
cipher AES-128-GCM
tls-client
tls-version-min 1.2
tls-cipher TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256
#ignore-unknown-option block-outside-dns
setenv opt block-outside-dns # Prevent Windows 10 DNS leak
verb 3