iproute2 Cheatsheet

The iproute2 package offers the ip utility, which is a modern replacement for tools such as ifconfig, route, arp, and more. It allows you to configure addresses, links, routes, and ARP tables. The only problem is that its documentation can be quite confusing. This post is intended to be a task-oriented guide to this utility. It’s far from complete, and I intend to update it from time to time.

List available network interfaces and their IP addresses (along with other useful information).

$ ip addr

Add an address to an interface and define the subnet mask:

# ip addr add 192.168.1.81/24 dev eth0

Remove an address:

# ip addr del 192.168.1.81/24 dev eth0

Bring a network interface up:

# ip link set eth0 up

and down:

# ip link set eth0 down

List entries in the ARP table:

$ ip neigh

View routing rules:

$ ip route

Set the default gateway:

# ip route add default via 192.168.1.1

2 thoughts on “iproute2 Cheatsheet”

Leave a Reply

Your email address will not be published. Required fields are marked *