为什么 OpenVPN 通过 CentOS 7 与 OVH 失去连接?

为什么 OpenVPN 通过 CentOS 7 与 OVH 失去连接?

通过虚拟机上的 CentOS 7 连接到 VPN 几秒钟后,我失去了连接,日志中没有错误。这似乎只发生在 CentOS 7/8 上。 OVH 文档(https://docs.ovh.com/gb/en/dedicated/network-bridging/)涵盖添加

51.195.234.254 - 255.255.255.255 eth0
51.195.234.0 - 255.255.255.0 eth0
default 51.195.234.254

或者

51.195.234.254 dev eth0
default via 51.195.234.254

到 /etc/sysconfig/network-scripts/route-eth0 但这没有帮助。

Debian 10(工作中):

ip 一个

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 02:00:00:ff:3b:ea brd ff:ff:ff:ff:ff:ff
    inet 145.239.xxx.xxx/32 brd 145.239.xxx.xxx scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::ff:feff:3bea/64 scope link 
       valid_lft forever preferred_lft forever

知识产权

default via 51.195.234.254 dev eth0 
51.195.234.254 dev eth0 scope link

连接VPN后:ip r

0.0.0.0/1 via 10.8.0.9 dev tun0
default via 51.195.234.254 dev eth0
10.8.0.0/24 via 10.8.0.9 dev tun0
10.8.0.9 dev tun0 proto kernel scope link src 10.8.0.10
VPNIP via 51.195.234.254 dev eth0
51.195.234.254 dev eth0 scope link
128.0.0.0/1 via 10.8.0.9 dev tun0

CentOS 7:

ip 一个

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 02:00:00:ff:3b:ea brd ff:ff:ff:ff:ff:ff
    inet 145.239.xxx.xxx/32 brd 145.239.xxx.xxx scope global dynamic eth0
       valid_lft 21599969sec preferred_lft 21599969sec
    inet6 fe80::ff:feff:3bea/64 scope link 
       valid_lft forever preferred_lft forever

知识产权

default via 51.195.234.254 dev eth0 
51.195.234.254 dev eth0 scope link

连接VPN后:ip r

0.0.0.0/1 via 10.8.0.9 dev tun0 
default via 51.195.234.254 dev eth0 
10.8.0.0/24 via 10.8.0.9 dev tun0 
10.8.0.9 dev tun0 proto kernel scope link src 10.8.0.10 
VPNIP via 51.195.234.254 dev eth0 
51.195.234.254 dev eth0 scope link 
128.0.0.0/1 via 10.8.0.9 dev tun0

我也尝试过添加VPN的网关

ip route add 5.45.126.254 dev eth0

知识产权

0.0.0.0/1 via 10.8.0.17 dev tun0 
default via 51.195.234.254 dev eth0 
5.45.126.254 dev eth0 scope link 
10.8.0.0/24 via 10.8.0.17 dev tun0 
10.8.0.17 dev tun0 proto kernel scope link src 10.8.0.18 
VPNIP via 51.195.234.254 dev eth0 
51.195.234.254 dev eth0 scope link 
128.0.0.0/1 via 10.8.0.17 dev tun0

我是否必须进行修改VPNIP via 51.195.234.254 dev eth0才能将其路由通过VPNIP via 5.45.126.254 dev eth0?如果是这样我怎样才能实现这一目标。

相关内容