Skip navigation
This discussion is archived

Can't ping hostname

8695 Views 15 Replies Latest reply: Aug 17, 2008 6:54 PM by baltwo RSS
1 2 Previous Next
electronic_cat Calculating status...
Currently Being Moderated
Aug 7, 2008 11:08 AM
I need help accessing a computer on my local network by
hostname. I can ping it by IP, but I can't ping it by hostname. The
computer shows on the Finder under "shared" with a name.
But I can't ping by this name. Any ideas of how to get ping working by hostname? Also, this IP is assigned via DHCP, so a static configuration is not an option.

I have tried adding ".local" to the hostname. Also, I have gone into Parallels and successfully pinged by hostname.

The computer is an electronic piano-- I cannot do any configuration. Also, I am writing documentation for a sourceforge Java program to access the piano. It will be easiest to tell people to check their finder, and enter that name or something derived from it into the program. That works for Windows, but I don't know what to tell them for the Mac. I also don't know an easy way to tell them to find the IP address.
iMac, Mac OS X (10.5.4)
  • baltwo Level 9 Level 9 (59,230 points)
    Currently Being Moderated
    Aug 7, 2008 2:29 PM (in response to electronic_cat)
    Can't help with the first part, but these two AS scripts get the internal and external IP address:

    get int IP add:

    *set ip_internal to do shell script "ipconfig getifaddr en0"*
    *display dialog "My internal IP address is: " & ip_internal*

    get ext IP add:

    *set myIP to word 25 of (do shell script "curl checkip.dyndns.org")*
    *display dialog "My external IP address is: " & myIP*
    24" iMac 2.8 Core 2 Ext 4 GB RAM/G4 450 MP Gigabit 1.5 GB RAM, Mac OS X (10.5.4), (G4 w/10.5.4/10.4.11/9.2.2)
  • baltwo Level 9 Level 9 (59,230 points)
    Currently Being Moderated
    Aug 7, 2008 10:10 PM (in response to electronic_cat)
    I don't know, since I don't piano nor do wireless or windoze.
    24" iMac 2.8 Core 2 Ext 4 GB RAM/G4 450 MP Gigabit 1.5 GB RAM, Mac OS X (10.5.4), (G4 w/10.5.4/10.4.11/9.2.2)
  • glsmith Level 3 Level 3 (875 points)
    Currently Being Moderated
    Aug 7, 2008 10:50 PM (in response to electronic_cat)
    "ifconfig" is a Unix command (the Mac being a Unix-base system), so most Unix systems will have the command available. The equivalent (or similar, at least) command in Windows is "ipconfig /all". This piano computer is likely based off of Unix or Windows, so just try both of those commands. Now, this piano computer may not make that command available to you, may have gone in an named the command something else, etc -- like baltwo, I have no idea what kind of system it actually is so can't say for sure if either command will work. You'll just have to experiment.

    As for your name issue. Your Mac needs to be able to resolve that IP address to a name -- you don't get that for free just because Bonjour shows you a name in the Finder. Typically name resolution is handled by DNS, or by local files on your Mac (/etc/hosts, for example). A DNS server is something typically provided to you via your ISP, or your company network, etc, and its IP is given to you via DHCP. My guess is that your Windows setup within Parallels has access to a DNS server and so can resolve the piano's name. Or, the piano is really a Windows box under the hood and so is able to communicate its hostname to your Parallels Windows box via something like WINS (another type of name resolution protocol that only Windows uses).
    Mac OS X (10.5.4)
  • glsmith Level 3 Level 3 (875 points)
    Currently Being Moderated
    Aug 8, 2008 11:30 AM (in response to electronic_cat)
    The Mac can do it; simply set it up in /etc/hosts. Windows isn't magic, so you could also take a look at its settings to see where it is getting its name resolution from...
    Mac OS X (10.5.4)
  • baltwo Level 9 Level 9 (59,230 points)
    Currently Being Moderated
    Aug 8, 2008 12:43 PM (in response to electronic_cat)
    Launch Network Utility->Ping->enter computer name (on my machine it's localhost), and click on Ping. I get PING localhost (127.0.0.1), implying to me that my IP is 127.0.0.1.
    24" iMac 2.8 Core 2 Ext 4 GB RAM/G4 450 MP Gigabit 1.5 GB RAM, Mac OS X (10.5.4), (G4 w/10.5.4/10.4.11/9.2.2)
  • glsmith Level 3 Level 3 (875 points)
    Currently Being Moderated
    Aug 8, 2008 2:11 PM (in response to electronic_cat)
    I can ping it by IP, but I can't ping it by hostname.


    This is what I was basing my information off of. Sounded like you did know the IP address. I guess you were talking about a different computer?

    If you can ping the hostname of the piano from Windows, then you know the IP address. Take that IP address and add it to /etc/hosts on the Mac and give it whatever name you want.

    If you're asking how would you find this information out in general, without having another machine that knows the IP/hostname map, and without having access to information on the "piano", then I don't know. As I said earlier, Windows is bound by many of the same rules as the Mac, so it has to be getting IP/name information from somewhere. It's either lmhosts (its /etc/hosts equivalent), WINS, DNS, etc. Again, take a look at some of the settings on your Windows box. Perhaps the DHCP server is giving out a DNS server but the Mac is ignoring it or is somehow not using it correctly. Perhaps it's using WINS (if so, then you can configure your Mac to use this protocol).
    Mac OS X (10.5.4)
  • baltwo Level 9 Level 9 (59,230 points)
    Currently Being Moderated
    Aug 8, 2008 3:36 PM (in response to electronic_cat)
    If you're writing the documentation, then you have access to the coders. Ask them.
    24" iMac 2.8 Core 2 Ext 4 GB RAM/G4 450 MP Gigabit 1.5 GB RAM, Mac OS X (10.5.4), (G4 w/10.5.4/10.4.11/9.2.2)
  • glsmith Level 3 Level 3 (875 points)
    Currently Being Moderated
    Aug 8, 2008 4:02 PM (in response to electronic_cat)
    Yes, it's clearer now, thanks

    There is no easy thing for you to do, I'm afraid. I'm not exactly sure how the Windows box is mapping the IP and name (possibly WINS, maybe something within CIFS that I'm not familiar with). It's likely that you could eventually get your Mac to do the same thing as the Windows box, but it will be complicated. Windows was designed to exist in a Windows network (which is what you've got with the piano, even though it may be based off Linux), and it's taking advantage of that. This is a case where the Windows experience is certainly more "friendly" than the Mac...
    Mac OS X (10.5.4)
1 2 Previous Next

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.