Linux Netfilter discussions
 help / color / mirror / Atom feed
* Re: DNS and NAT
@ 2005-07-13 17:10 Suzana Lojic-Skoric
  2005-07-14 13:29 ` Jörg Harmuth
  0 siblings, 1 reply; 19+ messages in thread
From: Suzana Lojic-Skoric @ 2005-07-13 17:10 UTC (permalink / raw)
  To: netfilter



>From: /dev/rob0 <rob0@gmx.co.uk>
>To: netfilter@lists.netfilter.org
>Subject: Re: DNS and NAT
>Date: Mon, 11 Jul 2005 16:25:20 -0500
>
>Please don't top-post. Thank you.
>
>Suzana Lojic-Skoric wrote:
>>OK, thanks I was not sure what is the proper behavior regarding
>>iptables and DNS.
>
>The usual situation is that clients are NAT'ed out, like what you're 
>describing.
>
>>If answer is not translated then how do I get DNS to work with two way 
>>NAT?
>
>What does not work? Two-way NAT is fine. You go on to say you're not really 
>talking about two-way NAT:
>
>>My internal network does not understand any of the ip addresses that 
>>belong to outside. So if the request for a page that is sent from internal 
>>network comes back from outside with an answer (ip address) that is not 
>>getting translated then I can't resolve the page since my internal network 
>>doesn't understand it and can't route to it.
>
>Clients need to have a default route through the NAT gateway, which does 
>SNAT or MASQUERADE. How is it two-way if the clients can't route out?
>
I have an internal network that has one set of addresses and outside network 
that has
a different set of addresses. I am using NAT for the sole purpose of 
translation. Both inside and outside network have DNS servers, mail 
servers,.... Both networks need to talk to each other, send mail and request 
web pages... I have a control of inside network but not the outside ntw.

When the client from outside sends a DNS query to the inside ntw I guess I 
can implement split DNS as Jason Opperisano suggested and get it working 
that way. The outside world will get a web page from external view and will 
have answer from global outside address, the inside world will get answer 
from internal view with inside global ip.

The problem is I don't understand how it is supposed to work when the client 
is inside and sending a request for a page whose server happens to be 
outside...
I have a default route through the NAT, so when a client on the inside 
network
sends a DNS query it goes out through the NAT, in my case both source
and destination gets translated and forwarded to outside DNS server.( I have 
to translate the destination as well because the clients on internal network 
send a request to an internal DNS server with the internal IP address as 
destination. So the request gets forwarded to the outside world through the 
NAT and both SNAT-ed and DNAT-ed.) When the answer comes back to NAT, the 
outside source and destination IP gets translated back to the internal 
addresses, but the actual IP that resolves the requested page is embedded in 
the message, and it does not get translated ( it is outside IP) When the 
client gets the answer, it processes it, gets the outside IP from the 
message and try talk to it. But this is outside IP and inside clients can't 
route to it.

I am trying to understand how is this supposed to work. I can't quite use 
the wisdom from masquerade because masquerade is simpler, masquerade 
messages are only SNAT-ed, meaning only source address is translated and 
when the request comes back it is then DNAT-ed to internal network, meaning 
destination is translated so the message can find your machine. But you 
don't care that google.com resolved as 216.239.39.99 because your NAT is one 
way NAT in you can talk to 216.239.39.99. In my case, I have to translate 
the 216.239.39.99 to something else (for example 10.1.1.1) so that the 
inside network can talk to it. And then on the exit through the nat 10.1.1.1 
will be translated back to 216.239.39.99. The problem is I have no way of 
translating the 216.239.39.99 to 10.1.1.1 because iptables NAT does not 
inspect the payload of the DNS answer and does not translate it. ... and 
this is how iptables is supposed to work.

I have both DNAT and SNAT happening both ways, when the message goes out and 
comes back in. All messages on inside network mast have both source and 
destination from the inside IP address range. Also I can't advertise my 
inside addresses to the outside world.


>>Is there a way around this problem? How do I get DNS to work in the type 
>>of environment I described?
>
>If you don't want to allow NAT clients out for some reason, you might check 
>into running proxy servers, such as squid for HTTP/FTP. Only the services 
>you are proxying can be used by internal clients. SOCKS proxy servers can 
>handle multiple protocols, but I don't know anything more about it than 
>just that fact.
>
>Proxy servers are a good choice in some circumstances; you maintain maximum 
>control over what clients can and cannot do (unless users have shell access 
>to the proxy server, perhaps.) But proxying is far more resource-intensive 
>than NAT.
>--
>     mail to this address is discarded unless "/dev/rob0"
>     or "not-spam" is in Subject: header
>

_________________________________________________________________
Take charge with a pop-up guard built on patented Microsoft® SmartScreen 
Technology  
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines 
  Start enjoying all the benefits of MSN® Premium right now and get the 
first two months FREE*.



^ permalink raw reply	[flat|nested] 19+ messages in thread
* DNS and NAT
@ 2005-07-11 19:37 Suzana Lojic-Skoric
  2005-07-11 19:41 ` Jason Opperisano
  0 siblings, 1 reply; 19+ messages in thread
From: Suzana Lojic-Skoric @ 2005-07-11 19:37 UTC (permalink / raw)
  To: netfilter

Does DNS work with iptables NAT or I need some kind of ALG to get DNS 
answers translated?

I am using Mandrake Linux 10.0. I have two way NAT going on and I am trying 
to get DNS requests through the NAT. I got FTP, HTTP and SMTP working 
through the NAT, but DNS is not working properly, DNS answer is not getting 
translated. Source and Destination addresses in DNS message are properly 
translated, but the actual answer (the ip address embedded in the message) 
is not translated.

Thanks

_________________________________________________________________
Powerful Parental Controls Let your child discover the best the Internet has 
to offer.  
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines 
  Start enjoying all the benefits of MSN® Premium right now and get the 
first two months FREE*.



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2005-07-15 19:51 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-13 17:10 DNS and NAT Suzana Lojic-Skoric
2005-07-14 13:29 ` Jörg Harmuth
2005-07-14 15:50   ` Suzana Lojic-Skoric
2005-07-14 16:00     ` primero
2005-07-14 20:33       ` Suzana Lojic-Skoric
2005-07-15  8:53         ` Jörg Harmuth
2005-07-15 16:30           ` Suzana Lojic-Skoric
2005-07-15 16:45             ` R. DuFresne
2005-07-15 17:04               ` Suzana Lojic-Skoric
2005-07-15 18:52             ` Francesco Ciocchetti
2005-07-15 19:10               ` Suzana Lojic-Skoric
2005-07-15 19:51               ` Suzana Lojic-Skoric
  -- strict thread matches above, loose matches on Subject: below --
2005-07-11 19:37 Suzana Lojic-Skoric
2005-07-11 19:41 ` Jason Opperisano
2005-07-11 20:33   ` Suzana Lojic-Skoric
2005-07-11 20:44     ` Jason Opperisano
2005-07-11 21:25     ` /dev/rob0
2005-07-11 21:36       ` Jan Engelhardt
2005-07-12  4:05     ` R. DuFresne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox