natd redirect from local network to localnetwork problem...

I have natd with external interface dc0 and bridge0 with members wi-fi interface rt28600 and cable rl0. The bridge doesn't have IP adress but each of the members have 192.168.1.1 for the internal local network.

What I need redirect from the local network back to the local network.

I meen, the DNS record points to the internet IP and I need redirect of the request:

from the local network --- to the internet IP --- back to the server in the local network.


for example ftp:

Code:
redirect_port tcp 192.168.1.102:21 21
seems to work only from internet to the local network, but then I am in the local network and type the internet address, it connects me to the NATD server - 192.168.1.1.

I tryed:

Code:
interface bge0 redirect_port tcp 192.168.1.102:21 21
and
Code:
interface dc0 redirect_port tcp 192.168.1.102:21 21
and
Code:
interface rl0 redirect_port tcp 192.168.1.102:21 21

and also:

Code:
server# cat /etc/natd.conf | grep -v #
interface dc0
use_sockets yes
same_ports yes
redirect_port tcp 192.168.1.102:21 21
redirect_port udp 192.168.1.102:21 21
redirect_port tcp 192.168.1.102:5900 5900
redirect_port udp 192.168.1.102:5900 5900
interface bge0 redirect_port tcp 192.168.1.102:21 21
interface dc0 redirect_port tcp 192.168.1.102:21 21
interface rl0 redirect_port tcp 192.168.1.102:21 21
interface lo0 redjrect_port tcp 192.168.1.102:21 21
redirect_port tcp 192.168.1.102:3724 3724
redirect_port tcp 192.168.1.102:6112 6112
redirect_port tcp 192.168.1.102:6113 6113
redirect_port tcp 192.168.1.102:6114 6114
redirect_port tcp 192.168.1.102:4000 4000


server#

All of the rulls togather. Non of them seems to work from the local network to the local network, they redirect only the requests from internet.
Please help, what am I doing wrong and what am I missing.

Thanks in advance.
 
gnoma said:
What I need redirect from the local network back to the local network.
You can't "bounce" an incoming packet back out the same interface.
 
So what should I do? Run BIND and reconfigure dhcp to send dns 192.168.1.1.
And set A record for the domain 192.168.1.x??
Is this the only way?
 
gnoma said:
So what should I do? Run BIND and reconfigure dhcp to send dns 192.168.1.1.
And set A record for the domain 192.168.1.x??
Is this the only way?

Yep.
 
Hmmm, I'v seen the small home wi-fi routers to do that without dns. Infact long time ago I had linksys router with iptables and by default it redirecred all the trafic the exactly the way I need now.
I meen... run dns just for a simple pachage redirection! I really can't belive that in FreeBSD the natd can't do that. I meen... what if I don't have DNS and I am using only IP?
 
Thank you, this is really interesting and really gives a few directions that may lead to a solution. I'll run some tries and I'll post a solution here :)
 
The "correct" solution to this issue is to use properly configured DNS, such that clients in the LAN get local IPs for "domain.com", and clients outside of the LAN get public IPs for "domain.com". Thus, local traffic stays local, and public traffic stays public. And everyone just uses the same hostnames to access services.

There are two different ways to do that:
  1. split-DNS using two separate DNS servers, or
  2. DNS views, where a single DNS server returns different IPs based on the IP of the client
 
Back
Top