Can't ping by hostname of CentOS running on VM from Windows, but can from Mac

15,097

Solution 1

You need to ensure that Samba, the Linux implementation of Windows' networky stuff, is properly configured and running.

Can you check whether nmbd (part of Samba) is running on the CentOS machine?

In a terminal, the command ps -A will give you a list of running processes.

Also have a look at /etc/samba/smb.conf to make sure it all looks sensible.

Here is a page about setting up name resolution in a mixed environment.

Solution 2

How is your DNS setup?

On your Mac is there a search domain set in /etc/resolv.conf?

Normally you have a domain in addition to the hostname. The search option will set that so that it will append the default domain to a bare hostname. I'm not sure that's how it works in windows, but that's how Linux and Mac do it.

For example, inside my LAN I use .home as the domain and run a local DNS server that intercepts all .home requests and maps them to local IPs. My /etc/resolv.conf files have search home in them.

Share:
15,097

Related videos on Youtube

Zack The Human
Author by

Zack The Human

A little of this, a little of that.

Updated on September 17, 2022

Comments

  • Zack The Human
    Zack The Human over 1 year

    I have an instance of CentOS running in VMware on a Windows Server 2003 machine on my home network.

    CentOS hostname: varia
    Windows XP hostname: friend

    From my Windows XP machine I am unable to ping the CentOS instance by its hostname. I can only ping it by IP address.

    From my Mac I am able to ping the CentOS instance by its hostname.

    From the CentOS instance I can ping my Windows XP machine.

    What I have tried so far:

    • The firewall on my Windows XP machine it turned off.
    • There is no entry for this host in my hosts file.
    • I ran ipconfig /flushdns on friend.

    When I attempt to ping the CentOS instance I receive the following error:

    C:\Documents and Settings\Zachary>ping varia
    Ping request could not find host varia. Please check the name and try again.

    Update: nslookup varia results:

    C:\Documents and Settings\Zachary>nslookup varia
    *** Can't find server name for address 192.168.1.1: Non-existent domain
    *** Default servers are not available
    Server:  UnKnown
    Address:  192.168.1.1
    
    Name:    varia
    Address:  192.168.1.149

    The resulting ip address is correct: 192.168.1.149 but pinging is still not possible.

  • Zack The Human
    Zack The Human over 14 years
    Thanks for the suggestion, I updated the original question with the nslookup results.
  • prestomation
    prestomation over 14 years
    Please try to avoid using WINS, do the world a favor.
  • Zack The Human
    Zack The Human over 14 years
    This is on my home network and I do not have a domain controller (as far as I know). I have three WRT54G routers conntected to each other through the house. Only one of the routers has DHCP enabled as the other routers serve as wireless access points. Could there be a domain I don't know about?
  • Zack The Human
    Zack The Human over 14 years
    If I disable WINS, what do I use as an alternative?
  • Brian C. Lane
    Brian C. Lane over 14 years
    Ok, that's why you can't ping. You haven't setup DNS. The samba answer may work for you, but really, you should be using DNS style domains not the abomination that Windows tried to create.
  • Zack The Human
    Zack The Human over 14 years
    So, samba wasn't installed. I installed it via "yum install samba" and set my workgroup in smb.conf. I think that's progress but it hasn't yet solved my problem. Brian brings up a good point about my lack of a DNS server so I will try to resolve that first.
  • CarlF
    CarlF over 14 years
    Samba has nothing to do with the question, which is about getting the hostname of a real XP box recognized.
  • Neal
    Neal over 14 years
    nmbd is part of the samba suite and it is used for NetbIOS in Linux. Therefore if Zack is using NetBIOS/WINS (and if he wasn't he'd know it) Samba is relevant. Whether NetBIOS/WINS should be used is a separate issue.
  • Neal
    Neal over 14 years
    In this case Zack has a working home network (presumably a small number of machines), to which he is adding a Virtual Machine. The VM is having trouble joining the existing infrastructure. The broadcast messages and browser elections are not exactly going to swamp the network: therefore I think that in this case the VM should fit in with the rest of the system. I am not saying that WINS is a good system, and would definitely not use it in a proper network, but I think its use is probably ok in this situation.
  • prestomation
    prestomation over 14 years
    From you Question: Server: UnKnown Address: 192.168.1.1 From other comments it looks like this is a WRT54G which I don't believe updates its DNS from DHCP, but it looks like its returning the correct name of your server. Are you running stock firmware on the router?
  • Zack The Human
    Zack The Human over 14 years
    Installing samba seems to have done the trick. I also took Brian's advice and explored some of the DNS settings of my router, adding a a domain name. I am able to ping varia from friend now. Thanks very much!
  • Zack The Human
    Zack The Human over 14 years
    Brian, thank you for your advice. I added a domain name in my router's DNS settings and can ping all of my home PCs using that domain name as a suffix.