ip Command: Show Addresses, Routes and Links on Linux
Use the ip command from iproute2 to list network interfaces, IP addresses, routes and neighbors, and find where ifconfig points you for link details.
Contents
The ip command from iproute2 shows and changes network interfaces, addresses, routes and neighbors. This guide sticks to the read-only commands you will use most, and notes where the ifconfig man page points to ip.
The examples ran in containers, so your output will differ. Interface names, addresses and routes depend on your machine.
Install the ip command
Most systems already ship it. If yours does not, install the iproute2 package.
apt-get update && apt-get install -y iproute2dnf install -y iproutepacman -Sy --noconfirm iproute2Objects and abbreviations
ip takes an object followed by a command: address, link, route or neighbour. The man page says object names may be written in full or abbreviated, and it gives addr and a for address. Running an object with no command lists it, so ip address and ip address show do the same thing.
List addresses
ip address showEach interface appears with its IPv4 and IPv6 addresses. Useful filters from the ip-address man page:
dev NAMElimits output to one interface.upshows only addresses on running interfaces.scope global(orlink,host) filters by scope.
Add -4 or -6 before the object to limit the output to one address family.
ip -4 address show scope global
ip -6 address show upGet a compact view
The -brief (-br) option prints a table with one line per interface. Per the man page, it works only with ip addr show, ip link show and ip neigh show.
ip -br address
ip -br linkAdd -c to enable color. For scripts, -json prints JSON and -pretty indents it.
ip -json -pretty address show loList links
ip link show lists devices at the link layer. The ifconfig man page itself points to ip link for link-layer details such as the hardware address.
ip link show
ip link show upip link show type TYPE filters by device type. The man page notes the type string is passed to the kernel as given, so a typo can return empty output instead of an error.
Add -s to include statistics such as packet counts. Repeating it increases the detail.
ip -s link show loList routes
ip route show prints the main routing table by default. Use table all to see every table.
ip route show
ip -6 route showA line starting with default is the default route, shorthand for 0/0 (IPv4) or ::/0 (IPv6). It contains via (the next-hop router) and dev (the output interface). A container or minimal host may have no default route, so the output can be empty.
To ask the kernel which route a destination would use, run ip route get. The man page says it prints the result as the kernel sees it and sends no packets.
ip route get 127.0.0.1List neighbors
ip neighbour show (abbreviated neigh) lists the kernel’s neighbour table. The IPv4 part of it is the ARP table. Entries carry a state such as reachable, stale or failed.
ip neighbour showFrom ifconfig to ip
The ifconfig man page identifies it as part of the net-tools project. For link-layer details such as the hardware address, it tells you to use ip link instead. It does not call the tool deprecated.
Changing things
Adding and removing addresses, setting links up or down, and editing routes need root and a real network. These commands can cut your connection, so run them carefully. The device name eth1 and the address are placeholders.
ip address add 192.0.2.10/24 dev eth1
ip address del 192.0.2.10/24 dev eth1
ip link set dev eth1 upNote that ip address flush with no filters does nothing, which guards against accidents, but with a filter it removes every matching address. Specify scope global if you want to keep link-local IPv6 addresses.
Related reading
To see which processes use the network, read ss Command: List Listening Ports and Connections on Linux.
Sources
This article was drafted with AI assistance, fact-checked against the sources listed above and reviewed by a human editor before publication. Spotted an error? See our corrections policy.