Score:0

OpenVPN Allowing Cross-NAT traffic over two NICs

id flag

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
Michael Hampton avatar
cz flag
Just set up normal routes. NAT or iptables is not appropriate here.
Tylor Pater avatar
id flag
I've tried just adding `push "route 192.168.177.0 255.255.255.0"` to server.conf but that doesn't seem to work (if that is what you meant)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.