Where It All Started.

Where It All Started.

Life, Stock Trading, Investments, Business and Startup. Most are programming stuff.

Find Public IP in Linux Using CLI

A musician must make music, an artist must paint, a poet must write, if he is to be ultimately at peace with himself. What a man can be, he must be

— Abraham Maslow.

Hey guys, ever been in a situation you need to query your public WAN IP without any browser. Glad you came to the right post.

Prerequisites

  • dig – Dig stands for (Domain Information Groper) is a network administration command-line tool for querying Domain Name System (DNS) name servers. It is useful for verifying and troubleshooting DNS problems and also to perform DNS lookups and displays the answers that are returned from the name server that were queried.
  • curl – cURL is a computer software project providing a library and command-line tool for transferring data using various network protocols. The name stands for “Client URL”, which was first released in 1997.
  • wget – GNU Wget is a computer program that retrieves content from web servers. It is part of the GNU Project. Its name derives from World Wide Web and get. It supports downloading via HTTP, HTTPS, and FTP. Its features include recursive download, conversion of links for offline viewing of local HTML, and support for proxies.

What are the ways to find my IP?

Here are ways to find your own public IP from the terminal.

First is using OpenDNS servers. The OpenDNS servers are always free and a toolkit for a network engineer.

dig +short myip.opendns.com @resolver1.opendns.com

If resolver1 isn’t responding try the resolver2 to get your query.
Also you could achieve this query using Google’s nameservers.

dig TXT +short o-o.myaddr.l.google.com @ns1.google.com

The second is using curl or wget which is more common on many distro’s without installing any other packages. While this is much slower in resolving, the tools used is much more common.

curl https://ipinfo.io/ip

For wget command just replace the curl word above.

Conclusion

I haven’t listed all the ways, as there are many ways to achieve this. But all this commands have been tested and used by me several times, it always save my ass when there’s a problem. If you have additional command that you want to share DM me at @ffimnsr.

Popular Posts

  • Bitcoin (BTC) Still Bullish According To BlockTower
    The continuous Bitcoin volatility, according to BlockTower Capital’s general partner Michael Bucella, should not come as a surprise because it is part of the asset’s development trajectory. Bucella told CNBC […]
  • Major Firm BlackRock To Create It’s Own Blockchain ETF
    According to a filing with the US Securities and Exchange Commission on Jan. 21, BlackRock Inc., the world’s largest asset management business, has applied for an exchange-traded fund (ETF) that […]
  • Google Going Crypto
    As the firm looks to provide a wider range of financial services, including cryptocurrencies, Google has hired veteran PayPal CEO Arnold Goldberg to manage its payments division. Google’s action comes […]
  • Total Crypto Market Cap Will Reach 5 Trillion USD In 2022 According To AvaLabs CEO
    In 2022, John Wu, the CEO of Ava Labs, a blockchain business that creates the software for the Avalanche (AVAX) blockchain, offered a lot of fascinating forecasts for the cryptocurrency […]
  • Pavia Metaverse Project Debuts On Cardano (ADA)
    The Metaverse is currently in its early stages. While Ethereum-based metaverse games like The Sandbox have exploded in popularity, investors are also interested in developing applications on secure PoS networks […]

Leave a Reply

Your email address will not be published. Required fields are marked *