Skip to contentSkip to conversation

Forwarding HTTP question

DISCUSSION Guilherme Viebig 4 participants 4 messages Jul 4, 2003 – Jul 5, 2003

lore
Share & tools
lore
#0 lore raw

My Firewall has two interfaces

eth0 200.123.234.111
eth1 192.168.0.1

I have an internal webserver on 192.168.0.33

How can I setup iptables to forward incoming traffic by eth0 to port 80 go to 192.168.0.33:80 ?

Thanks

Guilherme B. Viebig

#1 lore raw

Yes, it's in section 6 - 10 of the howto.
Start here: http://www.netfilter.org/documentation/HOWTO//NAT-HOWTO-6.html

/B
----- Original Message -----
From: "Guilherme Viebig" <[email protected]>
To: "*netfilter" <[email protected]>
Sent: Friday, July 04, 2003 06:41
Subject: Forwarding HTTP question

Quoted 17 lines

My Firewall has two interfaces

eth0 200.123.234.111
eth1 192.168.0.1

I have an internal webserver on 192.168.0.33

How can I setup iptables to forward incoming traffic by eth0 to port 80 go to 192.168.0.33:80 ?

Thanks

Guilherme B. Viebig

#2 lore raw
In reply to Guilherme Viebig
Quoted 9 lines · Guilherme Viebig

My Firewall has two interfaces

eth0 200.123.234.111
eth1 192.168.0.1

I have an internal webserver on 192.168.0.33

How can I setup iptables to forward incoming traffic by eth0 to port 80 go to 192.168.0.33:80 ?

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to 192.168.0.33

j

#3 lore raw

And don't forget to ALLOW the packets in the first place. Made me crazy the first time I did that....Put in the FORWARD rule, but no ACCEPT rule.

$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 80 -j allowed
#HTTP

-=Ray

-----Original Message-----
From: Joel Newkirk [mailto:[email protected]]
Sent: Friday, July 04, 2003 10:23 PM
To: Guilherme Viebig
Cc: *netfilter
Subject: Re: Forwarding HTTP question

Quoted 8 lines · Guilherme Viebig

My Firewall has two interfaces

eth0 200.123.234.111
eth1 192.168.0.1

I have an internal webserver on 192.168.0.33

How can I setup iptables to forward incoming traffic by eth0 to port

80 go

Quoted 1 line

to 192.168.0.33:80 ?

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to 192.168.0.33

j