LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-01-2011, 07:27 PM   #1
dave247
Member
 
Registered: May 2004
Posts: 206

Rep: Reputation: 30
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

Last edited by dave247; 10-02-2011 at 01:13 PM.
 
Old 10-02-2011, 04:10 AM   #2
ambrop7
Member
 
Registered: May 2011
Distribution: Gentoo
Posts: 98

Rep: Reputation: 16
Quote:
Originally Posted by dave247 View Post
... 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 View Post
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.

Last edited by ambrop7; 10-02-2011 at 04:14 AM.
 
Old 10-02-2011, 06:45 AM   #3
dave247
Member
 
Registered: May 2004
Posts: 206

Original Poster
Rep: Reputation: 30
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 View Post
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.
 
Old 10-02-2011, 07:16 AM   #4
ambrop7
Member
 
Registered: May 2011
Distribution: Gentoo
Posts: 98

Rep: Reputation: 16
Quote:
Originally Posted by dave247 View Post
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...
 
Old 10-02-2011, 12:08 PM   #5
dave247
Member
 
Registered: May 2004
Posts: 206

Original Poster
Rep: Reputation: 30
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 View Post
That is some very basic configuration. Depends on what OS/distro the client uses. Lookup up the OS's documentation or Google it...
 
Old 10-02-2011, 12:23 PM   #6
ambrop7
Member
 
Registered: May 2011
Distribution: Gentoo
Posts: 98

Rep: Reputation: 16
Quote:
Originally Posted by dave247 View Post
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
 
Old 10-02-2011, 01:09 PM   #7
dave247
Member
 
Registered: May 2004
Posts: 206

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

Last edited by dave247; 10-02-2011 at 01:13 PM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Run 2 NICs, separate networks liche24 Fedora 1 03-14-2009 11:20 PM
2 nics, 2 networks help. chrisknight Linux - Networking 5 12-19-2004 01:21 PM
2 nics, 2 networks, 2 problemas kangaegoto Linux - Networking 1 12-19-2004 06:58 AM
Separate NICs to raise the bandwith ivanatora Linux - Networking 2 07-26-2004 03:52 AM
2 NICs 2 networks 2 gateways birkinshawc Linux - Networking 1 05-29-2004 03:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration