Back to the command reference

ip

NetworkFundamentals In real Linux

Show and configure interfaces, addresses and routes

Name: ip: Internet Protocol tool

This command needs a real Linux system; you can practise it in real Linux mode.

Description

ip is the modern Linux tool for showing and configuring networking (from iproute2), replacing ifconfig, route and arp. Subcommands are per object: ip addr for addresses, ip link for interfaces, ip route for routes, ip neigh for neighbours.

Changes made with ip don't survive a reboot; persistent setup goes through NetworkManager, netplan and the like.

Syntax

ip [OPTION]... OBJECT COMMAND

Common options

addrShow IP addresses (short: ip a)
addr add / addr delAdd / remove an address: ip addr add 192.168.1.10/24 dev eth0 (needs root)
linkShow network interfaces
link set DEV up / downBring an interface up / down (needs root)
routeShow the routing table
route add / route delAdd / remove a route: ip route add default via 192.168.1.1 (needs root)
route getWhich route and interface traffic to an address uses
neighShow the ARP table
-br / -briefBrief: one line per interface
-cColour the output (short for -color)
-s / -statsAlso show traffic statistics
-4 / -6IPv4 / IPv6 only

Examples

  • $ ip a

    All IP addresses of this machine

    Explain
  • $ ip route

    Find the default gateway

    Explain
  • $ sudo ip link set eth0 up

    Bring an interface up

    Explain

Related