Skip to main content

ip Command

The ip command is the primary command-line tool for configuring and managing network interfaces in modern Linux systems. It is part of the iproute2 package and replaces older tools like ifconfig and route.

Common ip Commands

Here are some of the most common subcommands and examples:

Managing IP Addresses (ip addr)

  • Add IP Address:
    sudo ip addr add 192.168.1.100/24 dev eth0
  • Delete IP Address:
    sudo ip addr del 192.168.1.100/24 dev eth0
  • Show IP Addresses:
    ip addr show
  • Bring Interface Up/Down:
    sudo ip link set eth0 up
    sudo ip link set eth0 down
  • Show Interface Status:
    ip link show

Managing Routing Tables (ip route)

  • Show Routing Table:
    ip route show
    # or shorthand
    ip r
  • Add Default Gateway:
    sudo ip route add default via 192.168.1.1
  • Delete Default Gateway:
    sudo ip route del default