[SOLVED] Port forward on router IP to local LAN host:port?

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


Joined: 12 Sep 2008
Posts: 25

PostPosted: Wed Dec 16, 2020 0:28    Post subject: [SOLVED] Port forward on router IP to local LAN host:port? Reply with quote
Due to a full tunnel VPN setup required for work, I lose access to local network web resources when I'm working from home. I have an HTTP proxy running on a host in my network that I'd like to use to connect to these local resources.

When the full VPN is up, I can still get to web interface listening on the router IP address, but not other local web services hosted on other IP addresses.

I've tried a few IPtables configuration but haven't been able to sort out how to accept connections to the router IP on 192.168.1.1:8888 and forward the packets to & responses from to other-ip-on-local-lan:8888.

Has anybody gotten something like this to work?

Any helpful pointers would be appreciated.

ANSWER:

Add the following to the "Administration"/"Commands"/"Firewall" script and click "Save Firewall" button:

# Turn on Squid proxy forward from LAN subnet to other-ip-on-local-lan:8888 (e.g. 1.2.3.4:8888)
iptables -t nat -A PREROUTING -s `nvram get lan_ipaddr`/`nvram get lan_netmask` -i br0 -p tcp --dport 8888 -j DNAT --to-destination other-ip-on-local-lan:8888


Last edited by foobarfoo on Tue Mar 22, 2022 20:42; edited 1 time in total
Sponsor
Wildlion
DD-WRT Guru


Joined: 24 May 2016
Posts: 1269

PostPosted: Fri Dec 18, 2020 0:05    Post subject: Reply with quote
where is your vpn setup? Is it on the router or is it on the machine?

Lots of companies, add a route to their machines that puts all traffic through the vpn tunnel. If you have access to change that, just add your own route.

if it is on the router, then it should not make a difference, since it would be your router's WAN traffic that is routed
foobarfoo
DD-WRT Novice


Joined: 12 Sep 2008
Posts: 25

PostPosted: Fri Dec 18, 2020 0:13    Post subject: Reply with quote
VPN is a software VPN on a computer connected to the router via GigE or WiFi.

I'm unable to change the routes in the VPN client unfortunately.

They leave connectivity to the default route open on all ports, so my thought was that I could port forward from the router LAN IP to the proxy host IP:port combo elsewhere on the LAN.
Wildlion
DD-WRT Guru


Joined: 24 May 2016
Posts: 1269

PostPosted: Fri Dec 18, 2020 20:44    Post subject: Reply with quote
if your router is doing NAT that should not matter, if you are on public area, yest that is a problem. You could report it to your companies IT department because they should know and should want to fix it.

But you have to have the original still active/available, because that is how the traffic is actually getting to the computer it is, the vpn is inside of the normal traffic.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum 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