Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Can't ping hostname

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)

Posted on Aug 7, 2008 11:08 AM

Reply
15 replies

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*

Aug 7, 2008 5:20 PM in response to baltwo

Thanks for helping. Would ifconfig get the IP address of the piano's computer? That is what I need. I read that bonjour was supplying the Shared list to Finder, so Bonjour must know the IP. I don't want the users to have to download an additonal program. (I know you were not suggesting that, but I found something called Bonjour Browser that might or might not work, but is not a good option.)

I do know a roundabout way for them to get the IP with some software that comes with the piano, but I can't figure out why the name does not work when it does in Windows and even in Parallels on the same machine. I want to keep it as simple as possible.

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).

Aug 8, 2008 12:07 PM in response to glsmith

I'm not getting it. The users I am writing documentation for want to use the hostname (as seen under "shared" in finder) as an address of a "black box" piano/computer on their network to access the piano from a Java program running on the Mac. They do not know the IP address. I think you are telling me to put the IP address in /etc/hosts. But I don't know the IP address. That is my point. Also, this IP is assigned via DHCP. On Windows, the Java program will accept the hostname which shows up in the list of network connections. That same hostname does not work on the Mac. I thought there would be some utility I could run that would input a hostname and give me an IP address. On Windows I can ping the hostname and get the IP. I can't do that on the Mac, it can't reach the piano via hostname. My Windows system under Parallels is as vanilla as they come. Nothing was set up special. In this case Windows "just works".

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).

Aug 8, 2008 3:22 PM in response to glsmith

My apologies, my lack of knowledge is making it hard for me to express myself. I am trying to write documentation for a Java program that runs on the Mac and the PC. The program is used by computer/network novices, like me. On the PC, they can input the name they see in My Network Places. On the Mac, what seems to be the equivalent, Shared, and in fact shows the same name as the PC, does not work. It isn't the Java program because Ping by name works on the PC and not the Mac. I was hoping there would be some option on the Mac I could set and suddenly everything would start working.

I have a program furnished by the Piano Manufacturer, which as a side benefit gives the IP, but since the IP may change from day to day, it will mean that they may have to venture to this not-so-friendly program from time to time. I was hoping to find a way to access the piano by name.

I realize my original question did not focus well on my needs, but I hope now my problem is more clearly expressed. Your answer gave me lots of good information, but did not solve the immediate problem.

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...

Can't ping hostname

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.