I'm running OpenVPN on Ubuntu 20.04, and I'm trying to allow users to access servers that are on a different subnet. Here is a diagram of what the network looks like:
Diagram of network
So, eth1 is connected to DHCP and the wider internet, and eth0 is connected to a private network with the servers on them. So the VPN is running on eth1 (192.168.1.0/24), but I need to be able to access the machinery on eth0 (192.168.177.0/24) when connected to the VPN.
I've tried adding temporary iptables rules, but I'm not sure if they were working because they are on two NICs. Everything I've been able to find on Google is all about when they're on the same NIC.
Edit: I've also added
push "route 192.168.177.0 255.255.255.0"
to my server.conf
for OpenVPN but that does not seem to have worked.
Edit 2: I've also tried the following iptables rules:
sudo iptables -A INPUT -i tun0 -j ACCEPT
sudo iptables -A INPUT -i eth0 -j ACCEPT
sudo iptables -A INPUT -i eth1 -j ACCEPT
sudo iptables -A FORWARD -i eth0 -j ACCEPT
sudo iptables -A FORWARD -i eth1 -j ACCEPT
sudo iptables -A FORWARD -i tun0 -j ACCEPT
as well as:
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
sudo iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
I can see my route listed if I run route print
on the Windows client:
192.168.177.0 255.255.255.0 10.8.0.1 10.8.0.2 259