ip
modern Linux networking command for showing and manipulating routing
TLDR
Show every interface and address as a compact, colored table
$ ip -c -br address
Show the addresses of a single interface$ ip address show dev [eth0]
Restrict the output to IPv4 (or `-6` for IPv6)$ ip -4 address
Assign an address to an interface, with its prefix length$ sudo ip address add [192.168.1.10]/[24] dev [eth0]
Remove an address from an interface$ sudo ip address del [192.168.1.10]/[24] dev [eth0]
Bring an interface up (or `down` to disable it)$ sudo ip link set dev [eth0] up
Change an interface's MTU$ sudo ip link set dev [eth0] mtu [9000]
Print per-interface error and packet counters$ ip -s link show dev [eth0]
Print the routing table$ ip route
Ask which route the kernel would actually use for one destination$ ip route get [1.1.1.1]
Set the default gateway$ sudo ip route add default via [192.168.1.1] dev [eth0]
Inspect the neighbour (ARP) cache$ ip neighbour show
SYNOPSIS
ip [-br] [-c] [-4|-6] object [command]
DESCRIPTION
ip is the modern Linux networking command for showing and manipulating routing, devices, policy routing, and tunnels. It replaces the older ifconfig, route, and arp commands.
PARAMETERS
address, a
Display and manage IP addresseslink, l
Display and manage network interfacesroute, r
Display and manage routing tableneighbour, n
Display and manage ARP/neighbor cachetunnel
Display and manage IP tunnelsmaddr
Display and manage multicast addressesrule
Display and manage routing policy database-br, -brief
Print output in brief format-c, -color
Use color output-4
IPv4 only-6
IPv6 only-s, -stats
Output more statistics-o, -oneline
Output each record on a single line
INSTALL
sudo apt install iproute2
sudo pacman -S iproute2
sudo apk add iproute2-minimal
sudo zypper install iproute2
brew install iproute2
nix profile install nixpkgs#iproute2
CAVEATS
Changes made with ip are not persistent across reboots. Use network configuration files or NetworkManager for persistent changes.
HISTORY
Part of the iproute2 package, introduced in Linux 2.2 as a replacement for the older net-tools package (ifconfig, route, arp).
