Re: How can I use CLI to find my public IP address in IPv4 vs IPv6?
LeRoy Diener <[email protected]> Mon, 13 May 2024 21:06:28 -0500
| Newsgroups | gmane.org.user-groups.linux.nmglug |
|---|---|
| Message-ID | <2bb38dc63f9ef7dc438593367449d1133fdc6edc.camel@choosetherightside.com> |
--===============4835802094959052050==
Content-Type: multipart/alternative; boundary="=-lMWTZliQNSr5Y5megn3o"
--=-lMWTZliQNSr5Y5megn3o
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
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
> > [email protected]
> > http://lists.nmglug.org/listinfo.cgi/nmglug-nmglug.org
>
> _______________________________________________
> nmglug mailing list
> [email protected]
> http://lists.nmglug.org/listinfo.cgi/nmglug-nmglug.org
--=-lMWTZliQNSr5Y5megn3o
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
<html><head></head><body><div>Thanks, Akkana.</div><div><br></div><div>It w=
orks for me using the -4 flag. I did not find that before.</div><div>Using =
debian, I typed in sudo apt install dig, and I got "Unable to locate packag=
e dig." That's not a big deal.</div><div>The "crap" that I got from the hos=
t command with pipes was the word "Address." I guess that parsing didn't wo=
rk correctly because the command with pipes assumed IPv4, but the output ha=
d IPv6. When I added the -4 flag, it came out perfect.</div><div><br></div>=
<div>Here's another thing interesting to note.</div><div>When I ssh -D 8080=
into a server:</div><div>1) I can use the foxyproxy plugin with firefox, a=
nd the public IP address in the browser shows up as the server IP.</div><di=
v>2) in CLI, from the server prompt, it shows the server IP.</div><div>3) i=
n the terminal from a different tab, from the local folder prompt, it shows=
the local IP.</div><div><br></div><div>I was wondering if the server IP wo=
uld carry over to a different terminal tab. My test so far says no. I wonde=
r 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.</div><div><=
br></div><div>In gratitude,<br>LeRoy</div><div><span><pre>-- <br></pre><spa=
n style=3D"caret-color: rgb(46, 52, 54); color: rgb(46, 52, 54); font-famil=
y: Cantarell; font-size: 18.66666603088379px; font-style: normal; font-vari=
ant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: aut=
o; text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: auto; word-spacing: 0px; -webkit-tap-highlight-color: rgba(=
0, 0, 0, 0.4); -webkit-text-stroke-width: 0px; background-color: rgb(255, 2=
55, 255); text-decoration: none; display: inline !important; float: none;">=
There is something glorious birthing within all of us.</span><br style=3D"c=
aret-color: rgb(46, 52, 54); color: rgb(46, 52, 54); font-family: Cantarell=
; font-size: 18.66666603088379px; font-style: normal; font-variant-caps: no=
rmal; font-weight: normal; letter-spacing: normal; orphans: auto; text-alig=
n: start; text-indent: 0px; text-transform: none; white-space: normal; wido=
ws: auto; word-spacing: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0.4=
); -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); te=
xt-decoration: none;"><span style=3D"caret-color: rgb(46, 52, 54); color: r=
gb(46, 52, 54); font-family: Cantarell; font-size: 18.66666603088379px; fon=
t-style: normal; font-variant-caps: normal; font-weight: normal; letter-spa=
cing: normal; text-align: start; text-indent: 0px; text-transform: none; wh=
ite-space: normal; word-spacing: 0px; -webkit-tap-highlight-color: rgba(0, =
0, 0, 0.4); -webkit-text-stroke-width: 0px; text-decoration: none; float: n=
one; display: inline !important; background-color: rgb(255, 255, 255);">I a=
m the Love of God, no matter what.</span><div><span style=3D"background-col=
or: rgb(255, 255, 255);">BSA<br style=3D"caret-color: rgb(46, 52, 54); colo=
r: rgb(46, 52, 54); font-family: Cantarell; font-size: 18.66666603088379px;=
font-style: normal; font-variant-caps: normal; font-weight: normal; letter=
-spacing: normal; text-align: start; text-indent: 0px; text-transform: none=
; white-space: normal; word-spacing: 0px; -webkit-tap-highlight-color: rgba=
(0, 0, 0, 0.4); -webkit-text-stroke-width: 0px; text-decoration: none;"><sp=
an style=3D"caret-color: rgb(46, 52, 54); color: rgb(46, 52, 54); font-fami=
ly: Cantarell; font-size: 18.66666603088379px; font-style: normal; font-var=
iant-caps: normal; font-weight: normal; letter-spacing: normal; text-align:=
start; text-indent: 0px; text-transform: none; white-space: normal; word-s=
pacing: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0.4); -webkit-text-=
stroke-width: 0px; text-decoration: none; float: none; display: inline !imp=
ortant;">LeRoy Diener</span></span><br style=3D"caret-color: rgb(46, 52, 54=
); color: rgb(46, 52, 54); font-family: Cantarell; font-size: 18.6666660308=
8379px; font-style: normal; font-variant-caps: normal; font-weight: normal;=
letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px=
; text-transform: none; white-space: normal; widows: auto; word-spacing: 0p=
x; -webkit-tap-highlight-color: rgba(0, 0, 0, 0.4); -webkit-text-stroke-wid=
th: 0px; background-color: rgb(255, 255, 255); text-decoration: none;"><spa=
n style=3D"caret-color: rgb(46, 52, 54); color: rgb(46, 52, 54); font-famil=
y: Cantarell; font-size: 18.66666603088379px; font-style: normal; font-vari=
ant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: aut=
o; text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: auto; word-spacing: 0px; -webkit-tap-highlight-color: rgba(=
0, 0, 0, 0.4); -webkit-text-stroke-width: 0px; background-color: rgb(255, 2=
55, 255); text-decoration: none; display: inline !important; float: none;">=
213-LEROYIZ</span><br style=3D"caret-color: rgb(46, 52, 54); color: rgb(46,=
52, 54); font-family: Cantarell; font-size: 18.66666603088379px; font-styl=
e: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: =
normal; orphans: auto; text-align: start; text-indent: 0px; text-transform:=
none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-tap-hi=
ghlight-color: rgba(0, 0, 0, 0.4); -webkit-text-stroke-width: 0px; backgrou=
nd-color: rgb(255, 255, 255); text-decoration: none;"><span style=3D"caret-=
color: rgb(46, 52, 54); color: rgb(46, 52, 54); font-family: Cantarell; fon=
t-size: 18.66666603088379px; font-style: normal; font-variant-caps: normal;=
font-weight: normal; letter-spacing: normal; orphans: auto; text-align: st=
art; text-indent: 0px; text-transform: none; white-space: normal; widows: a=
uto; word-spacing: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0.4); -w=
ebkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-de=
coration: none; display: inline !important; float: none;">213-537-6949</spa=
n><div style=3D"caret-color: rgb(46, 52, 54); color: rgb(46, 52, 54); font-=
family: Cantarell; font-size: 18.66666603088379px; font-style: normal; font=
-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans=
: auto; text-align: start; text-indent: 0px; text-transform: none; white-sp=
ace: normal; widows: auto; word-spacing: 0px; -webkit-tap-highlight-color: =
rgba(0, 0, 0, 0.4); -webkit-text-stroke-width: 0px; background-color: rgb(2=
55, 255, 255); text-decoration: none;"><a href=3D"https://leroydiener.com/"=
title=3D"Click to open https://leroydiener.com/">https://leroydiener.com</=
a><br></div></div></span></div><div><br></div><div>On Mon, 2024-05-13 at 17=
:57 -0600, Akkana Peck wrote:</div><blockquote type=3D"cite" style=3D"margi=
n:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>Hi, LeRo=
y,<br></div><div><br></div><div>dig, host and curl all use a -4 flag to con=
nect using IPv4. So:<br></div><div><br></div><div>curl -4 icanhazip.com<br>=
</div><div><br></div><div>dig -4 +short myip.opendns.com @resolver1.opendns=
.com<br></div><div><br></div><div>host -4 myip.opendns.com resolver1.opendn=
s.com | grep "myip.opendns.com has" | awk '{print $4}'<br></div><div><br></=
div><div>If you don't have dig, it's just an apt install away (or whatever =
equivalent command your distro uses).<br></div><div><br></div><div>What "cr=
ap" do you get from the host command?<br></div><div><br></div><div>All of t=
hese commands worked for me (and gave me IPv4 when I added -4).<br></div><d=
iv><br></div><div> ...Akkana<br><=
/div><div><br></div><div>LeRoy Diener writes:<br></div><blockquote type=3D"=
cite" style=3D"margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-lef=
t:1ex"><div>Hi NMGLUG folks,<br></div><div><br></div><div>I am familiar wit=
h using <a href=3D"https://ipchicken.com/">https://ipchicken.com/</a>&=
nbsp;to find my public IP<br></div><div>address using the browser.<br></div=
><div>I would like to verify my public IP address using CLI as well as the<=
br></div><div>browser.<br></div><div>I found this<br></div><div>page <=
a href=3D"https://www.tecmint.com/find-linux-server-public-ip-address/">htt=
ps://www.tecmint.com/find-linux-server-public-ip-address/</a> with<br>=
</div><div>4 ways.<br></div><div>The web page (last updated July 2023) show=
s that the results are in<br></div><div>IPv4, but my results are in IPv6.<b=
r></div><div>I tried all four ways.<br></div><blockquote type=3D"cite" styl=
e=3D"margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><di=
v>From the dig command, I get "bash: dig: command not found"<br></div><div>=
From the host command, I get crap. When I remove the pipes I get stuff<br><=
/div></blockquote><div>including an IPv6 address.<br></div><blockquote type=
=3D"cite" style=3D"margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding=
-left:1ex"><div>From the wget and curl commands, Iget an IPv6 address.<br><=
/div></blockquote><div>The IPv6 address from 5 variations of wget and curl =
are all the same.<br></div><div>The IPv6 address from host is different.<br=
></div><div>I like curl ifconfig.me because it is easy to remember.<br></di=
v><div><br></div><div>Here's the problem.<br></div><div>I would like to ver=
ify my public IP address using CLI as well as the<br></div><div>browser.<br=
></div><blockquote type=3D"cite" style=3D"margin:0 0 0 .8ex; border-left:2p=
x #729fcf solid;padding-left:1ex"><div>From ipchicken in the broswer, I get=
IPv4.<br></div><div>From the CLI, I get IPv6.<br></div></blockquote><div>H=
ow can I verify my public IP address?<br></div><div><br></div><div>In grati=
tude,<br></div><div>LeRoy<br></div><div>-- <br></div><div>There is somethin=
g glorious birthing within all of us.<br></div><div>I am the Love of God, n=
o matter what.BSA<br></div><div>LeRoy Diener<br></div><div>213-LEROYIZ<br><=
/div><div>213-537-6949<br></div><div><a href=3D"https://leroydiener.com">ht=
tps://leroydiener.com</a><br></div></blockquote><div><br></div><blockquote =
type=3D"cite" style=3D"margin:0 0 0 .8ex; border-left:2px #729fcf solid;pad=
ding-left:1ex"><div>_______________________________________________<br></di=
v><div>nmglug mailing list<br></div><div><a href=3D"mailto:[email protected]=
lug.org">[email protected]</a><br></div><div><a href=3D"http://lists.=
nmglug.org/listinfo.cgi/nmglug-nmglug.org">http://lists.nmglug.org/listinfo=
.cgi/nmglug-nmglug.org</a><br></div></blockquote><div><br></div><div>______=
_________________________________________<br></div><div>nmglug mailing list=
<br></div><div><a href=3D"mailto:[email protected]">[email protected]=
ug.org</a><br></div><div><a href=3D"http://lists.nmglug.org/listinfo.cgi/nm=
glug-nmglug.org">http://lists.nmglug.org/listinfo.cgi/nmglug-nmglug.org</a>=
<br></div></blockquote></body></html>
--=-lMWTZliQNSr5Y5megn3o--
--===============4835802094959052050==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
nmglug mailing list
[email protected]
http://lists.nmglug.org/listinfo.cgi/nmglug-nmglug.org
--===============4835802094959052050==--