blog.kaniski.eu I just wanna learn!

23Jul/190

Figuring out your public IP address with PowerShell

Sometimes, you need to know your public IP address because of... reasons. My particular reason was creating firewall rule to limit SSH only from my current public IP address, to a machine on the Internet. And how to do it?

You can always use free services like What Is My IP?, which shows you your public IP address in a nice form:

But there are also other ways - if you're running Linux (or WSL) and do a Google search for the command that can help you, you'll probably get this (https://askubuntu.com/questions/95910/command-for-determining-my-public-ip?noredirect=1&lq=1):

And if you're using Windows, PowerShell is here to help you! I like "oneliners", even if they are not always easy to read:

I'm sure that my friend Aleksandar (PowerShell guru & Microsoft MVP) has a better way, but for me, this works just fine. 🙂

Hope it helps!

Cheers!

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.