Andrew Mercer
on this page

What it is

ip (from the iproute2 package) is the modern replacement for ifconfig, route, arp, and netstat -r. Everything it changes is runtime only: a reboot or a NetworkManager restart discards it unless you also write it into your persistent network configuration.

Addresses

ip address show                                   # ip a
ip -br address show                               # one line per interface
sudo ip address add 192.168.0.55/24 dev eth0
sudo ip address delete 192.168.0.55/24 dev eth0
sudo ip address flush dev eth0                    # remove every address from the interface
ip link show
sudo ip link set eth0 up
sudo ip link set eth0 down
sudo ip link set dev eth0 mtu 9000                # see the MTU guide
sudo ip link add name br0 type bridge             # see the Linux bridge guide

Routes

ip route show
ip route get 8.8.8.8                              # which route/source address would be used
sudo ip route add 192.168.0.0/24 via 172.24.4.1 dev eth0
sudo ip route del 192.168.0.0/24
sudo ip route add default via 192.168.1.1

Making a static route survive reboot

ip route add is not persistent. Where the permanent entry goes depends on the network manager:

System Persistent route
RHEL legacy network-scripts /etc/sysconfig/network-scripts/route-eth0, line 192.168.0.0/24 via 172.24.4.1 dev eth0
NetworkManager nmcli connection modify <conn> +ipv4.routes "192.168.0.0/24 172.24.4.1" (see nmcli)
Netplan a routes: block under the interface (see the Linux router guide)
Debian ifupdown post-up ip route add ... under the interface

Neighbours (ARP / NDP)

ip neigh show
sudo ip neigh flush dev eth0

Namespaces

ip netns list
sudo ip netns add red
sudo ip netns exec red ip a

The network namespaces guide covers these in depth.

Statistics

ip -s link show eth0          # packet/byte/error/drop counters
ip -s -s link show eth0       # extended error counters

Old command → new command

Old New
ifconfig eth0 ip address show dev eth0
ifconfig eth0 up ip link set eth0 up
route -n ip route show
arp -a ip neigh show
netstat -i ip -s link
netstat -tulpn ss -tulpn (see ss)