How to Find Your Public IP Address Using Commands in Linux
If you’re a Linux consumer, you could must discover your public IP handle from the command line for different causes, similar to troubleshooting community troubles or organising an internet server. In this text, we’ll guideline you by using the technique of discovering your public IP handle making use of totally different instructions in Linux.
Content of this text comprises:
Finding Public IP Address Using dig Command
Finding Public IP Address Using Host Command
How to Find Public IP Address Using Curl Command
Difference Between Public and Private IP Address
The Internet Protocol handle is an identifier handle given to units contained in the community. There are two kinds of IP addresses:
Public: The Internet Service Provider assigns the general public IP to the machine which is immediately related to the web. It can recognize the machine on the web. It should be would becould very well be checked from anyplace over the web.
Private: A exclusive IP handle is given by the community administrator to units on a regional community. The Private IP handle is given to networks similar to a dwelling or workplaces. It is used to recognize units inside the community. It are not able to be accessed over the web as it’s Private.
Among equally addresses the accessibility is the important big difference which describes whether or not they should be would becould very well be accessed or not over the web.
Finding Public IP Address Using dig Command
The dig command provides us a Public IP handle making use of DNS servers. To discover public IP making use of dig observe under steps:
Open the terminal in your Linux machine. Type the subsequent command:
dig +brief myip.opendns.com @resolver1.opendns.com
You will see a public IP handle displayed on the terminal:
Finding Public IP Address Using host Command
The host command is one other useful gizmo for getting info similar to IP addresses and domains from a DNS server. You may also use the host command to get public IP.
Run under host command to get IP:
host myip.opendns.com resolver1.opendns.com
Your public IP handle will screen on the terminal.
How to Find Public IP Address Using curl Command
-
- IP Address from Ifconfig Using curl Command
- IP Address from ipinfo Using curl Command
- IP Address from ipify Using curl Command
- IP Address from checkip.dyndns.org Using curl Command
- IP Address from ident.me Using curl Command
- IP Address from ipecho.internet Using curl Command
1: IP Address from ifconfig Using curl Command
The curl command can trade statistics from a server. One of its abundant makes use of is discovering your public IP handle.
To discover public IP variety the subsequent command on shell:
This command will screen Public IP on the terminal.
2: IP Address from ipinfo Using curl Command
The command curl ipinfo.io/ip additionally makes use of the curl utility to retrieve the general public IP handle of the system it’s being executed on.
When the curl command is executed, it makes a GET request to the ipinfo.io API, which returns the general public IP handle.
Here’s how this command works:
3: IP Address from ipify Using curl Command
The command curl api.ipify.org may also give us our public IP handle making use of the curl utility and ipify service API. Here’s how this command works:
4: IP Address from checkip.dyndns.org Using curl Command
This command sends a request to the web page checkip.dyndns.org making use of the curl device. The web page returns the general public IP.
5: IP Address from ident.me Using curl Command
This command sends a request to the web page ident.me making use of the curl device. The web page provides Public IP of the machine.
6: IP Address from ipecho.internet Using curl Command
Last on the record is the ipecho.internet command. This command sends a request to the web page ipecho.internet/plain making use of the curl device. The web page returns the general public IP handle of the machine.
Conclusion
Internet service carriers assign the general public IP to the machine which is immediately related to the web. To discover the general public IP handle from the command line in Linux, one can use the curl command observed by a web page that returns the consumer’s public IP handle. The dig and host command may also discover the general public IP handle making use of the DNS server.