Ping With IPv4 Or IPv6

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 CTRL + ALT + T and (in most cases) and your terminal should pop right up! It’s magic!

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:

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:

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:

If you want to use IPv6, the command would be like this:

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.

Better Network Diagnostics With MTR

This article will show you how to get better network diagnostics with MTR, a tool called “My Traceroute” that combines both traceroute and ping into a single tool. MTR is a pretty handy tool that’s likely installed by default and a tool that even regular users should have in their toolbox.

You may remember that I wrote an article about traceroute. If you don’t know what traceroute is, it’d be in your best interest to go read that article, as I will not really be duplicating the work that went into writing that article.

As of yet, I have not yet written an article about ping. Ping is a terminal-based tool, used to time how long it takes for your device to send and receive packets to and from another device. It’ll also tell you if there are packets being dropped along the way. You can use it pretty easily. Here’s a very basic ping command:

(You can use CTRL + C to stop the running process.)

The output from that command is pretty self-explanatory. The numbers you’re probably most interested in are all the way on the right, and denote how long it took for a round-trip message to complete in milliseconds. Online gamers are often interested in their ping times. This is because a higher ping may mean they may lag behind their competitors. In this case, lower is better.

Well, MTR combines the two, traceroute and ping. It’s pretty awesome. You’ll see!

Network Diagnostics With MTR:

So long as you understand both ping and traceroute, there’s not much more this article can teach you. MTR is pretty basic in its output, easily understood by all but the novice users. Anyone with any networking history will immediately grasp the importance of MTR.

MTR isn’t a new tool, having been around since 1997. I won’t be covering how to install it. MTR’s likely already installed. If not, it’ll be easy enough to install it. If anything, this article is largely just an excuse to make people aware of it.

This article requires an open terminal. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

Now, with your terminal open, try:

It should look something like this:

mtr in action
I really don’t need to explain the columns, do I? I’m sure you can figure it out!

There’s some options while it is running. The H, D, R, O, and Q keys all have functions, listed right there after “Keys:”! There are a few options when starting MTR, a whole lot of options. You can find those options by running man mrt. I’ll cover a couple of interesting options here.

If you want to limit the number of pings, you use the -c flag and then add the number. In the example below, I have chosen 5.

You can also just show IP addresses, not resolving the hostname. Like so:

If you want to show both IP addresses and resolved hostnames, the flag is -b.

There’s more that you can do with it, but mostly you can use it to find where along the line the traffic stops. If it’s on your end, you get to do something about it. Otherwise, I suppose you’re at the whim of the MITM. So, give the man pages a look and let me know in a comment if you already use this tool and how you use it.

Closure:

And there’s another article. Woohoo! It’s not just another article, but it’s an article about doing network diagnostics with MTR. It’s not as hard as one might think to come up with ideas for articles. Sometimes, I just use a tool and then realize it may make for a good article. That’s what happened in this case.

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 own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.