Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


Closed Thread
  Search this Thread
Old 12-18-2003, 03:22 PM   #1
LQ Newbie
Registered: Oct 2003
Location: Mesquite, Texas
Distribution: Slackware
Posts: 11

Rep: Reputation: 1
Port Forwarding With Dynamic PPP0

Ok, after 12 hours, Im in need of some advise

I have a very simple iptable configuration that is working for me with one minor issue -- First, some background:

Linux fire/wall router Linux 2.4.20
iptables 1.2.7a

ETH0 - External - X.X.X.251 - using PPPOE (ADSL)
ETH1 - Internal - X.X.X.254
$PPPOEIP = the actual IP address as dynamically provided after ADSL-START

I have an email and web server on X.X.X.1

All browsing and masquerading for the network is working fine.

I can IP port forward 80 all day long with the following entries

iptables -t nat -A PREROUTING --dst $PPPOEIP -p tcp --dport 80 -j DNAT --to-destination X.X.X.1
iptables -t nat -A POSTROUTING -p tcp --dst X.X.X.1 --dport 80 -j SNAT --to-source $PPPOEIP

This works great. ( I tried many different variations and this is the only one I could get to work)

Now the issue... since I know the PPPOE address from ifconfig I can use the actual IP address, what I want to do is use either --in-interface ppp0 or -i ppp0 instead of -dst $PPPOEIP as that IP ($PPPOEIP) is dynamic and if the ADSL connection reboots, that IP will no longer be valid and my port forwarding will be broke until I can change the table.

I tried the following to no avail
iptables -t nat -A PREROUTING --dst X.X.X.251 -p tcp --dport 80 -j DNAT --to-destination X.X.X.1

iptables -t nat -A PREROUTING --dst X.X.X.254 -p tcp --dport 80 -j DNAT --to-destination X.X.X.1

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination X.X.X.1

iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80 -j DNAT --to-destination X.X.X.1

iptables -t nat -A PREROUTING --in-interface ppp0 -p tcp --dport80 -j DNAT --to-destination X.X.X.1

any ideas??? (worst case, could write a script to grab the ppp0 ip address after adsl-start and pass it as a variable to the iptables script?)

Thanks in advance,


Last edited by rwyarbrough; 12-18-2003 at 03:50 PM.
Old 12-19-2003, 02:44 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

The original is here:

Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 07:35 PM
Simple Port Forwarding Firewall - not forwarding MadTurki Linux - Security 14 04-09-2006 12:08 PM
SSH dynamic port forwarding -- Firefox does not see such a PROXY geokat Linux - Networking 0 05-01-2005 07:03 AM
Samba, ssh, port forwarding, and dynamic IP mdkelly069 Linux - Networking 0 03-19-2004 10:47 AM
Port Forwarding With Dynamic PPP0 rwyarbrough Linux - Security 2 12-22-2003 08:53 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:01 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration