LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Forwarding DNS between two nics (separate networks) (http://www.linuxquestions.org/questions/linux-networking-3/forwarding-dns-between-two-nics-separate-networks-905986/)

dave247 10-01-2011 07:27 PM

Forwarding DNS between two nics (separate networks)
 
I have a Deb 5 system with two nics... eth0 for internet (dhcp client) and eth1 for my private lan (static 172.16.0.1 gateway) and I have enabled tcp forwarding so my clients can reach the internet. However they have to type the ip address because DNS isnt working.

So now I want to set that up so DNS requests on the eth1 network can reach the internet through eth0. I am wondering how I might go about doing this. Should I install Bind9 and configure all that? Or is there a more simple way? Either way, it seems like I would still have to forward DNS requests or something.

I have never messed with DNS before so I am not sure where to go.

Thanks

ambrop7 10-02-2011 04:10 AM

Quote:

Originally Posted by dave247 (Post 4487570)
... I have enabled tcp forwarding so my clients can reach the internet.

What is this "TCP forwarding" you're talking about? If the clients can reach Internet hosts by their actual IP address, that's IP forwarding (with NAT in your case); TCP forwarding is something else.

Quote:

Originally Posted by dave247 (Post 4487570)
DNS isnt working

There are two ways to get DNS to work for the clients in the private network:
  • Have the clients use the same DNS server as the router (your Linux system) does. This should work, unless you've done something that specifically prohibits UDP from being forwarded.
  • Set up a DNS cache server on the router, and have the client use it as the DNS server. The simplest option here is dnsmasq. Note that dnsmasq can also be a DHCP server for your private network.

The advantage of setting up a DNS cache server is that the clients don't have to be configured the ISP's DNS server and reconfigured when it changes.

dave247 10-02-2011 06:45 AM

Yeah I meant to say ip forwarding, not tcp, lol.

I already figured that the clients on my private network should use the same DNS server as my gateway but my confusion is how to do it. Do I put a line in the interfaces file? or in the hosts file?? what do I put and where do I put it?

Quote:

Originally Posted by ambrop7 (Post 4487811)
What is this "TCP forwarding" you're talking about? If the clients can reach Internet hosts by their actual IP address, that's IP forwarding (with NAT in your case); TCP forwarding is something else.



There are two ways to get DNS to work for the clients in the private network:
  • Have the clients use the same DNS server as the router (your Linux system) does. This should work, unless you've done something that specifically prohibits UDP from being forwarded.
  • Set up a DNS cache server on the router, and have the client use it as the DNS server. The simplest option here is dnsmasq. Note that dnsmasq can also be a DHCP server for your private network.

The advantage of setting up a DNS cache server is that the clients don't have to be configured the ISP's DNS server and reconfigured when it changes.


ambrop7 10-02-2011 07:16 AM

Quote:

Originally Posted by dave247 (Post 4487982)
I already figured that the clients on my private network should use the same DNS server as my gateway but my confusion is how to do it. Do I put a line in the interfaces file? or in the hosts file?? what do I put and where do I put it?

That is some very basic configuration. Depends on what OS/distro the client uses. Lookup up the OS's documentation or Google it...

dave247 10-02-2011 12:08 PM

I have googled it. I have spent hours searching and reading but the solution is not clear. Every page I find is talking about something slightly different than applies to my situation.

Currently, ip traffic is forwarded from eth1 to eth0 but DNS requests are not. For example, from my client side of the network, I can go to 74.125.255.81 (google.com) but I can not go there by typing the name in the address bar. DNS is not configured properly or at all. I am trying to understand what I would do in this situation to get it working.


Quote:

Originally Posted by ambrop7 (Post 4487991)
That is some very basic configuration. Depends on what OS/distro the client uses. Lookup up the OS's documentation or Google it...


ambrop7 10-02-2011 12:23 PM

Quote:

Originally Posted by dave247 (Post 4488187)
I have googled it. I have spent hours searching and reading but the solution is not clear. Every page I find is talking about something slightly different than applies to my situation.

On Linux, the DNS server addresses eventually go to /etc/resolv.conf:

Code:

nameserver x.y.z.w
Assuming you have IP itself working, manually editing /etc/resolv.conf should get DNS working too.

However, /etc/resolv.conf is usually automatically generated from other sources, and your edits will probably be lost soon. Instead, you should configure DNS servers appropriately via the network configuration system you're using. For example, if you're using Debian's /etc/network/interfaces commands, use the dns-nameservers option: (see Debian network setup documentation.)

Code:

allow-hotplug eth0
iface eth0 inet static
 address 192.168.11.100
 netmask 255.255.255.0
 broadcast 192.168.11.255
 gateway 192.168.11.1
 dns-nameservers x.y.z.w


dave247 10-02-2011 01:09 PM

EDIT: It appears I got things working. Not sure what I did... but that's linux for you.


All times are GMT -5. The time now is 11:07 PM.