Networking Forums

Networking Forums > Computer Networking > Linux Networking > Iptables {DNAT,REDIRECT}

Reply
Thread Tools Display Modes

Iptables {DNAT,REDIRECT}

 
 
Akede
Guest
Posts: n/a

 
      10-06-2004, 05:13 PM
I've been tweaking my firewall script lately after I've run into a
small problem.
Basically, what I'm looking to do is take connection from my Gateway
and redirect them off to clients on my LAN if they match specific
ports. The forwarding works fine.. except, the connections then show
from my Gateway IP. If I redirect a connection to an external network,
it uses my IP and I can snoop the traffic.

I've been browsing the groups for a while, researching REDIRECT. I've
tried it a couple times and I can't get it to work with redirect; they
simply don't forward. I'm not seeing anything about what the Kernal
may or may not have needed compiled, or any options enabled with it.

This is the redirecting section of my script. It works, except the IP
shows up to 192.168.1.100 as my gateway (192.168.1.1).

$IPT -t nat -A PREROUTING -p tcp --dport 5678 -i $EXT -j DNAT --to
192.168.1.100:22
$IPT -t nat -A PREROUTING -p tcp --dport 6346 -i $EXT -j DNAT --to
192.168.1.100:6346
$IPT -t nat -A PREROUTING -p tcp --dport 1234 -i $EXT -j DNAT --to
192.168.1.100:80


Any input, suggestions, etc? When using REDIRECT, I did open port
1234; so that wasn't being dropped or anything.

Thanks in advance,
Mike
 
Reply With Quote
 
 
 
 
Ken
Guest
Posts: n/a

 
      10-07-2004, 03:06 AM
Hi Mike -

On 6 Oct 2004 10:13:45 -0700, (E-Mail Removed) (Akede) wrote:

>Basically, what I'm looking to do is take connection from my Gateway
>and redirect them off to clients on my LAN if they match specific
>ports. The forwarding works fine.. except, the connections then show
>from my Gateway IP. If I redirect a connection to an external network,
>it uses my IP and I can snoop the traffic.


It sounds like you have POSTROUTING SNAT or MASQUERADE rule that
shouldn't be there.

You don't want REDIRECT, that is for redirection within the same
machine.

--
Ken
http://www.ke9nr.net/
 
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
iptables, DNAT, and SMTP Brandon Linux Networking 6 03-11-2007 05:55 PM
Something between DNAT and REDIRECT Tomasz Grzelak Linux Networking 1 11-12-2006 12:43 AM
iptables DNAT with MAC pool NeCrOS Linux Networking 0 08-09-2006 10:10 PM
iptables DNAT question Claudio Nieder Linux Networking 2 11-21-2003 07:51 PM
Iptables, Cisco 677, DNAT Eugene van Rooyen Linux Networking 0 08-10-2003 10:57 AM



1 2 3 4 5 6 7 8 9 10 11