iproute2 Cheatsheet

The iproute2 package offers the ip utility, which is a modern replacments for tools such as ifconfig, route, arp and more. It allows to configure addresses, links route 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 interface and define the subnet mask:

# ip addr add 192.168.1.81/24 dev eth0

Removing an address:

# ip addr del 192.168.1.81/24 dev eth0

Bringing 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 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 *