Home  >  Article  >  Operation and Maintenance  >  How to check IP in Linux

How to check IP in Linux

angryTom
angryTomOriginal
2020-02-06 09:27:138384browse

Knowing your device's IP address is important when troubleshooting network problems, setting up new connections, or configuring firewalls. Let’s take a look at how to check the IP address in Linux!

How to check IP in Linux

Linux method of checking ip

In Linux, the standard command for displaying and configuring network interfaces is ip .

To display a list of all network interfaces and related IP addresses, type the following command:

ip addr

The command execution results are as follows:

How to check IP in Linux

You can also use the following command to display the internal IP address:

hostname -I
ifconfig

To view the public IP, you can use any of the following commands:

dig ANY +short @ resolver2.opendns.com myip.opendns.com 
dig ANY +short @ resolver2.opendns.com myip.opendns.com 
dig ANY +short @ ns1-1.akamaitech.net ANY whoami.akamai.net

(Online video tutorial sharing: linux video tutorial)

The above is the detailed content of How to check IP in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn