Get Public IP on Ubuntu 20.04-Linux Hint from Terminal
Should you’re utilizing the web, you then’ve heard of IP handle, proper? In laptop networking, an IP (Web Protocol) handle is a numerical identifier to establish a sure gadget that makes use of the Web Protocol for communication. The IP handle could also be assigned briefly or completely to the gadget.When the gadget connects to different gadgets via the community, different gadgets see the general public IP handle. On this information, try tips on how to get the general public IP handle of your gadget from the terminal on Ubuntu 20.04.
IP handle fundamentals
There are two variations of IP addresses at present in use: IPv4 and IPv6. Any IP handle may be both non-public (may be seen solely inside a community) or public (may be seen from any machine on the web). IPv4 is but the most well-liked format however within the present period, it could’t assign sufficient gadgets with distinctive IP addresses. The IPv6 solves this by growing the variety of accessible distinctive IP addresses.
Let’s have a fast take a look at what an IP handle appears like. Within the case of IPv4, it’s a 32-bit (Four bytes) handle divided into 4 8-bit blocks separated by “.” symbols. The handle is represented with decimal digits.
The attainable vary of IPv4 is from 0.0.0.Zero to 255.255.255.255.
Within the case of IPv6, it’s a bit difficult however related in precept. An IPv6 handle is a 128-bit (Eight bytes) handle divided into eight 16-bit blocks separated by “:” symbols. The handle is represented with hexadecimal digits.
Due to its sheer size, it may be problematic to make use of in varied conditions. As such, there are guidelines to shorten the handle. After shortening the instance handle, it’ll look one thing like this.
Get the general public IP handle from terminal
Now, we’re able to seize the general public IP handle of our gadget. There are a number of methods to take action. For instance, when you’ve got entry to GUI, then you should use the net browser to go to websites like WhatIsMyIPAddress, WhatIsMyIP, and many others.
Because the title of the information suggests, we’ll be exploring the methods of checking the IP handle via the terminal solely. Fortunately, there are a number of instruments accessible at our disposal to verify the general public IP handle.
Get public IP handle utilizing dig
The dig (area data groper) is a straightforward utility instrument for probing DNS title servers. Utilizing the dig instrument together with OpenDNS as a resolver, we are able to get the general public IP handle.
The following one is icanhazip.com. This web site returns the general public IP handle in a plain textual content format.
$ wget -qO- icanhazip.com
One other related service is ifconfig.co.
You may also use ifconfig.me to get the IP handle.
$ wget -qO- ifconfig.me | xargs echo
Get public IP handle utilizing cURL
The curl instrument is one other common command-line downloader/uploader that may function on any of the favored protocols (HTTP, HTTPS, FTP, FTPS, and others).
Curl doesn’t come pre-installed on Ubuntu 20.04. Set up curl.
$ sudo apt replace && sudo apt set up curl -y
The tactic is just like the wget one.
$ curl ifconfig.me && echo
$ curl icanhazip.com && echo
Get public IP handle utilizing ip
The ip command is chargeable for managing community gadgets, interfaces, and tunnels. It may possibly additionally report details about the related networks.
Run the next ip command to checklist the community interfaces and the IP handle.
The next command is the equal one. It’ll give the identical outcome.
As we’ve demonstrated, there are tons of how to verify the general public IP handle of your gadget. Which one it is best to use? Will depend on you. Attempt all of them out at the least as soon as. Then, you’ll be able to simply determine which one to grasp.
ubuntu 20.04 network-manager,kubuntu 20.04 static ip,ubuntu 20.04 dhcp client,netplan/cloudinit,configure static ip ubuntu server,ubuntu 20 change hostname,ubuntu what is my public ip,ubuntu server 20.04 check ip address,ubuntu 20 change theme,upgrade ubuntu to ubuntu studio,ubuntu 20.04 desktop icons,ubuntu 20.04 show ip address command line,ubuntu 20.04 get ip address,configure static ip ubuntu 20.04 command line,ubuntu 20.04 static address,ubuntu ip address,ubuntu 19.10 static ip,ubuntu change ip address command line,ubuntu 20.04 eth0,change ip address ubuntu