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.

Tools Published 4 min read

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.

✓ tested · debian,ubuntu
apt-get update && apt-get install -y iproute2
✓ tested · fedora
dnf install -y iproute
✓ tested · arch
pacman -Sy --noconfirm iproute2

Objects 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

✓ tested · debian,ubuntu,fedora,arch
ip address show

Each interface appears with its IPv4 and IPv6 addresses. Useful filters from the ip-address man page:

  • dev NAME limits output to one interface.
  • up shows only addresses on running interfaces.
  • scope global (or link, host) filters by scope.

Add -4 or -6 before the object to limit the output to one address family.

✓ tested · debian,ubuntu,fedora,arch
ip -4 address show scope global
ip -6 address show up

Get 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.

✓ tested · debian,ubuntu,fedora,arch
ip -br address
ip -br link

Add -c to enable color. For scripts, -json prints JSON and -pretty indents it.

✓ tested · debian,ubuntu,fedora,arch
ip -json -pretty address show lo

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.

✓ tested · debian,ubuntu,fedora,arch
ip link show
ip link show up

ip 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.

✓ tested · debian,ubuntu,fedora,arch
ip -s link show lo

List routes

ip route show prints the main routing table by default. Use table all to see every table.

✓ tested · debian,ubuntu,fedora,arch
ip route show
ip -6 route show

A 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.

✓ tested · debian,ubuntu,fedora,arch
ip route get 127.0.0.1

List 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.

✓ tested · debian,ubuntu,fedora,arch
ip neighbour show

From 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 up

Note 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.

To see which processes use the network, read ss Command: List Listening Ports and Connections on Linux.

Sources

  1. ip(8) manual page, Linux man-pages project
  2. ip-address(8) manual page
  3. ip-link(8) manual page
  4. ip-route(8) manual page
  5. ip-neighbour(8) manual page
  6. ifconfig(8) manual page

#Ip #Iproute2 #Networking #Ifconfig #Routing

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.