Solved

iptables  - port forwarding

Posted on 2004-10-07
2
27,415 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
Comment Utility
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
Comment Utility
thanks barry spotted.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now