Port forwarding with iptables?

Michael O'Keefe mokeefe at qualcomm.com
Mon Jun 24 11:41:02 PDT 2002


Amit Chakradeo wrote:
> 
> On Fri, Jun 21, 2002 at 03:28:52PM -0700, John Oliver wrote:
> > I want to forward a given port on a machine to a remote host.  I haven't
> > found anything that specifically covers this... just IP Masqueradiing.
> > I'm kicking those rulesets around, but aren't having much luck :-(
> >
> 
> Do you want something like redirecting HTTP traffic to particular internal
> host ? In that case, I have a rule which works for me...
> iptables -t nat -A PREROUTING -i $INET_IFACE -p TCP --dport 80 -j DNAT --to $INTERNAL_IP_ADDRESS

shoudn't that be ${INTERNAL_IP_ADDRESS}:80

Or does DNAT preserve the port by default ?

-- 
Michael O'Keefe                      |          mokeefe at qualcomm.com_   
Live on and Ride a '96 Honda CBR1000F|          roxus at cox.net      / |  
I like less more or less less than   |Work:+1 858 845 3514        /  |  
more. UNIX-live it,love it,fork() it |Fax :+1 858 651 1984       /_p_|  
My views are MINE ALONE, blah, blah, |Home:+1 858 748 5432       \`O'|  
blah, yackety yack - don't come back |Fax :+1 858                _/_\|_,



More information about the KPLUG-List mailing list