Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

iptables  - port forwarding

Posted on 2004-10-07
2
Medium Priority
?
27,430 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

783 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