Example method of viewing IP in Linux

Example method of viewing IP in Linux

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

How to check IP address in Linux

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

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

ip addr

The command execution results are as follows:

You can also display the internal IP address using the following command:

hostname -I

ifconfig

To view the public IP address, 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

The above are all the relevant knowledge points compiled by the editor of 123WORDPRESS.COM. If you have any supplements, please contact the editor.

You may also be interested in:
  • Detailed steps for manually configuring the IP address in Linux
  • Solution to the IP address not being displayed under Linux

<<:  Example of Vue implementing fixed bottom component

>>:  MySQL free installation version (zip) installation and configuration detailed tutorial

Recommend

js implements array flattening

Table of contents How to flatten an array 1. Usin...

Simple steps to encapsulate components in Vue projects

Table of contents Preface How to encapsulate a To...

SVN installation and basic operation (graphic tutorial)

Table of contents 1. What is SVN 2. Svn server an...

Detailed steps for installing JDK and Tomcat on Linux cloud server (recommended)

Download and install JDK Step 1: First download t...

Let me teach you how to use font icons in CSS

First of all, what is a font icon? On the surface...

MySQL 5.7.18 Archive compressed version installation tutorial

This article shares the specific method of instal...

15 JavaScript functions worth collecting

Table of contents 1. Reverse the numbers 2. Get t...

CSS to achieve compatible text alignment in different browsers

In the front-end layout of the form, we often nee...

Vue uses GraphVis to develop an infinitely expanded relationship graph

1. Go to the GraphVis official website to downloa...

Docker executes a command in a container outside the container

Sometimes we want to execute a command in a conta...

How to fix some content in a fixed position when scrolling HTML page

This article mainly introduces how some content i...

Detailed steps to install CentOS7 system on VMWare virtual machine

Pre-installation work: Make sure vmware workstati...

Introduction to Linux File Compression and Packaging

1. Introduction to compression and packaging Comm...

js to achieve simple calendar effect

This article shares the specific code of js to ac...