ip — Check addresses, routing, and links
💬 "ip command"
ip is the standard tool that replaces ifconfig/route. It shows addresses (addr), links (link), and routes (route).
This is the first command to check interface status and the default gateway when network problems occur.
- Concept: Queries and configures network interface, address, and routing information.
- addr: IP address assigned to each interface.
- link: Interface status (UP/DOWN) and MAC address.
- route: Routing table and default gateway.
Frequently used options
| Option | Description |
|---|---|
| ip -br a | Prints addresses in summary format |
| ip link | Checks link status |
| ip route | Checks the routing table |
| ip -s link | Shows transmit/receive statistics and error counts together |
3 essential command combinations
ip -br a— View addresses at a glance in summaryip route get 8.8.8.8— Check the outgoing route to a specific destinationip -s link show ens3 | tail -5— Check interface error/drop counters
💬 "Show me an example of finding a problem that leaves no logs"
This is a step-by-step walkthrough of a situation commonly encountered on production servers.
Step 1 · Interface status
Check whether the link is UP.
ip -br link
Step 2 · Check address
Check whether an IP address has been assigned correctly.
ip -br a
Step 3 · Check routes
Check the default gateway and external routes.
ip route && ip route get 8.8.8.8
How it's used in practice
1. No outbound connectivity
Situation — The server cannot reach the outside.
ip -br a && ip route
Result — If an address exists but there is no default route, it is a gateway problem.
Point — Checking address, link, and route in order narrows down the cause layer by layer.
2. Interface error counters
Situation — Packet loss is suspected.
ip -s link show ens3
Result — If the errors/dropped counters increase, check cables, drivers, or load.
Point — Read the counters twice to check whether they are increasing.
Caution
- ip addr add/del changes the network immediately. It can disconnect your session when working remotely.
- ifconfig/route are no longer included by default on some distributions.
- To persist changes after reboot, use management tools such as netplan/NetworkManager.
Actual execution screen
This is the result of checking interface addresses and the routing table.
!ip command execution result: addresses and routing
A real production server
Source (HTML): https://games.aidebatehub.com/programs/linux/network/ip.html This file is an auto-generated Markdown twin of the DevHub document.
AI Knowledge Hub
Visitor Comments