How can I use CLI to find my public IP address in IPv4 vs IPv6?
Hi NMGLUG folks, I am familiar with using https://ipchicken.com/ to find my public IP address using the browser. I would like to verify my public IP address using CLI as well as the browser. I found this page https://www.tecmint.com/find-linux-server-public-ip-address/ with 4 ways. The web page (last updated July 2023) shows that the results are in IPv4, but my results are in IPv6. I tried all four ways.
From the dig command, I get "bash: dig: command not found" From the host command, I get crap. When I remove the pipes I get stuff including an IPv6 address. From the wget and curl commands, Iget an IPv6 address. The IPv6 address from 5 variations of wget and curl are all the same. The IPv6 address from host is different. I like curl ifconfig.me because it is easy to remember.
Here's the problem. I would like to verify my public IP address using CLI as well as the browser.
From ipchicken in the broswer, I get IPv4. From the CLI, I get IPv6. How can I verify my public IP address?
In gratitude, LeRoy -- There is something glorious birthing within all of us. I am the Love of God, no matter what.BSA LeRoy Diener 213-LEROYIZ 213-537-6949 https://leroydiener.com
Hi, LeRoy, dig, host and curl all use a -4 flag to connect using IPv4. So: curl -4 icanhazip.com dig -4 +short myip.opendns.com @resolver1.opendns.com host -4 myip.opendns.com resolver1.opendns.com | grep "myip.opendns.com has" | awk '{print $4}' If you don't have dig, it's just an apt install away (or whatever equivalent command your distro uses). What "crap" do you get from the host command? All of these commands worked for me (and gave me IPv4 when I added -4). ...Akkana LeRoy Diener writes:
Hi NMGLUG folks,
I am familiar with using https://ipchicken.com/ to find my public IP address using the browser. I would like to verify my public IP address using CLI as well as the browser. I found this page https://www.tecmint.com/find-linux-server-public-ip-address/ with 4 ways. The web page (last updated July 2023) shows that the results are in IPv4, but my results are in IPv6. I tried all four ways.
From the dig command, I get "bash: dig: command not found" From the host command, I get crap. When I remove the pipes I get stuff including an IPv6 address. From the wget and curl commands, Iget an IPv6 address. The IPv6 address from 5 variations of wget and curl are all the same. The IPv6 address from host is different. I like curl ifconfig.me because it is easy to remember.
Here's the problem. I would like to verify my public IP address using CLI as well as the browser.
From ipchicken in the broswer, I get IPv4. From the CLI, I get IPv6. How can I verify my public IP address?
In gratitude, LeRoy -- There is something glorious birthing within all of us. I am the Love of God, no matter what.BSA LeRoy Diener 213-LEROYIZ 213-537-6949 https://leroydiener.com
_______________________________________________ nmglug mailing list nmglug@lists.nmglug.org http://lists.nmglug.org/listinfo.cgi/nmglug-nmglug.org
Thanks, Akkana. It works for me using the -4 flag. I did not find that before. Using debian, I typed in sudo apt install dig, and I got "Unable to locate package dig." That's not a big deal. The "crap" that I got from the host command with pipes was the word "Address." I guess that parsing didn't work correctly because the command with pipes assumed IPv4, but the output had IPv6. When I added the -4 flag, it came out perfect. Here's another thing interesting to note. When I ssh -D 8080 into a server: 1) I can use the foxyproxy plugin with firefox, and the public IP address in the browser shows up as the server IP. 2) in CLI, from the server prompt, it shows the server IP. 3) in the terminal from a different tab, from the local folder prompt, it shows the local IP. I was wondering if the server IP would carry over to a different terminal tab. My test so far says no. I wonder if there's a way (similar to the foxyproxy plugin) to get a local folder prompt to have a VPN-type functionality, to show the server IP. In gratitude, LeRoy -- There is something glorious birthing within all of us. I am the Love of God, no matter what.BSA LeRoy Diener 213-LEROYIZ 213-537-6949 https://leroydiener.com On Mon, 2024-05-13 at 17:57 -0600, Akkana Peck wrote:
Hi, LeRoy,
dig, host and curl all use a -4 flag to connect using IPv4. So:
curl -4 icanhazip.com
dig -4 +short myip.opendns.com @resolver1.opendns.com
host -4 myip.opendns.com resolver1.opendns.com | grep "myip.opendns.com has" | awk '{print $4}'
If you don't have dig, it's just an apt install away (or whatever equivalent command your distro uses).
What "crap" do you get from the host command?
All of these commands worked for me (and gave me IPv4 when I added - 4).
...Akkana
LeRoy Diener writes:
Hi NMGLUG folks,
I am familiar with using https://ipchicken.com/ to find my public IP address using the browser. I would like to verify my public IP address using CLI as well as the browser. I found this page https://www.tecmint.com/find-linux-server-public-ip-address/ w ith 4 ways. The web page (last updated July 2023) shows that the results are in IPv4, but my results are in IPv6. I tried all four ways.
From the dig command, I get "bash: dig: command not found" From the host command, I get crap. When I remove the pipes I get stuff including an IPv6 address. From the wget and curl commands, Iget an IPv6 address. The IPv6 address from 5 variations of wget and curl are all the same. The IPv6 address from host is different. I like curl ifconfig.me because it is easy to remember.
Here's the problem. I would like to verify my public IP address using CLI as well as the browser.
From ipchicken in the broswer, I get IPv4. From the CLI, I get IPv6. How can I verify my public IP address?
In gratitude, LeRoy -- There is something glorious birthing within all of us. I am the Love of God, no matter what.BSA LeRoy Diener 213-LEROYIZ 213-537-6949 https://leroydiener.com
_______________________________________________ nmglug mailing list nmglug@lists.nmglug.org http://lists.nmglug.org/listinfo.cgi/nmglug-nmglug.org
_______________________________________________ nmglug mailing list nmglug@lists.nmglug.org http://lists.nmglug.org/listinfo.cgi/nmglug-nmglug.org
participants (2)
-
Akkana Peck -
LeRoy Diener