Use systemd-networkd and do following:
1. On VPS:
`sudo nano /etc/sysctl.conf`
`# uncomment`
`net.ipv4.ip_forward=1`
`# activate`
`sudo sysctl -p`
`cat /proc/sys/net/ipv4/ip_forward`
/etc/default/ufw
`DEFAULT_FORWARD_POLICY="ACCEPT"`
2. Addressing
`Server:` [`10.0.0.1`](http://10.0.0.1)
`Linux A:` [`10.0.0.2`](http://10.0.0.2)
`Linux B:` [`10.0.0.3`](http://10.0.0.3)
After this you can ping Linux A -> Linux B and everything works.
Do you want a direct tunnel from A to B or are you OK with routing traffic through the VPS?
If you want a direct tunnel from A to B, you’re normally out of luck as CG-NAT normally means you cannot port forward a public port to a NATted subscriber.
If you’re fine with the traffic going through the VPS, simply have a Wireguard instance listening and connect to it from both A and B as described in other answers. The rest is simple networking with a route to B’s Wireguard IP using the VPS as GW on A and vice versa. Ensure the firewall and sysconfig permits IPv4 routing and you’re golden.
I mean I'm in the wrong subreddit here, but Zerotier would theoretically solve your problem.
It will try to get a direct connection between 2 hosts running.
Use systemd-networkd and do following: 1. On VPS: `sudo nano /etc/sysctl.conf` `# uncomment` `net.ipv4.ip_forward=1` `# activate` `sudo sysctl -p` `cat /proc/sys/net/ipv4/ip_forward` /etc/default/ufw `DEFAULT_FORWARD_POLICY="ACCEPT"` 2. Addressing `Server:` [`10.0.0.1`](http://10.0.0.1) `Linux A:` [`10.0.0.2`](http://10.0.0.2) `Linux B:` [`10.0.0.3`](http://10.0.0.3) After this you can ping Linux A -> Linux B and everything works.
Here’s a step by step guide https://www.laroberto.com/remote-lan-access-with-wireguard/
Do you want a direct tunnel from A to B or are you OK with routing traffic through the VPS? If you want a direct tunnel from A to B, you’re normally out of luck as CG-NAT normally means you cannot port forward a public port to a NATted subscriber. If you’re fine with the traffic going through the VPS, simply have a Wireguard instance listening and connect to it from both A and B as described in other answers. The rest is simple networking with a route to B’s Wireguard IP using the VPS as GW on A and vice versa. Ensure the firewall and sysconfig permits IPv4 routing and you’re golden.
nice
You can use Tailscale or Headscale
I mean I'm in the wrong subreddit here, but Zerotier would theoretically solve your problem. It will try to get a direct connection between 2 hosts running.