Results 1 to 10 of 14
Enjoy an ad free experience by logging in. Not a member yet? Register.
Resolving hostnames on a local network and with DHCP
I added four more older headless computers to our local home network with a NAT router working as a DHCP server.
I can't get to resolve the hostnames of the local PCs configured via DHCP.
I actually never could but I ddidn't care before as I used ftp or ssh between computers only occasionally and VOIP phones and network cameras had static IP addresses for that reason.
I got again the option to use static addresses but I was wondering if there was a more elegant around this.
The four headless computers get via DHCP often changing IP addresses.
ssh and nfs can't work at the moment with their hostnames as I get "Unable to resolve hostname". The hostnames is in the "/etc/hosts" file of every PC are obviously not sufficient.
Do I really need a local DNS server installed for the new headless PCs to look up the hostnames?
I got at the moment one FreeBSD box running its own DNS server but locally on the machine as "127.0.0.1". The FreeBSD box itself is again with a dynamic IP address via DHCP ...
Do I need to assign this FreeBSD box a static address and then use this DNS server from the new headless PCs or is there another way, probably by editing a config file only?
Those newly added headless PCs run RedHat. So, if there would be a way to let those see the hostnames of other local PCs, that would be great.Bus Error: Passengers dumped. Hech gap yo'q.
setting the dhcp server to assign the same ip address to the same hosts (by mac address) every time would work around the static ip problem. you would no longer need static ip configurations on your computers, but have set up the router to delegate the ip addresses for well known computers. all others can receive a random ip from an ip pool.
for the hostname resolution you can configure your router as first dns server (published along with the dhcp ack). then assign the hostnames to a specific ip matching the dhcp configuration and then you have a full-fledged local network with resolvable hostnames.
of course you could just go the old fashion way and use the host file if you don't want to set up a DNS server, but definitely use a reservation to keep the addresses from changing.linux user # 503963
my solution does not set any information on the client side. the router has all information a client needs. if a client requests i.e. "hermes" or "hermes.lan" it will ask the primary dns server, which in turn is my router device and the standard gateway. this device then checks his dns table and responds: "i know hermes, he is w.x.y.z" and the client knows who it is. the router can answer this question because in turn he is the one who gives "hermes" his ip address through dhcp.
Dilbert, what sort of router and firmware? If it supports dnsmasq, you can set up the router as DNS server, which may be how Kloschüssel is doing it.
I do this with a WRT-54G and dd-wrt firmware.
- Join Date
- Mar 2008
dilebert, I think this might be a solution for you.
apt-get install winbindsgrab you favorite editor
edit your /etc/nsswitch.conf file
search for the line starting with hosts (my line was like this "hosts: files dns")
add "wins" to the line ("hosts: files dns wins")
>> hosts: files dns wins
ORDER ON THIS LINE IS IMPORTANT!
If you do this:
hosts: wins dns files
your system will hang on boot!
place a www dot in front of what is below.
@Rava this is quite, but not exactly the same. if you have port forwarding it would mess up the routes from time to time. very nasty if you ask me.
@lindylex the original poster uses unix / bsd boxes, which natively do not include wins hostname resolution. your solution would be neat if he wanted to resolve windows hosts by name.
@greyhairweenie right. that is how it actually works. but one can pick the dns server he likes most and i do not require one to use dnsmasq.
You never stop learning with *IX, right?
(unlike with M$ OS, when I was too lazy some years ago and only used that I realized that my brain worked less as well, so, to me Linux is a win/win one more then one level, but I digress)Cheers!
yours truly, Rava
Unfortunately, my router is quite ancient and it doesn't support any DNS at all.
I'm now pretty sure that "dynamic DNS" via the router or another DNS server on the local network is the only feasible route to go.
As this seems to be some effort, too, I presumably go the old fashioned way to use static IP addresses and probably edit the /etc/hosts files on each machine as suggested bu you to use hostnames at least.
Yesterday evening, I ran into another problem with at least the RedHat headless PCs. The /etc/exports file on those doesn't accept all styles of host naming as the the manpages on those machines say. IP address ranges and netmasks don't work, the same as local domain names and what's else in those examples in the manpages.
Only adding a bunch of fully specified IP addresses works ...
Well, those "new" PCs are Sun Sparcstations. I didn't set up the Sparcstations with NetBSD on it already but if I get the RedHat ones only to work in that primitive way than I'm going that primitive way for all of them.
Thanks to you guys anyhow. At least learnt something.Bus Error: Passengers dumped. Hech gap yo'q.