Jump to content
Not connected, Your IP: 18.117.196.217
Sign in to follow this  
nolehce

How to Port Forward When Mapped To Different Local Port

Recommended Posts

I connect to AirVPN via Tomato Router. I have set iptables as per the how-to at this link:

https://airvpn.org/topic/9270-how-to-forward-ports-in-dd-wrt-tomato-with-iptables/?hl=%2Biptables+%2Bprerouting+%2Btun11+--dpor

 

It works fine if I am forwarding the same external to internal port. But what about when I want to re-map to a different internal port, do I put the internal port into iptables, or the external port, or both?

 

And how about for software firewalls further downstream on computers on my LAN... do I set the firewalls to allow the internal port, external port or both?

 

Thanks!!

Share this post


Link to post

same question..

on the airvpn web site i forwarded a port say 45000 to local port 9091

does that mean in iptables I use port 9091 as per this example?

 

iptables -I FORWARD -i tun1 -p udp -d x.x.x.x --dport 9091 -j ACCEPT
iptables -I FORWARD -i tun1 -p tcp -d x.x.x.x --dport 9091 -j ACCEPT
iptables -t nat -I PREROUTING -i tun1 -p tcp --dport 9091 -j DNAT --to-destination x.x.x.x
iptables -t nat -I PREROUTING -i tun1 -p udp --dport 9091 -j DNAT --to-destination x.x.x.x
 
x= my local server ip. 

Share this post


Link to post

 

same question..

on the airvpn web site i forwarded a port say 45000 to local port 9091

does that mean in iptables I use port 9091 as per this example?

 

iptables -I FORWARD -i tun1 -p udp -d x.x.x.x --dport 9091 -j ACCEPT
iptables -I FORWARD -i tun1 -p tcp -d x.x.x.x --dport 9091 -j ACCEPT
iptables -t nat -I PREROUTING -i tun1 -p tcp --dport 9091 -j DNAT --to-destination x.x.x.x
iptables -t nat -I PREROUTING -i tun1 -p udp --dport 9091 -j DNAT --to-destination x.x.x.x
 
x= my local server ip. 

 

More like

 

iptables -I FORWARD -i tun1 -p udp -d x.x.x.x --dport 45000 -j ACCEPT
iptables -I FORWARD -i tun1 -p tcp -d x.x.x.x --dport 45000 -j ACCEPT
iptables -t nat -I PREROUTING -i tun1 -p tcp --dport 45000 -j DNAT --to-destination x.x.x.x:9091
iptables -t nat -I PREROUTING -i tun1 -p udp --dport 45000 -j DNAT --to-destination x.x.x.x:9091

Occasional moderator, sometimes BOFH. Opinions are my own, except when my wife disagrees.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Security Check
    Play CAPTCHA Audio
    Refresh Image
Sign in to follow this  

×
×
  • Create New...