In the ever-evolving world of internet technology, keeping track of your public IPv6 address is crucial for various networking tasks. For Linux enthusiasts or professionals, knowing how to quickly retrieve this information via the command line is a valuable skill. In this blog post, we’ll walk through the steps to check your public IPv6 IP address from the Linux command line using Bash.
Step 1: Open Your Terminal
The first step is to open the terminal on your Linux machine. You can usually find it in your list of applications, or you can press Ctrl + Alt + T
on most distributions to open it directly.
Step 2: Use a Command-Line Tool
There are several command-line tools available for checking your public IPv6 address. One of the simplest and most effective is curl
. Curl is a powerful tool used to transfer data from or to a server and is widely used for various network-related tasks.
Step 3: Run the Curl Command
To retrieve your public IPv6 address, run the following command in your terminal:
curl -6 icanhazip.com
This command tells curl
to fetch the content from icanhazip.com
, a website that returns the IP address of the client making the request. The -6
flag forces curl
to use IPv6.
Step 4: Interpret the Output
After running the command, you should see your public IPv6 address displayed in the terminal. It will typically look something like this:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
This string of numbers and letters is your unique public IPv6 address.
Conclusion
Checking your public IPv6 IP address using the Linux command line is a quick and efficient process. Whether you’re a system administrator, a developer, or just a Linux enthusiast, knowing how to perform this task is incredibly useful. Remember, while icanhazip.com
is a reliable source, there are other similar services available. Feel free to experiment with different tools to find the one that best suits your needs.
Happy networking!
$ curl -6 icanhazip.com
curl: (7) Couldn’t connect to server
Running on a Linux dedicated machine hosted in London on a reliable network on a working production machine.
This probably means something is not right with you machine’s IPv6 setup as it can’t seem to connect to the IPv6 address of icanhazip.com.
First check if the hostname icanhazip.com resolves to a valid IPv6 address. Should be something like:
> host icanhazip.com
icanhazip.com has address 104.16.185.241
icanhazip.com has address 104.16.184.241
icanhazip.com has IPv6 address 2606:4700::6810:b8f1
icanhazip.com has IPv6 address 2606:4700::6810:b9f1
Then check if it is reachable:
> ping6 2606:4700::6810:b8f1
PING 2606:4700::6810:b8f1(2606:4700::6810:b8f1) 56 data bytes
64 bytes from 2606:4700::6810:b8f1: icmp_seq=1 ttl=53 time=1.42 ms
64 bytes from 2606:4700::6810:b8f1: icmp_seq=2 ttl=53 time=1.38 ms
^C
— 2606:4700::6810:b8f1 ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 1.383/1.402/1.421/0.019 ms