Today we’re going to have a fun article, one easy enough for everyone, where we talk about how to ping with IPv4 or IPv6. You have an option and you get to decide if you want to use IPv4 or IPv6. It’s just a matter of a couple of different flags, so a new user can manage this one.
An IP address is a numerical address assigned to computers, it’s a way to address those computers – meaning to send and receive data. While you normally don’t do much with individual IP addresses, they’re what runs in the background and make this whole networking thing happen.
We had IPv4 and we’re slowly moving to IPv6. We’ve long since run out of IPv4 addresses (though they’re still widely used, often for legacy reasons), but they’re 32-bit addresses while IPv6 is a 128-bit address.
If you’re not good at math:
IPv4 supports 4,294,967,296 addresses.
IPv6 supports 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses.
See the difference?
There was an IPv5 but IPv6 was created before IPv5 was made a standard and so there’s no IPv5 standard. The reasons for this are fairly obvious. After all, IPv6 supports a metric buttload of devices. That’s a seriously big number that we write as 128-bit (2128).
Every human on the planet can have all the addresses they could use, which is important when you consider stuff like IoT (internet of Things) where your home may contain many connected devices in the ‘smart home’ sense of things. We decidedly do not have enough IPv4 addresses for that.
Well, the truth is that we kind of suck at migrating to IPv6. Wh you ping localhost, you’re probably going to see 127.0.0.1
. If you’re using IPv6 then you’d see ::1
. If there’s any place where we might want to use IPv6, it’s in the home – with all these connected devices.
Even if you don’t have a smart home, smart cameras, a doorbell camera, various routers, a connected refrigerator, or the like, odds are that you’ve got more than one connected device. Fortunately, you still have IPv4 going on and they have some reserved IP addresses to work with. So, you’re good with that – as a general rule.
So, we still use IPv4. Should we? Probably not. But, there are legacy reasons for IPv4 to exist. That shouldn’t include the public web (I don’t believe) but it does. The adoption rate for IPv6 is really slow. After all, IPv6 launched on June 6, 2012. We’ve had more than a decade to move to IPv6!
I am no help… I am just as guilty as anyone else. When I order a VPS, I ensure that I have a dedicated IPv4 IP address. Why? Legacy reasons! Well, more out of habit. I’m quite sure I could migrate to IPv6 by just changing a few things in my process.
Anyhow… This is a long intro!
What is this ‘ping’ thing? Well, ping is you sending a packet to an address and then waiting for the response. You ping a server and the server effectively sends a pong back! It’s ping pong! Ha! I crack me up.
You send a ping and wait for an acknowledgment from the server when it sends a packet back to your computer. Ping doesn’t always work because you can decide to ignore them (perhaps a future article) and not send a response. Fortunately, the easy-to-remember domain names (remember, they respond on an IP address, they are resolved to an IP address) respond to pings. I use ‘google.com’ as a general rule.
If you check the man page, ping describes itself like this:
ping – send ICMP ECHO_REQUEST to network hosts
We’ll be using ‘localhost’ (your computer) for this article, for the record. I think that’s a better choice than having a bunch of my readers ping any specific website. It should be effective on every modern computer with a modern operating system.
Man, this is a long intro. I’m sure I’ve forgotten something…
Ping With IPv4 or IPv6:
By now you know the routine. You’ll be using a terminal for this exercise. If you don’t know how to open your terminal, try pressing
Believe it or not, this may also work for other operating systems. I have it on good authority that this works with Windows, where they’ll be using ‘cmd.exe’ as memory serves. From what I can tell, this is also true for MacOS users. It’s a fair assumption to say this also works with the operating systems in the BSD family. Huh… Imagine that?!?
Anyhow, you can try the following command:
1 | ping <domain_name> |
That will resolve to an IP address, be it IPv4 or IPv6. You can ping a specific IP address easily enough. To ping an IP address, the syntax is:
1 | ping <IP_address> |
The results of those commands will be either an IPv4 or IPv6 address. If you’re new and don’t know the difference, an IPv4 address uses periods. It’d look like 127.0.0.1
. An IPv6 address uses colons. It’d look like 2607:f8b0:4006:817::200e
. It’s easy to tell the difference.
Now, if you want to use IPv4, the command would be like this:
1 | ping <domain_name> -4 |
If you want to use IPv6, the command would be like this:
1 | ping <domain_name> -6 |
NOTE: This is likely to work in many instances but, due to the lack of participation, you might find that some sites don’t support IPv6. On the other hand, you might find some sites don’t support IPv4. If one doesn’t work, then you have the other as an option.
Closure:
Well, if you ever wanted to know how to ping with IPv4 or IPv6, you now know. Are there good reasons? Well, there’s still some legacy stuff out there and we’ve poorly adopted IPv6. For all intents and purposes (intensive porpoises) we have limitless IP addresses available with IPv6.
We will move in that direction, just like we’ve currently moved in that direction. Adoption will continue and adoption rates may speed up. After all, we’ve had more than a decade to adopt. The specification is well-supported and it’s almost certainly the future of networking. Or so I’d like to believe…
Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.