Properly do ip specific routing on sbc gateway/router? Not forwarding responce

gatewayrouterUbuntuvpn

My network uses 192.168.100.0/24

The routers gateway is 192.168.100.1

I have a windows pc at 192.168.100.15

I have a fresh install of ubuntu 20.04 on a SBC with ip 192.168.100.207 lan0

On this sbc I configured a vpn client on 192.168.1.0/24 vpn_mom

DHCP has assigned ip 192.168.1.166 to the vpn adapter

I am able to ping other machines on that remote subnet without issue including 192.168.1.1

I also set up a route for chris.com (34.174.225.83) as follows:

ip route add 34.174.225.83 via 192.168.1.1 dev vpn_mom

Making route look like :

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    100    0        0 lan0
83.225.174.34.b 192.168.1.1     255.255.255.255 UGH   0      0        0 vpn_mom
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 lan0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 vpn_mom
192.168.100.0   0.0.0.0         255.255.255.0   U     100    0        0 lan0

If I do a traceroute to chris.com from the sbc it works exactly as I want with out and in bound traffic from the vpn network while all other internet traffic continues working from lan0 as expected.

Then I set up forwarding with this command :

sysctl net.ipv4.ip_forward=1

Then I change the gateway on the windows machine to 192.168.100.207 (sbc)
Testing on the windows machines shows all internet traffic working fine except chris.com

Examining tcpdump show the requests being sent though the vpn on the sbc but the response is not being sent back to the windows machine (192.168.100.15)

I have been searching the internet for a couple of weeks with out any luck.

Best Answer

Try adding a NAT on the VPN interface, the issue could be the destination serve/ the network from the other VPN side is not ware of the 192.168.100.0/24 try adding a nat on the VPN Interface.

iptables -t nat -A POSTROUTING -s 192.168.100.0/24 -o vpn_mom -j MASQUERADE