I have two VPN servers (Wireguard and OpenVpn) and my goal is that the clients connected to both the servers should be able to communicate between them. Say laptop A is connected to wireguard VPN server and laptop B is connected to OpenVpn, I should be able to remote desktop/ping etc. from A to B. If both A & B are connected to either wireguard or openvpn server, they are able to communicate properly for remote desktop/ssh/ping etc.
The servers are ubuntu 20 servers and I am able to ping each other without any problem.
The setup looks like this:
Wireguard:
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.
OpenVPN:
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.
Each client connects to VPN server using server's public IP and gets VPN client IP address. For example,
Laptop A:
Wireguard VPN IP: 10.36.135.2
Laptop B:
OpenVPN IP: 10.187.86.2
I can ping both the servers 10.0.0.XXX from each client without a problem. However, I cannot ping 10.36.135.2 from 10.187.86.2.
I think I probably need to add a route on each server to that they can talk to each other but not sure what route to add.
I have captured some info on each server.
Wireguard
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:~$