[SOLVED] Forwarding DNS between two nics (separate networks)
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
... 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
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.
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
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.
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...
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
That is some very basic configuration. Depends on what OS/distro the client uses. Lookup up the OS's documentation or Google it...
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.)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.