How to configure 'local' DNS?

1

2

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.

Anonymous

Posted 2012-05-27T22:23:54.370

Reputation: 1 731

2I use mDNS. Since you have a mixed network, you may want to use WINS instead. – Ignacio Vazquez-Abrams – 2012-05-27T22:27:31.450

Thanks, your comment lead me to this: http://www.serenux.com/2009/09/howto-configure-ubuntu-to-be-able-to-use-and-respond-to-netbios-hostname-queries-like-windows-does/ which is exactly what I needed. :-)

– Anonymous – 2012-05-27T22:33:56.760

1I've copied the content from that URL to an answer here, for the sake of completeness. Please mark it as your accepted answer. – None – 2012-05-28T02:46:07.927

Answers

2

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.

user3463

Posted 2012-05-27T22:23:54.370

Reputation: