LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Broadband router/name resolution (https://www.linuxquestions.org/questions/linux-networking-3/broadband-router-name-resolution-525208/)

melliff 02-03-2007 05:43 AM

Broadband router/name resolution
 
I am using Redhat Linux connected to the BT broadband service via a Vigor Broadband router.
I have configured networking with DHCP and it gets an IP address okay (192.168.1.x) and I can connect to the Internet. I have set the hostname and I get it back when I run the hostname command. However, when I run the host command with the name it says it can't find the name. Nor can it resolve the name of a Windows XP PC on the same network.
I have the following configuration:

/etc/hosts
127.0.0.1 fred localhost.localdomain localhost

/etc/resolv.conf
; generated by /sbin/dhclient-script
nameserver 192.168.1.1

/etc/sysconfig/networking
NETWORKING=yes
HOSTNAME=fred
DHCP_HOSTNAME=fred

I assume that the name resolution should be being done by a server at BT but I clearly need something else to get it to do it. I know that I can't put the machines in /etc/hosts because the IP addresses change.

All suggestions welcomed.

Martin.

chort 02-03-2007 09:06 AM

If you're using the DHCP server on your broadband gateway to assign IP addresses/gateway IP/DNS IP, it's going to give you a DNS setting that actually relays requests to the ISP's DNS servers. It does not know anything about the hostnames on your internal network.

You have two options:
1.) Use /etc/hosts
2.) Setup your own nameserver and stop using the one provided by DHCP

Option 1 is pretty easy. All you have to do is configure your broadband gateway to always assign the same IP to the same MAC address, which it probably does by default. Only your exteral IP address on the outside of the gateway is going to change. It's highly doubtful that it will change the IP leases for hosts on the internal side of your gateway. Since the IPs will stay the same, configure /etc/hosts with the IP/name mapping. Same for WinXP host (c:\windows\system32\drivers\etc\hosts).

Option 2 is a lot more difficult. First you have to take the time to understand BIND, then install and configure it. Then you need to figure out how to make your DHCP client ignore the DNS server it's given, and instead point it to your own (or disable DHCP entirely).

melliff 02-03-2007 09:29 AM

Chort,

Thanks for the info. I hadn't realised that the machines on the private network would always get the same address from the router. I have set up the hosts files as you suggest.

Just one point though; if I know the names of the DNS servers at my broadband provider, if I put those in the resolv.conf, would that work? And if so, how would I stop the dhclient-script over-riding them?

Martin.

chort 02-03-2007 10:09 AM

Quote:

Originally Posted by melliff
Chort,
Just one point though; if I know the names of the DNS servers at my broadband provider, if I put those in the resolv.conf, would that work?

If by "work" you mean "would it resolve my internal hostnames", then the answer is no. If by "work" you mean "would it resolve external hostnames" then the answer is yes. If you mean the latter rather than the former, then I would have to ask "why?" Having your broadband gateway run a DNS cache and forward unresolved lookups to your ISP is probably faster than query your ISPs servers directly.

Quote:

And if so, how would I stop the dhclient-script over-riding them?

Martin.
It depends on how your DHCP client is configured. On Windows you can uncheck the box next to "obtain DNS servers automatically" in your TCP/IP properties. With Linux distributions it depends on what front-end or script is being used to invoke the DHCP client. Check the documentation for your distribution.
Code:

$ apropos dhcp
should point you towards some man pages to read.


All times are GMT -5. The time now is 12:25 PM.