Networking Forums

Networking Forums > Computer Networking > Linux Networking > Iptables, DNAT, Forwarding? problem...

Reply
Thread Tools Display Modes

Iptables, DNAT, Forwarding? problem...

 
 
Mitch
Guest
Posts: n/a

 
      04-17-2004, 10:38 PM
This seems so simple, but it's not working... I've got a FEDORA box
setup as a basic firewall using IPtables - I need to forward HTTP
traffic through the FEDORA/FIREWALL box to an internal webserver.
This is the basic setup:

65.222.38.100 (external address)
65.222.38.101 (VIRTUAL external address)

FORWARD TO

192.168.0.5 Port 80

The problem is that I can forward 80 to the Internal address of the
FIREWALL, but I can't forward it to another internal host (EG:
192.168.0.5). The port shows as closed and port 80 traffic doesn't
seem to get past the firewall... My question(s) is/are:
1. Which rule is processed first, NAT or FORWARD
2. If a Forward rule is configured, shouldn't that port show "open"
when I do an NMAP of the External interface?

From what I've read - a forward rule and a DNAT rule are required (and
setup) but something is stopping the traffic from entering the
firewall!?

Thanks,
M
 
Reply With Quote
 
 
 
 
Christoph Scheurer
Guest
Posts: n/a

 
      04-19-2004, 04:23 PM
On 17 Apr 2004 15:38:10 -0700
(E-Mail Removed) (Mitch) wrote:

> This seems so simple, but it's not working... I've got a FEDORA box
> setup as a basic firewall using IPtables - I need to forward HTTP
> traffic through the FEDORA/FIREWALL box to an internal webserver.
> This is the basic setup:
>
> 65.222.38.100 (external address)
> 65.222.38.101 (VIRTUAL external address)
>
> FORWARD TO
>
> 192.168.0.5 Port 80
>
> The problem is that I can forward 80 to the Internal address of the
> FIREWALL, but I can't forward it to another internal host (EG:
> 192.168.0.5). The port shows as closed and port 80 traffic doesn't
> seem to get past the firewall... My question(s) is/are:
> 1. Which rule is processed first, NAT or FORWARD
> 2. If a Forward rule is configured, shouldn't that port show "open"
> when I do an NMAP of the External interface?
>
> From what I've read - a forward rule and a DNAT rule are required (and
> setup) but something is stopping the traffic from entering the
> firewall!?
>
> Thanks,
> M

OK, here's how I do it:

iptables -t nat -A PREROUTING -i $ext_if -p tcp --dport 80 -j DNAT --to-destination $webserver_ip
iptables -A FORWARD -i $ext_if -p tcp --dport 80 -d $webserver_ip -j ACCEPT

the first rule defines that all packets incoming from the external interface with destination port 80 are routed to the webservers IP.
the senond rule accepts these packets

Greets
Chris

 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
unusual iptables port forwarding problem azensun@gmail.com Linux Networking 2 11-19-2006 12:58 AM
iptables - problem with forwarding traffic Sanal Kisi Linux Networking 2 03-07-2005 07:44 AM
Nocat - iptables problem (port forwarding) pablo rossi Linux Networking 0 03-04-2004 09:51 AM
Redirect problem with iptables and port forwarding Bertrand Sirodot Linux Networking 1 10-23-2003 02:07 PM
iptables DNAT problem from internal net Lothar Behrens Linux Networking 2 09-16-2003 07:49 AM



1 2 3 4 5 6 7 8 9 10 11