Как работают два соединения OpenVPN одновременно, одновременно?

Я использую OpenVPN в Ubuntu 20.04. У меня два VPN'а с нашими офисами в двух разных европейских странах. Я могу соединить оба в то же время, когда я узнал. Как это будет работать с точки зрения подключения? Как приложение «выбирает», какое соединение использовать, и выгодно ли открывать оба одновременно? Или может просто кажется, что они оба открыты там, где последнее соединение «перезаписывает» предыдущее?

0
задан 14 July 2020 в 15:20

1 ответ

You should be able to see what goes where using the route command. It will tell you what IP addresses get routed where. Here is a common example:

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    100    0        0 enp0s31f6
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 vpn0
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 enp0s31f6
172.16.0.0      0.0.0.0         255.240.0.0     U     0      0        0 vpn0
192.168.1.0     0.0.0.0         255.255.255.0   U     100    0        0 enp0s31f6
_gateway        0.0.0.0         255.255.255.255 UH    100    0        0 enp0s31f6
minanyconnfwf01 _gateway        255.255.255.255 UGH   100    0        0 enp0s31f6

In this case, 192.168.1.* always goes to the local network, 10.*.*.* and 172.16.*.* all go over the VPN. Everything else goes to the default gateway, which is the local network. You can also edit this yourself.

route delete -net default gw 0.0.0.0 dev vpn0

This will delete the default gateway that uses the VPN, restoring it to the local network, handy if you don't want all traffic going over the VPN.

route add -net 10.0.0.0 netmask 255.0.0.0 dev vpn0

This would send all 10.*.*.* traffic through vpn0

Also I would point out the order of your DNS servers will also influence this. I you are connected to VPNs in other countries and you go to a common website like Facebook, Google, Amazon, etc, they will give you a different IP address than you desire depending on your primary DNS server which may or may not be beneficial depending on the situation (very useful when shopping online while travelling abroad).

2
ответ дан 30 July 2020 в 22:08

Другие вопросы по тегам:

Похожие вопросы: