Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the ip command to display network connection information in Linux

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How do I use the ip command to display network connection information in Linux? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.

The ip command can tell you a lot about the configuration and status of network connections, but what do all these words and numbers mean? Let's dig a little deeper and see what all the displayed values are trying to tell you.

When you use the ip a (or ip addr) command to get information about all network interfaces on the system, you will see something like this:

$ip A1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 65536 scope host valid_lft forever preferred_lft forever2: enp0s25: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:1e:4f:c8:43:fc brd ff:ff:ff:ff:ff : ff inet 192.168.0.24/24 brd 192.168.0.255 scope global dynamic enp0s25 valid_lft 57295sec preferred_lft 57295sec inet6 fe80::2c8e:1de0:a862:14fd/64 scope link valid_lft forever preferred_lft forever

The two interfaces on this system-lo and enp0s25-show a lot of statistics. The lo interface is clearly a loopback address loolback. We can see the loopback IPv4 address (127.0.0.1) and the loopback IPv6 (:: 1) in the list. Ordinary network interfaces are more interesting.

Why enp0s25 and not eth0?

If you want to know why it is called enp0s25 on this system, rather than the probably more familiar eth0, we can explain it a little bit.

The new naming scheme is called "predictable network interface Predictable Network Interface". It has been in use on systemd-based Linux systems for some time. The interface name depends on the physical location of the hardware. En simply means "ethernet", just as "eth" is used to correspond to eth0. P is the bus number of the Ethernet card, and s is the slot number. So enp0s25 tells us a lot about the hardware we are using.

This configuration string tells us:

BROADCAST this interface supports broadcasting

MULTICAST this interface supports multicasting

UP network interface is enabled

LOWER_UP network cable is plugged in and the device is connected to the network

The other values listed also tell us a lot about interfaces, but we need to know what the words brd and qlen mean. So, what is shown here is the translation of the rest of the ip information shown above.

Mtu 1500 maximum transmission unit (packet size) is 1500 bytes

Qdisc pfifo_fast is used for packet queuing

State UP network interface is enabled

Group default interface group

Qlen 1000 transmission queue length

MAC (hardware) address of the link/ether 00:1e:4f:c8:43:fc interfac

Brd ff:ff:ff:ff:ff:ff broadcast address

Inet 192.168.0.24 Universe 24 IPv4 address

Brd 192.168.0.255 broadcast address

Scope global is globally valid

Dynamic enp0s25 addresses are assigned dynamically

The useful life of the valid_lft 80866sec IPv4 address

Preferred lifetime for preferred_lft 80866sec IPv4 addresses

Inet6 fe80::2c8e:1de0:a862:14fd/64 IPv6 address

Scope link is valid only on this device

The useful life of the valid_lft forever IPv6 address

Preferred lifetime for preferred_lft forever IPv6 addresses

You may have noticed that some of the information provided by the ifconfig command is not included in the output of the ip a command-- such as statistics for transmitting packets. If you want to see a list of the number of packets sent and received and the number of conflicts, you can use the following ip command:

$ip-s link show enp0s252: enp0s25: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 00:1e:4f:c8:43:fc brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped overrun mcast 224258568 418718 84376 TX: bytes packets errors dropped carrier collsns 6131373 78152 000 0

Another ip command provides information about the routing table of the system.

$ip route showdefault via 192.168.0.1 dev enp0s25 proto static metric 100169.254.0.0 metric 16 dev enp0s25 scope link metric 1000192.168.0.0 metric 24 dev enp0s25 proto kernel scope link src 192.168.0.24

The ip command is very generic. You can get useful cheat sheets from the ip command and its options from Red Hat.

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report