Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

[I've searched a LOT for a solution to this issue, but if someone wants to point me to a related question and/or answer, please do!]

I have a local network over a broadband router with 3 Windows 7 computers and an Ubuntu VirtualBox VM on a Windows host. I can access the Windows computers from one another just fine, and I've configured Samba on Ubuntu so I can see and access the my-ubuntu computer from the Windows machines as well.

The problem is accessing Windows machines from Ubuntu by hostname. I can ping the Windows machines from Ubuntu by IP address, but I can't do a lookup by their names, win7-1, win7-2, win7-3.

I.e., smbclient -L 192.168.2.5 is successful, but smbclient -L win7-1 is not. smbtree sometimes shows the following, sometimes doesn't:

WORKGROUP
    \\MY-UBUNTU
    \\WIN7-1
    \\WIN7-2
    \\WIN7-3
  • For the sake of debugging I've disabled all firewalls and enabled all read/write permissions everywhere (since they're all just my machines).
  • I also know I can add entries to /etc/hosts for each individual machine, but I would like to learn how to get hostname lookup working dynamically

Question

How can I set up what I want to work? Ubuntu is running in a VirtualBox VM on a Windows host with Bridged networking set up, so I can't run a DNS server within Ubuntu (or can I?).

I think other newbies would also really appreciate a high-level overview, of where the DNS server should be, how the Ubuntu machine should use it, whether I need to change anything in the Windows machines' settings..I'm confused by all these packages and settings I've come across - resolv, libnss-mdns, avahi, dnsmasq, winbind..I just want to install and use what I need!

share|improve this question
    
Ask one question at a time, please. –  nerof61 Mar 10 '13 at 16:52
    
I've edited it to make it more clear, thanks! –  Jim Connors Mar 10 '13 at 17:19

2 Answers 2

All you have to do is:

sudo gedit /etc/nsswitch.conf

change the line that says

hosts: files dns

to this:

hosts: files wins dns

(order does matter)

finally, you need to install winbind

sudo apt-get install winbind

Source: http://that-matt.com/2009/12/how-to-get-ubuntu-to-ping-a-windows-hostname/

share|improve this answer
    
Being a total newbie to Ubuntu, what are the downsides of installing this package and it's dependencies? Will it kick of any additional resource intensive services etc that steels bandwidth etc? –  Daniel Aug 18 at 19:56

The Windows machines are probably using WINS to resolve one another's names. In that case you will have to configure your Ubuntu machine to talk WINS too.

sudo apt-get install winbind
sudo gedit /etc/nsswitch.conf

Add wins to the hosts: line.

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 wins
share|improve this answer

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.