iproute2: Essential Linux Networking Commands
- Last updated: Jul 27, 2025
iproute2 is a modern suite of tools used to control and monitor networking capabilities in the Linux kernel. It replaces older utilities like ifconfig
and offers advanced functionality for managing network interfaces, addresses, routing, and more.
Common iproute2 Commands
IP Address Management
- Assign an IP address to an interface:
root@host:~# ip addr add 192.168.2.41/24 dev eth0
- Add an IP alias (a second address) to the same interface:
root@host:~# ip addr add 192.168.2.42/24 dev eth0
- Remove the current default gateway:
root@host:~# ip route del default
- Set a new default gateway:
root@host:~# ip route add default via 192.168.2.1
- Add a custom route through a specific interface:
root@host:~# ip route add 192.168.1.210 dev ppp0
Interface Management (Link)
- Enable a network interface:
root@host:~# ip link set ens33 up
- Disable a network interface:
root@host:~# ip link set ens33 down
VLAN Configuration
- Create a new VLAN interface with ID 10 on
eth0
:
root@host:~# ip link add link eth0 name IPv6 type vlan id 10
root@host:~# ip link set IPv6 up
- Remove the VLAN interface:
root@host:~# ip link set IPv6 down
root@host:~# ip link delete IPv6