Name resolution for local names using DHCP

Discussion in 'Linux Networking' started by Charles Russell, Dec 16, 2007.

  1. I can't figure out how to get name resolution for computers on my home
    WLAN, though everything works all right if I type in explicit IP
    addresses. The IP addresses will vary because of DHCP, so I can't
    simply put them in /etc/hosts.

    The hostnames and IP addresses are all known to the router (Linksys
    wrt54g), as I can confirm by querying the router. Should the router not
    resolve these local hostnames? Or do I misunderstand how this should
    work under DHCP?
    Charles Russell, Dec 16, 2007
    1. Advertisements

  2. the DHCP server will assign ( if you tell it too ) the address
    of your DNS server. It can be the same server as your DHCP Server
    or it can be some other server.

    My dhcp server is configured to tell the dhcp clients the dns ip
    address they are supposed to use and that's what they use...

    you should be able to look at the /etc/resolv.conf file ( for linux
    ) to see what DNS server it's using and do iptables /all ( I think
    that's it ) on windows to see what DNS it is using.

    D.A.M. - Mothers Against Dyslexia

    see for my contact info.

    jack - Grapevine/Richardson
    Jack Snodgrass, Dec 16, 2007
    1. Advertisements

  3. /etc/resolv.conf (created by dhcpcd) contains the IP address of the
    wireless router, which I think has a built-in DHCP server. With this
    configuration, DNS resolution works fine for the internet. It just
    doesn't work for the local hosts on my WLAN.
    Charles Russell, Dec 17, 2007
  4. The router picksup an IP address via dhcp fromm your IP provider. It also
    get's the DNS addresses from you IP provider... then as you add clients to
    your network, the router hands each of them an IP address and then provides
    the DNS addresses it got from your IP provider. That means... the router
    KNOWS NOTHING about your local lan.

    What you need to do, is setup your OWN DNS resource and add your client IP
    and hostnames to it... then configure your router to hand out the address
    of your own DNS instead of passing though the ones from your IP provider.

    Jerry McBride, Dec 17, 2007
  5. Charles Russell

    ray Guest

    No offense, but on a home lan why do you need dhcp? Why not assign
    everything static addresses? Works a lot simpler that way.
    ray, Dec 17, 2007
  6. If I log on to the router and select status - local network - dhcp -
    clients, the router returns a table of IP addresses and local hostnames.
    So the information is there, if I knew how to access it automatically. I
    can get it manually and put it in /etc/hosts, but then it can change
    whenever DHCP reassigns leases.
    How does that work? I thought that the hostname - IP address
    association must be obtained somehow from the DHCP server, since the
    DHCP server assigns the IP addresses, and they are not constant.
    Charles Russell, Dec 17, 2007
  7. I'm just groping my way along with network configuration. I used a Unix
    network at work for ten years, but we had a system administrator who
    handled the configuration.

    I chose the default configuration in the setup software for my Linksys
    wireless router, without having any idea what was going on, and ended up
    with DHCP. Afterward I looked up DHCP in Wikipedia, to try to grasp what
    was happening.

    In the Knoppix FAQ's I found DHCP recommended strongly as simplifying
    network setup. Indeed, with DHCP everything now works - with the
    exception of resolving local names, which is a nuisance but can be dealt
    with manually.

    Am I not just missing some simple configuration detail? Would it really
    be simpler to assign static IP's? I think the Knoppix FAQ mentioned
    that DHCP does a few more things than just assign IP addresses.

    With DHCP everything now works - with the exception of resolving local
    names. This is a nuisance, but is not critical since I can enter an
    explicit IP for ftp and ssh. Name resolution for shared Windows
    directories is working OK, presumably mediated by the Windows SMB
    server; smbclient finds the target machine by hostname even though I
    can't ping it except by explicit IP address. I don't know how much of
    this would be affected if I dropped DHCP.
    Charles Russell, Dec 17, 2007
    Hash: SHA1

    All you need is a DHCP server capable of doing Dynamic Updates in the
    DNS[1]. ISC dhcpd[2] is one such DHCP server which supports this, and ISC
    bind[3] is one such DNS server which supports dynamic updation.

    So client has to send its hostname to the DHCP server, and DHCP will map
    client's IP to its hostname in the DNS server.

    [1] -
    [2] -
    [3] -

    - --
    Ashish Shukla आशीष शà¥à¤•à¥à¤²
    ·-- ·- ···· ·--- ·- ···- ·- ·--·-· --· -- ·- ·· ·-·· ·-·-·- -·-· --- --
    Version: GnuPG v1.4.6 (GNU/Linux)

    -----END PGP SIGNATURE-----
    Ashish Shukla आशीष शà¥à¤•à¥à¤², Dec 17, 2007
  9. Charles Russell

    Max Guest

    Charles Russell schreef:
    If you are using Knoppix as a DHCP server, you must be able to control
    how DHCP works in /etc/dhcpd.conf
    In this file you can configure the daemon so that it will give the same
    address to your computers depending on their MAC address. This way you
    will have the best of two worlds. You can add these IP-addresses to the
    /etc/hosts files of your computers or you can run BIND yourself.

    Good luck,
    Max, Dec 17, 2007
  10. Charles Russell

    david Guest

    You could just assign fixed IP addresses. Then you could use /etc/hosts.
    david, Dec 17, 2007
  11. Thanks for the responses, everybody. I infer that there is no simple
    fix within the capability of the DHCP server in my $50 Linksys wrt54g
    router. Given that there is no simple fix, and that the only problem is
    that I have to manually enter IP addresses whenever I do local ftp or
    ssh, I think I'll follow the principle: "If it ain't broke (much), don't
    fix it (much)."
    Charles Russell, Dec 17, 2007
  12. Charles Russell

    Unruh Guest

    As far as I know, he is using the modem/router as the dhcp server. He has
    no access to the software on that server. He would be far better off just
    assigning static addresses, and it may even be possible to do so under
    dhcp-- ie tell dhcp on the router to always assing IP address to x to a
    machine with mac address y.
    Unruh, Dec 17, 2007
  13. Charles Russell

    Unruh Guest

    Some routers allow you to tell the dhcp service on the router to allways
    assign ip address X to MAC address Y. Look through the manual to see if
    your router allows that.
    Unruh, Dec 17, 2007
  14. Charles Russell

    ray Guest

    It is not difficult to assign static IP's - then you can assign names to
    IP addresses and have done with it. I started doing at least some static
    assignments last year as it greatly simplified printer setup.
    ray, Dec 17, 2007
  15. Yes, I think I have instructions for doing that with my router. But is
    there really no way to make the router look in its own internal table of
    host - IP address associations?

    In googling on the wrt54g router, I found the allegation that the router
    itself runs an illegal version of Linux. The capability I want seems
    very basic. I can't help thinking that there must be some simple
    configuration step that does the job without departing much from the
    default router configuration - assuming that the problem is in the
    router configuration and not in the computer configuration. My
    understanding of how this all works is too flaky to know. The picture is
    complicated by running Windows SMB on the same network. I'm never sure
    which software is responding to what query.
    Charles Russell, Dec 17, 2007
  16. Charles Russell

    Unruh Guest

    This would by far be the easiest thing to do, just assign ip addresses to
    mac addresses and be done with it.

    That might mean that they have not published the source code for anyone to
    look at. I think they finally did. But unless you really want to hack the
    internals this makes no difference for you.

    Read the manual. That is all anyone can do.
    Note that assigning IP to mac is not departing at all from teh default
    configuration. It is an integral part of dhcp. In fact it is a security
    plus, since if you assign IP to MAC and disallow all other connection
    types, then some person driving by on the street cannot hack into your
    machine and use it to attack say the Pentagon.

    Almost certainly not your computer configuration.
    Unruh, Dec 17, 2007
  17. Yes, it does. But why should static IP addresses be required, when the
    DHCP server already has the hostname-IP address associations it needs to
    resolve the local hostname?
    Charles Russell, Dec 17, 2007
  18. Charles Russell

    Unruh Guest

    You have become fixated on your particular solution to the problem. Let go.
    Or spend you life trying to persuade Linksys to do it your way.
    Unruh, Dec 17, 2007
  19. Well, maybe that just can't be done by a basic router. I fortuitously
    hit upon the recent exchange, which seems to address the same problem.
    It surprises me that the router software doesn't handle this
    transparently by itself, but maybe I am expecting too much for $50.

    There is a small DNS forwarding daemon for
    small networks with DHCP clients: dnsmasq.

    It also can serve names from the /etc/hosts
    file of the server.
    Charles Russell, Dec 17, 2007
  20. Or maybe not. When I checked the dnmasq web site, I found the following:

    "(dnmasq) is used in Linksys wireless routers (dd-wrt, openwrt and the
    stock firmware)"

    But I can't get the Linksys wrt54g to resolve local names. So I wonder:
    do I need a more expensive model, or have I just not found the magic words?
    Charles Russell, Dec 17, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.