Solved

iptables  - port forwarding

Posted on 2004-10-07
2
27,423 Views
Last Modified: 2011-08-18
Hi there,

I'm running an iptables gateway firewall with 2 interfaces. I had a port forward rule, which forwards any http traffic
hitting the external interface to an internal webserver. I've since added another webserver running on port 8080
and another rule to forward http:8080 traffic.

The first rule work fine but the latter does not?? Can anyone spot a problem.

thanks john

# Forward to webserver 1
$IPTABLES -A FORWARD -i $EXTIF -d $CLIENT \
                     -p tcp --dport 80 -m state --state NEW -j ACCEPT

$IPTABLES -t nat -A PREROUTING -i $EXTIF -p tcp -d XX.XX.XX.XX.\
                   --dport 80 -j DNAT --to-destination 192.168.9.57

$IPTABLES -t nat -A POSTROUTING -o $EXTIF -s $CLIENT \
               -j SNAT --to-source XX.XX.XX.XX.

#Forward to webserver 2
$IPTABLES -A FORWARD -i $EXTIF -d $CLIENT \
                     -p tcp --dport 8080 -m state --state NEW -j ACCEPT

$IPTABLES -t nat -A PREROUTING -i $EXTIF -p tcp -d XX.XX.XX.XX.\
                   --dport 8080 -j DNAT --to-destination 192.168.9.56

$IPTABLES -t nat -A POSTROUTING -o $EXTIF -s $CLIENT \
               -j SNAT --to-source XX.XX.XX.XX.


0
Comment
Question by:jjbarnsley
2 Comments
 
LVL 6

Accepted Solution

by:
blkline earned 500 total points
ID: 12254332
Do you have a rule further up the chain that precludes the acceptance of 8080?    That's what I'd guess.

If you can't see anything there then post your entire chain (obfuscate the imporant IP addresses first) and let us see the whole thing.

Barry
0
 

Author Comment

by:jjbarnsley
ID: 12254446
thanks barry spotted.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question