두 VPN 서버 사이에 고정 경로 추가

두 VPN 서버 사이에 고정 경로 추가

두 개의 VPN 서버(Wireguard 및 OpenVpn)가 있고 내 목표는 두 서버에 연결된 클라이언트가 두 서버 간에 통신할 수 있도록 하는 것입니다. 노트북 A가 Wireguard VPN 서버에 연결되어 있고 노트북 B가 OpenVpn에 연결되어 있다고 가정하면 A에서 B로 원격 데스크톱/핑 등을 할 수 있어야 합니다. A와 B가 모두 Wireguard 또는 OpenVPN 서버에 연결되어 있으면 가능합니다. 원격 데스크톱/ssh/ping 등을 위해 제대로 통신하려면

서버는 우분투 20개 서버이고 아무 문제 없이 서로 핑할 수 있습니다.

설정은 다음과 같습니다.

와이어가드:

Public IP: 1.2.3.4
Native IP: 10.0.0.235  
Wireguard Server IP: 10.36.135.1  
Wireguard Client IP: 10.36.135.2 onwards.

오픈VPN:

Public IP: 4.3.2.1
Native IP: 10.0.0.21  
OpenVPN Server IP: 10.187.86.1  
OpenVPN Client IP: 10.187.86.1 onwards. 

각 클라이언트는 서버의 공용 IP를 사용하여 VPN 서버에 연결하고 VPN 클라이언트 IP 주소를 얻습니다. 예를 들어,

노트북 A:

Wireguard VPN IP: 10.36.135.2

노트북 B:

OpenVPN IP: 10.187.86.2

문제 없이 각 클라이언트에서 두 서버 10.0.0.XXX를 모두 ping할 수 있습니다. 그러나 10.187.86.2에서 10.36.135.2로 ping을 보낼 수 없습니다.

아마도 각 서버에 경로를 추가해야 서로 통신할 수 있지만 어떤 경로를 추가해야 할지 확신할 수 없을 것 같습니다.

각 서버에 대한 몇 가지 정보를 캡처했습니다.

와이어가드

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: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 02:00:17:01:90:cd brd ff:ff:ff:ff:ff:ff
    altname enp0s3
    inet 10.0.0.235/24 brd 10.0.0.255 scope global ens3
       valid_lft forever preferred_lft forever
    inet6 fe80::17ff:fe01:90cd/64 scope link
       valid_lft forever preferred_lft forever
3: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000
    link/none
    inet 10.36.135.1/24 scope global wg0
       valid_lft forever preferred_lft forever


ubuntu@wireguard:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    0      0        0 ens3
default         _gateway        0.0.0.0         UG    100    0        0 ens3
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 ens3
10.36.135.0     0.0.0.0         255.255.255.0   U     0      0        0 wg0
link-local      0.0.0.0         255.255.0.0     U     0      0        0 ens3
link-local      0.0.0.0         255.255.0.0     U     100    0        0 ens3


ubuntu@wireguard:~$ sudo ip route show table all
default via 10.0.0.1 dev ens3
default via 10.0.0.1 dev ens3 proto dhcp src 10.0.0.235 metric 100
10.0.0.0/24 dev ens3 proto kernel scope link src 10.0.0.235
10.36.135.0/24 dev wg0 proto kernel scope link src 10.36.135.1
169.254.0.0/16 dev ens3 scope link
169.254.0.0/16 dev ens3 proto dhcp scope link src 10.0.0.235 metric 100
local 10.0.0.235 dev ens3 table local proto kernel scope host src 10.0.0.235
broadcast 10.0.0.255 dev ens3 table local proto kernel scope link src 10.0.0.235
local 10.36.135.1 dev wg0 table local proto kernel scope host src 10.36.135.1
broadcast 10.36.135.255 dev wg0 table local proto kernel scope link src 10.36.135.1
local 127.0.0.0/8 dev lo table local proto kernel scope host src 127.0.0.1
local 127.0.0.1 dev lo table local proto kernel scope host src 127.0.0.1
broadcast 127.255.255.255 dev lo table local proto kernel scope link src 127.0.0.1
::1 dev lo proto kernel metric 256 pref medium
fe80::/64 dev ens3 proto kernel metric 256 pref medium
local ::1 dev lo table local proto kernel metric 0 pref medium
local fe80::17ff:fe01:90cd dev ens3 table local proto kernel metric 0 pref medium
multicast ff00::/8 dev ens3 table local proto kernel metric 256 pref medium
multicast ff00::/8 dev wg0 table local proto kernel metric 256 pref medium
ubuntu@wireguard:~$

OpenVPN

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: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 02:00:17:02:d0:1b brd ff:ff:ff:ff:ff:ff
    altname enp0s3
    inet 10.0.0.21/24 brd 10.0.0.255 scope global ens3
       valid_lft forever preferred_lft forever
    inet6 fe80::17ff:fe02:d01b/64 scope link
       valid_lft forever preferred_lft forever
3: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 100
    link/none
    inet 10.187.86.1/24 brd 10.187.86.255 scope global tun0
       valid_lft forever preferred_lft forever
    inet6 fe80::5c26:311e:f863:db1e/64 scope link stable-privacy
       valid_lft forever preferred_lft forever


ubuntu@openvpn:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    0      0        0 ens3
default         _gateway        0.0.0.0         UG    100    0        0 ens3
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 ens3
10.187.86.0     0.0.0.0         255.255.255.0   U     0      0        0 tun0
link-local      0.0.0.0         255.255.0.0     U     0      0        0 ens3
link-local      0.0.0.0         255.255.0.0     U     100    0        0 ens3


ubuntu@openvpn:~$ sudo ip route show table all
default via 10.0.0.1 dev ens3
default via 10.0.0.1 dev ens3 proto dhcp src 10.0.0.21 metric 100
10.0.0.0/24 dev ens3 proto kernel scope link src 10.0.0.21
10.187.86.0/24 dev tun0 proto kernel scope link src 10.187.86.1
169.254.0.0/16 dev ens3 scope link
169.254.0.0/16 dev ens3 proto dhcp scope link src 10.0.0.21 metric 100
local 10.0.0.21 dev ens3 table local proto kernel scope host src 10.0.0.21
broadcast 10.0.0.255 dev ens3 table local proto kernel scope link src 10.0.0.21
local 10.187.86.1 dev tun0 table local proto kernel scope host src 10.187.86.1
broadcast 10.187.86.255 dev tun0 table local proto kernel scope link src 10.187.86.1
local 127.0.0.0/8 dev lo table local proto kernel scope host src 127.0.0.1
local 127.0.0.1 dev lo table local proto kernel scope host src 127.0.0.1
broadcast 127.255.255.255 dev lo table local proto kernel scope link src 127.0.0.1
::1 dev lo proto kernel metric 256 pref medium
fe80::/64 dev ens3 proto kernel metric 256 pref medium
fe80::/64 dev tun0 proto kernel metric 256 pref medium
local ::1 dev lo table local proto kernel metric 0 pref medium
local fe80::17ff:fe02:d01b dev ens3 table local proto kernel metric 0 pref medium
local fe80::5c26:311e:f863:db1e dev tun0 table local proto kernel metric 0 pref medium
multicast ff00::/8 dev ens3 table local proto kernel metric 256 pref medium
multicast ff00::/8 dev tun0 table local proto kernel metric 256 pref medium
ubuntu@openvpn:~$

관련 정보