7

I installed Ubuntu 12.04 on a Virtual Machine (Virtualbox). The network adapter is attached using bridged adapter.

I can ping the guest OS by IP but I can't ping it via hostname.

I already installed Samba and winbind. I also edited /etc/nsswitch.conf to and 'wins'.

Does the settings takes time to take into effect? What other things can I try to be able to ping the Ubuntu OS by hostname?

Thanks!

5
  • Did you configure Samba with the desired machine name and make sure nmbd is running? Commented May 20, 2013 at 12:31
  • if you are using bridged networking, and you only have one internal network, you do not need wins. are UDP 137 and 139 on the ubuntu box accessible to the host? the netbios-ns service should run on these ports for broadcast name resolution. Commented May 20, 2013 at 12:56
  • @IgnacioVazquez-Abrams No. Any guide on how to configure Samba and what to put in it? How can I check if nmbd is running?
    – Ian
    Commented May 20, 2013 at 13:35
  • @FrankThomas I turned off the firewall. I'm assuming 137 and 139 are open. Also, I'm not sure why bridged networking and "internal network" matters here?
    – Ian
    Commented May 20, 2013 at 13:37
  • 1
    using a bridged network connection, your guest appears on teh same network as your host and your other equipment. NetBIOS was originally a LAN protocol that could not cross routers, so if your network was divided into subnets or consisted of multiple networks, you needed a WINS server to enable functionality across the whole enterprise. nowadays, with NetBIOS over TCP/IP, its no longer necessary to use a wins server to broker in this fashion, and since you only have the one subnet anyway, WINS is doubly meaningless. Commented May 20, 2013 at 14:24

4 Answers 4

5

Not sure why Ubuntu is different but this works with debian:

Install debian using bridged networking

Install Samba

As soon as Samba is installed and running the guest machine can be pinged by hostname. I'm using a Windows 7 host and a Debian 7 LXDE guest.

1
  • Just tried the same with Ubuntu Server 12.04.2 and it works the same. I'm able to ping the guest by hostname. No editing of any config files necessary. So in theory it should be pretty straightforward. Possibly some sort of firewall/AV issue on your host.
    – BJ292
    Commented May 21, 2013 at 20:13
2

You need name resolution. Either static (lmhosts, hosts) or dynamic (wins, dns). See this short ancient write-up I did years ago The lmhosts and hosts files for a quick overview.

You didn't mention which version of Windows you're running but do note that a "homegroup" is not a workgroup (or a domain). And a "homegroup" is only valid between Windows 7 (and I presume 8) systems so it is quite limiting and should be avoided.

Winbind allows Samba to authenticate via an external PDC or AD and should not be confused with WINS. To use WINS you need a WINS server (!). For Samba to act as the WINS server the smb.conf global section needs a wins support = yes entry, plus do not use a wins server = entry (this entry is for directing Samba to use another WINS server and not be one itself).

Other systems need to register with the WINS database in order for it to be effective, easily accomplished via DHCP but can be manually configured as well.

You can easily check if your systems are registering themselves in the WINS database by examining the wins.dat file. Location may be distro dependent but mine is at /var/lib/samba/wins.dat.

1

If you have any apple device and, as such, installed iTunes on your windows PC, you have this little thing called a mDNS responder installed on windows. Ubuntu also has one (Avahi) which is free, opensource, lennartful and more importantly: installed by default. Your windows should then be able to resolve your Ubuntu hostname provided you end it with .local, e.g. ubuntu.local if your hostname is ubuntu. The name resolution happens using multicast DNS, which uses UDP on port 5353 and group 224.0.0.251.

Ubuntu should also be able to see your Windows that way (try avahi-browse -a or avahi-discover)

1
  • Just a note for anyone else who beat their heads against this: Avahi won't work between subnets, and it's common in corporate networks to have wireless/ethernet on separate subnets.
    – detly
    Commented Jan 2, 2014 at 2:04
0

I was working on a solution with Avahi, but Avahi only discovers service over the network. Maybe also allow to Apple and Linux devices discover Linux hosts. But Windows is a different solution. Windows uses NetBios over TCP/IP, hopefully, so, for Linux host expose the hostname to Windows host we have to start nmbd and smbd, I mean samba. In latest Arch distribution it’s simple:

sudo pacman -S samba

then

cp /etc/samba/smb.conf.default smb.conf

or something like that then

sudo systemctl enable smbd
sudo systemctl start smbd
sudo systemctl enable nmbd
sudo systemctl start nmbd

Make sure to set up your desired hostname:

hostnamectl set-hostname myhostname

And you are done. In Windows simply say

ping myhostname

and voilà!

You must log in to answer this question.

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