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:  Understanding the Technology Behind Most Online Casinos and Slot Games

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:  How to install Ansible on your favorite Linux distribution

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

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

COMSA allows centralized businesses to adopt blockchain technology. The token sale starts soon! Sign up for free by clicking here

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

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 *

*