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.


  Search this Thread
Old 02-10-2002, 06:57 PM   #1
LQ Newbie
Registered: Feb 2002
Posts: 3

Rep: Reputation: 0
Angry iptables and port forwarding

I'm in need of help.

I have a firewall setup.
The internal lan can access the web.

I tried to setup Portfordwarding to an internal web server on port 80 ip

here is the script I'm using.
I replaced my EXTIP with X


PATH=/sbin:$PATH; export PATH

iptables -F
iptables -F -t nat
iptables -X


iptables -t nat -A PREROUTING -p tcp --destination 440 -j ACCEPT

iptables -t nat -A PREROUTING -p TCP -i eth1 -d 204.$EXTIP --dport 80 -j DNAT --to

iptables -N firewall
iptables -A firewall -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A firewall -m state --state NEW -i ! $IFINET -j ACCEPT
iptables -A firewall -s -d -i lo -j ACCEPT
iptables -A firewall -s -d -i lo -j ACCEPT
iptables -A firewall -d -s -i lo -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -p tcp -i eth1 -j ACCEPT

iptables -A INPUT -j firewall
iptables -A FORWARD -j firewall

iptables -A INPUT -j DROP

iptables -t nat -A POSTROUTING -o $EXTNET -j SNAT --to $EXTIP

iptables -A FORWARD -p TCP -i eth1 -o eth0 -d --dport 80 -j ACCEPT

echo "1" >> /proc/sys/net/ipv4/ip_forward

Last edited by jamesws; 02-11-2002 at 01:11 AM.


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
iptables port forwarding geoff3425 Slackware 13 12-20-2011 10:50 AM
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 07:35 PM
IPTables port forwarding.. NeoTech Linux - Networking 2 01-03-2005 11:27 AM
port forwarding with iptables David_99 Linux - Security 5 12-09-2003 08:37 PM
IPTABLES port forwarding sal_paradise42 Linux - Networking 5 10-25-2003 04:11 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:13 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