Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm setting up an Ubuntu Linux server on an old machine I have at home [never done this before] and am starting to get things working how I'd like. One thing I'm stuck on is:

How do I get my box's 'name' to resolve to it's IP address? I can access it fine at the minute with 192.168.0.8, but if I type servername in my address bar, it cannot be found. This works for other PC's on the network (Windows), but not my linux server. What do I need to configure to make the boxes name resolve to it's local IP?

Thanks.

share|improve this question
2  
I use mDNS. Since you have a mixed network, you may want to use WINS instead. –  Ignacio Vazquez-Abrams May 27 '12 at 22:27
    
Thanks, your comment lead me to this: serenux.com/2009/09/… which is exactly what I needed. :-) –  Anonymous May 27 '12 at 22:33
1  
I've copied the content from that URL to an answer here, for the sake of completeness. Please mark it as your accepted answer. –  user3463 May 28 '12 at 2:46
    
Done, thanks Randolph. –  Anonymous May 28 '12 at 6:16
add comment

1 Answer

up vote 2 down vote accepted

This is from the link provided by @Anonymous in the comments above. I have marked this answer as a community wiki.


Allowing Ubuntu to ping Windows NetBIOS names

Ubuntu is setup for Linux use, not Windows use, so we need to install a package that will allow Ubuntu to more readily mix in with Windows networks and use NetBIOS. This package is called "winbind".

  1. Open a terminal and type in the following at the terminal prompt:

    $ sudo apt-get install winbind
    
  2. Once installed, we need to tell Ubuntu to use WINS (as provided by winbind) to resolve host names. Type in:

    $ sudo gedit /etc/nsswitch.conf
    

    ... which will open the file into the Gnome Editor.

  3. Scroll down to the line that starts with “hosts:”. In Ubuntu Jaunty, it looks similar to this:

    hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4
    
  4. Add the word "wins" on the end of this line such that is now looks like:

    hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4 wins
    
  5. Save and exit the editor.

  6. Now let’s ping the name of our Windows box again.

    $ ping alyx
    

    ... and it now resolves!

Pat yourself on the back.

Allowing Windows to ping Ubuntu NetBIOS names

This is just one half of the equation. We now need to allow Windows to be able to ping Ubuntu PCs using its NetBIOS name. This requires Ubuntu to recognise and respond to that request. We need to setup a server daemon to do this. In Ubuntu, this particular server daemon is called Samba.

  1. Installing Samba is simplicity itself. Open a terminal and type in:

    $ sudo apt-get install samba
    
  2. Once that has finished, your Ubuntu PC will automagically respond to all NetBIOS queries for its hostname straight away, and that’s not just from Windows machines, but other Ubuntu machines (configured with the “winbind” package) as well.

  3. Pat yourself on the back again.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.