Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm pretty new to iptables. My server has two Ethernet cards (eth0, eth1) and an ADSL router that is in bridge mode connected to the eth0 which created ppp0 when dialed.

I'm trying to forward external port 80 to my local machine ( connected in eth1.

My Internet sharing is done by:

iptables -t nat -A POSTROUTING -s -o ppp0 -j MASQUERADE

(if there is a better way feel free to show me)

I am trying to use:

iptables -A FORWARD -i eth1 -p tcp --dport 80 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 80 -j DNAT --to-destination

but I don't know to which Ethernet interface I should be pointing it. Any ideas?

share|improve this question
up vote 0 down vote accepted

If you are accessing the Internet through ppp0, that's what you should use for -i in both commands. (Check the default route in ip -4 route to be sure.)

share|improve this answer
thank you, i currently use iptables -t nat -A PREROUTING -p tcp -i ppp0 --dport 80 -j DNAT --to-destination iptables -A FORWARD -i ppp0 -p tcp --dport 80 -j ACCEPT which works from the outside, but when i type my external ip into browser (on the same network) its still blocked, any way i could get around that ? – Stef Jul 1 '11 at 16:55

Check out It has very good and detailed explanation for what you're trying to do.

share|improve this answer
The site lots its domain in 2012. But it is is similar to what is here, and you can still find it via, or find similar info elsewhere. – nealmcb Sep 28 '12 at 5:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .