6

[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!

1
  • Ask one question at a time, please.
    – horIzoN
    Mar 10, 2013 at 16:52

2 Answers 2

3

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/

1
  • 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, 2014 at 19:56
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .