Nate Silva

Dec 28 2010

Using ping6 on Mac OS X or Linux

The problem

In experimenting with IPv6, one of the first things I tried was to ping computers on my LAN using the ping6 command. For example, this pings the loopback interface (equivalent of 127.0.0.1):

ping6 ::1

To see your IPv6 address(es), go to a Terminal prompt and type ifconfig. If you try to ping6 any address—even your own link-local address that starts with fe80::—you’ll get the following error:

ping6: UDP connect: No route to host

Or on Linux:

connect: Invalid argument

The solution

The solution is to pass the -I command-line argument. Give it the name of the interface you want to ping from. For example, the first ethernet port on Linux is usually called eth0. On a Mac, it’s usually en0 or en1.

ping6 -I en1 fe80::…

Windows

Note that Windows doesn’t have this problem. On Windows, you use the regular ping command for both IPv4 and IPv6 addresses, and it automatically detects which interface to use.

Firewall issue

If you continue to have problems, make sure you can ping6 your own IPv6 address. This is the address that starts with fe80:: and can be seen by typing ifconfig. Try to ping that from the same interface that the address is assigned to (you’ll see the interface name, usually en0 or en1 shown in ifconfig).

And make sure your firewall is not blocking ping requests. The Mac OS X firewall will not respond to pings if “Stealth Mode” is turned on.

Page 1 of 1