Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
Hi all, 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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie dilbert's Avatar
    Join Date
    Sep 2006
    Location
    Yorkshire, GB
    Posts
    237

    Resolving hostnames on a local network and with DHCP


    Hi all,

    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.

  2. #2
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    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.

  3. #3
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    626
    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

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    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.

  6. #5
    Linux Enthusiast Mudgen's Avatar
    Join Date
    Feb 2007
    Location
    Virginia
    Posts
    664
    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.

  7. #6
    Just Joined!
    Join Date
    Mar 2008
    Posts
    30
    dilebert, I think this might be a solution for you.

    Code:
    apt-get install winbinds
    grab 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!
    I got this solution from.
    place a www dot in front of what is below.
    linuxquestions.org/questions/linux-networking-3/ping-netbios-names-from-linux-samba-271336/

    Thanks, Lex

  8. #7
    Just Joined! Rava's Avatar
    Join Date
    Jul 2007
    Location
    hacking 127.0.0.1
    Posts
    49
    Quote Originally Posted by Kloschüssel View Post
    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.
    At least my router says that it will assign the same IP address when the MAC device logs into the local net at least very 2 or 3 weeks, quite a lot of routers have such time frames ("lease time")

  9. #8
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    @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.

  10. #9
    Just Joined! Rava's Avatar
    Join Date
    Jul 2007
    Location
    hacking 127.0.0.1
    Posts
    49
    Quote Originally Posted by Kloschüssel View Post
    @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.
    I had no idea, and yes, nasty indeed.

    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)

  11. #10
    Linux Newbie dilbert's Avatar
    Join Date
    Sep 2006
    Location
    Yorkshire, GB
    Posts
    237
    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.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •