Solved

iptables  - port forwarding

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CentOS7 Xvnc gdm login 9 209
Prevent login on dead linux home directories 3 82
Linux on a Dell PowerEdge 720 3 130
High Bandwidth Usage 6 56
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 Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

773 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