[SOLVED] Access WAN gateway router through VPN

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
dbarbour
DD-WRT Novice


Joined: 17 Sep 2019
Posts: 2

PostPosted: Tue Jul 13, 2021 23:30    Post subject: [SOLVED] Access WAN gateway router through VPN Reply with quote
Hi,

First, thanks to all for this awesome firmware and community!

I have a DD-WRT router R6700v3 running build v3.0-r47033 std (07/08/21). This router is behind my ISP router who uses CGNAT. To get access to my home LAN from the internet, I am using OpenVPN client on the router connected to openvpn.net in a full mesh configuration. This is working great after I disabled CVE-2019-14899 Mitigation. The router OpenVPN client connects to the server fine. To test, I connect via a cellular hotspot and run the OpenVPN client for windows to establish a tunnel to openvpn.net. Then, thanks to the full mesh thing, I can see all of the devices on my LAN subnet (192.0.0.0).

My only issue is that my ISP router that provides the WAN gateway is on a different subnet 192.168.12.0. When going through the tunnel, I can not access this subnet, so I can't login to the ISP router.

I have the OpenVPN client on the router set to NAT and the firewall on the tunnel is off.

I was hoping this description would trigger an idea in someone's mind.... Smile
Sponsor
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12917
Location: Netherlands

PostPosted: Wed Jul 14, 2021 6:24    Post subject: Re: Access WAN gateway router through VPN Reply with quote
dbarbour wrote:
Hi,

First, thanks to all for this awesome firmware and community!

I have a DD-WRT router R6700v3 running build v3.0-r47033 std (07/08/21). This router is behind my ISP router who uses CGNAT. To get access to my home LAN from the internet, I am using OpenVPN client on the router connected to openvpn.net in a full mesh configuration. This is working great after I disabled CVE-2019-14899 Mitigation. The router OpenVPN client connects to the server fine. To test, I connect via a cellular hotspot and run the OpenVPN client for windows to establish a tunnel to openvpn.net. Then, thanks to the full mesh thing, I can see all of the devices on my LAN subnet (192.0.0.0).

My only issue is that my ISP router that provides the WAN gateway is on a different subnet 192.168.12.0. When going through the tunnel, I can not access this subnet, so I can't login to the ISP router.

I have the OpenVPN client on the router set to NAT and the firewall on the tunnel is off.

I was hoping this description would trigger an idea in someone's mind.... Smile


Welcome to the forum always a pleasure to see someone new posting in the right forum and giving adequate information.
You probably read the forum guidelines: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087 Smile

Not sure what you mean with mesh configuration, OpenVPN documentation is a sticky in this forum, link also in my signature at the bottom.
You might have a look at the OpenVPN Server setup guide especially the paragraph about site-to-site setup.

In your particular case I think the problem is that the OpenVPN subnet is not NATted via the WAN of the client.

So as a quick test telnet/SSH to your router and add the following firewall rule:
Code:
iptables -t nat -I POSTROUTING -o $(get_wanface) -j MASQUERADE


This is a rather broad rule and normally you would use:
iptables -t nat -I POSTROUTING -s 10.8.0.0/24 -o $(get_wanface) -j MASQUERADE
replace 10.8.0.0 with your own OpenVPN subnet.

This should work for clients connected to your OpenVPN server which are using NAT on their VPN clients (as you are doing) if you contact from the OpenVPN server itself you also have to add the same rule but with the subnet of the server itself.

If it works add those rule(s) to Administration/Commands and Save as Firewall

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
dbarbour
DD-WRT Novice


Joined: 17 Sep 2019
Posts: 2

PostPosted: Wed Jul 14, 2021 13:09    Post subject: Reply with quote
Thanks egc!

This works:
Code:
iptables -t nat -I POSTROUTING -o $(get_wanface) -j MASQUERADE


When I try to other one with my VPN subnet, it didn't work.

I'm willing to use the working one, unless you think it's somehow a problem...
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12917
Location: Netherlands

PostPosted: Wed Jul 14, 2021 13:49    Post subject: Reply with quote
You are fine.

It is always a guessing game without knowing how you setup exactly what subnet(s) to choose that is why I started with the "broad" rule.

It is just my ocd to only do just what is necessary Smile

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum