Solved

iptables  - port forwarding

Posted on 2004-10-07
2
27,418 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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 demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

930 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

12 Experts available now in Live!

Get 1:1 Help Now