Tutorials/Tips

2 methods to get your router’s external, or public IP address

Your router, that device that makes it possible to connect to the Internet, has two IP addresses by default – an internal one where it can be reached by computers behind it, that’s those in your internal network, and an external one that makes it possible for it to talk to other routers on the Internet.

In this article, you’ll learn two tricks to get your router’s public, or external IP address. For most people, finding out what their router’s IP address involves logging into the router’s management dashboard or using one of many websites that provide that service.

If you’re using a Linux computer, you have two more options.

Use Curl to query icanhazip

icanhazip (I-can-haz-IP) is an ad-free service maintained by a well-known Linux user. Visiting http://icanhazip.com will return your IP address, but you can get the same information from the command line using the curl command, a tool used to transfer data from or to a server with the aid of one of several supported protocols, like HTTP, FTP, etc. The following shows how to use curl to query icanhazip.com:

Related Post:  So that is how SSH got assigned port 22

Use Ansible’s ipify_facts module

Ansible is an open source, SSH-based automation, configuration management and deployment tool from Red Hat (via acquisition). Even on Fedora Ansible is not installed by default, so you need to first install it. There’s a package for it in the official repository of every Linux distribution, so use your distribution’s package manager to install it. This article shows how to install it on your favorite Linux distribution.

Related Post:  Editing php.ini file in VestaCP for upload_max_filesize exceeded error

The aspect of Ansible that makes it possible to retrieve your router’s public, or external IP address is a module called ipify_facts. The following shows how to use it:

Unlike the icanhazip service, Ansible only returns the IPv4 address, so if you need to know your router’s IPv6 address, use curl to query icanhazip.

Ansible

Subscribe to LinuxBSDos.com

Subscribe to receive the latest articles in your Inbox

Trust me, you'll not be spammed...

Please share:

We Recommend These Vendors and Free Offers

Register now for Blockchain & Cryptocurrency Con 2018, international conference on blockchain technnology in Dallas, TX (USA), Feb. 23-24, 2018. A 50% discount for students.

Best WhatsApp Plus features in Gbwhatsapp latest APK download

Best binary auto trading software reviews by 7binaryoptions.com

Google has got competition, because Presearch is building a blockchain-based search engine controlled by the community. At $0.15 a token, you can participation in Lot 3 of the token sale by clicking here

Open Money is building a solution that will run mainstream software on blockchain tech. Click here to get free tokens that will be the digital currency of the platform

Launch an SSD VPS in Europe, USA, Asia & Australia on Vultr's KVM-based Cloud platform starting at $5:00/month (15 GB SSD, 768 MB of RAM).


Leave a Comment

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

*