Get public IP address in Linux Terminal
First you need to know that there are two versions of IP addresses: IPv4 and IPv6. Each of these two types of IP addresses can be either private or public. In this article we will show several ways how you can check your outgoing ip address using the dig commands, host command, and some external services to find a public IP address on Linux VPS or dedicated server.
What is an external ip address?
An external IP address is a UNIQUE IP address for the entire Internet, which is assigned to a server, virtual machine or computer. There are a limited number of such IP addresses in the world. External IP addresses belong to hosting providers and are allocated from a pool of addresses. Thanks to this IP address, you gain access to the outside world.
Advantages of an external IP address
An external IP address is indispensable in hosting services. A public IP address allows your server or computer to be used to access websites, email servers, or other other resources. You can use such an IP address for remote access to devices and networks, which is very convenient and important when working remotely. You can also use a public IP address to set up protection using a firewall and other services. You can read more about protecting your server in our article - secure linux server.
Disadvantage Of Public IP addresses
Despite the fact that a public IP has a number of advantages, there is also the disadvantage that it is not sufficiently protected. Your public IP is viewable and you may be at risk of hacking your server or computer. You need to take action yourself to protect your server from hacking.
Linux: get public ip address from the Linux Command Line
Check external IP address using command curl:
Check public ip address using command wget:
Linux: get external ip Address using DynDNS.org
1. You can get it using utilite wget:
2. Using utilite curl:
3. Using utilite lynx:
The main purpose of this article is to show you several ways to find out your public IP address. We also tried to briefly explain what a public IP address is, its main advantages and disadvantages. We hope you found this article helpful.