name resolution on LAN using netbios

Discussion in 'Linux Networking' started by topher, Feb 6, 2004.

  1. topher

    topher Guest

    I have a simple home network with a LinkSys router/AP/gateway. My home
    computers are configured via DHCP through the router. Unfortunately,
    this device does not support static IP assignments based on MAC
    addresses or anything. I have three computers at home, one of which
    usually runs WinXP (and has a printer), while the other two run Linux.
    It is annoying to constantly get the DHCP client list "by hand" and edit
    /etc/hosts each time I want to connect to another computer via ssh or
    whatever. Another reason for this: I couldn't get printing to work
    through samba, though I was able to do it using lpd after enabling that
    on the WinXP box. But lpd requires the correct entry in /etc/hosts
    instead of using netbios names.

    Is there some way, via /etc/nsswitch.conf or resolv.conf or something
    else, to allow netbios names on the LAN to get resolved in the standard way?

    I'd be happy to use something other than netbios to broadcast the names.
    Are lisa or reslisa good alternatives that would work on Windows as well?

    This must be a very common problem, but I haven't been able to find any
    advice in howto or other docs. An earlier thread was mentioning DDNS,
    but that souds like something that only runs on a Windows box. I want
    something that works even if I only have Linux machines online.

    topher, Feb 6, 2004
    1. Advertisements

  2. topher

    Al Guest

    I don't have your type of Linksys router but if its anything like my old
    Linksys 4 port router/switch, you should be able to disable the DHCP side of
    it and just use static IP addresses in the same range that yours currently
    hands out (, then on each of your systems just give them their
    own static IP, set the gateway on each system to the Linksys internal IP
    address (usually and plugin your IPS's DNS server addresses in
    the appropriate places. Then update your HOSTS file(s) one last time to
    reflect the static IP addresses and your problem should be solved.

    Al, Feb 6, 2004
    1. Advertisements

  3. topher

    James Knott Guest

    It doesn't have to. Set your dhcp range to be less than the network address
    range and assign static addresses outside of the dhcp range. For example,
    configure network to be -, then set dhcp to assign
    addresses up to and place your static addresses above that
    range. Then add the addresses to the hosts files.


    Fundamentalism is fundamentally wrong.

    To reply to this message, replace everything to the left of "@" with
    James Knott, Feb 7, 2004
  4. topher

    Fred Emmott Guest

    Yes, it can be resolved using netbios fully automatically.

    Edit the "hosts: " line in /etc/nsswitch.conf to end with "wins" eg:
    hosts: files dns wins
    Fred Emmott, Feb 7, 2004
  5. topher

    topher Guest

    Thanks! That worked!

    Funny, I was diligently reading the nsswitch.conf man page before
    posting here, which mentioned only gethostbyname(3), which itself refers
    only to the older host.conf file. The Net-HOWTO file also did not
    mention nsswitch.conf and I was getting nervous that I didn't even have
    /etc/host.conf. I'm running Gentoo Linux which normally stays
    up-to-date on stuff like the man and howto pages, but I guess the docs
    have slipped behind in this area. Anyway, I like your solution because
    it's very clean and simple.

    Thanks also to Al and James' suggestins of using static IP addresses.
    I'm happy to do that for my desktop computers, but it creates an
    additional hassle with my laptop which I take back and forth to work. I
    would at least need a different wireless scheme.

    - Topher
    topher, Feb 7, 2004
  6. topher

    Fred Emmott Guest

    it's in the samba documentation, not the nameservice documentation ;)
    Fred Emmott, Feb 7, 2004
    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.