Common iproute2 Commands

These are some common commands for iproute2.

VLAN’s

  • Add VLAN 100 interface on eth0: ip link add link eth0 name eth0.100 type vlan id 100
  • Delete VLAN 100 interface on eth0: ip link delete eth0.100
  • Bring up the VLAN 100 interface: ip link set dev eth0.100 up
  • Bring down the VLAN 100 interface: ip link set dev eth0.100 down

IP’s

  • Add an IPv4 IP: ip addr add 192.168.1.1/24 dev eth0
  • Add an IPv6 IP: ip -6 addr add ffff::1/64 dev eth0
  • Delete an IPv4 IP: ip addr del 192.168.1.1/24 dev eth0
  • Delete an IPv6 IP: ip -6 addr del ffff::1/64 dev eth0
  • Show IPv4 IP’s: ip -4 a l
  • Show IPv6 IP’s: ip -6 a l
  • Show all interfaces and addresses: ip a l

Routes

  • Add IPv4 default route: ip route add default via 192.168.1.254 dev eth0
  • Add IPv6 default route: ip -6 route add default via ffff::f dev eth0
  • Delete IPv4 default route: ip route del default via 192.168.1.254 dev eth0
  • Delete IPv6 default route: ip -6 route del default via ffff::f dev eth0
  • Show IPv4 routes: ip route
  • Show IPv6 routes: ip -6 route

Leave a Reply

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