LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Closed Thread
  Search this Thread
Old 12-18-2003, 04:22 PM   #1
rwyarbrough
Member
 
Registered: Oct 2003
Location: Mesquite, Texas
Distribution: Slackware_x64 15.0 and slackware-current
Posts: 33

Rep: Reputation: 2
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,

Robert

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

Rep: Reputation: 79
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.

http://www.linuxquestions.org/rules.php

The original is here:
http://www.linuxquestions.org/questi...hreadid=127030
 
  


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 08:35 PM
Simple Port Forwarding Firewall - not forwarding MadTurki Linux - Security 14 04-09-2006 01:08 PM
SSH dynamic port forwarding -- Firefox does not see such a PROXY geokat Linux - Networking 0 05-01-2005 08:03 AM
Samba, ssh, port forwarding, and dynamic IP mdkelly069 Linux - Networking 0 03-19-2004 11:47 AM
Port Forwarding With Dynamic PPP0 rwyarbrough Linux - Security 2 12-22-2003 09:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:25 AM.

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