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.
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
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.
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660
Rep:
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).
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?
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.