LinuxCommandLibrary

ip

Manage network interfaces, routing, and tunnels

TLDR

List interfaces with detailed info

$ ip [[a|address]]
copy

List interfaces with brief network layer info
$ ip [[-br|-brief]] [[a|address]]
copy

List interfaces with brief link layer info
$ ip [[-br|-brief]] [[l|link]]
copy

Display the routing table
$ ip [[r|route]]
copy

Show neighbors (ARP table)
$ ip [[n|neighbour]]
copy

Make an interface up/down
$ sudo ip [[l|link]] [[s|set]] [ethX] [up|down]
copy

Add/Delete an IP address to an interface
$ sudo ip [[a|address]] [add|delete] [ip_address]/[mask] dev [ethX]
copy

Add a default route
$ sudo ip [[r|route]] [[a|add]] default via [ip_address] dev [ethX]
copy

SYNOPSIS

ip [OPTIONS] OBJECT { COMMAND | help } [arguments]

PARAMETERS

-V, -Version
    Print version information and exit

-s, -stats, -statistics
    Output more statistics; repeat for full details

-d, -details
    Give verbose output; repeat for more details

-r, -resolve
    Use DNS resolvers for hostnames

-f, -family FAMILY
    Select protocol family (inet, inet6, mpls, bridge, link)

-4
    Shortcut for -family inet (IPv4)

-6
    Shortcut for -family inet6 (IPv6)

-0
    Shortcut for -family link

-l, -lo, -local, -interactive
    Read/write from stdin/stdout or listen

-o, -oneline
    Output records on single line with '\' for newlines

-br, -brief
    Print only essential information

-c[=COLOR]
    Use color output (auto, always, never)

-j, -json
    JSON structured output

-p, -pretty
    Pretty-print JSON

-b, -batch FILE
    Read commands from file

-force
    Don't exit on errors in batch mode

--batchlimit=#
    Exit batch after # netlink messages (default 16384)

-N
    No NIC discovery

DESCRIPTION

The ip command, part of the iproute2 suite, is a versatile tool for managing Linux networking. It replaces legacy utilities like ifconfig, route, and arp with a unified, extensible interface supporting IPv4, IPv6, MPLS, and link-layer operations.

It controls network devices (ip link), IP addresses (ip addr), routes (ip route), neighbors (ip neigh), multicasts (ip maddr), tunnels (ip tunnel), namespaces (ip netns), and more. Features include detailed statistics, JSON output, colorized displays, batch processing, and real-time monitoring via netlink.

Designed for both querying (show, list) and configuring (add, del, set), it suits sysadmins, DevOps, and network engineers. Output is human-readable or script-friendly, with options for brevity or verbosity. Essential in servers, containers, and cloud environments, ip handles complex setups like VXLANs and policy routing.

CAVEATS

Most configuration requires root privileges. Steep learning curve due to subcommands. Some options apply only to specific objects. Legacy tools like ifconfig may coexist but are deprecated.

MAIN OBJECTS

link - interfaces
addr, address - IP addresses
route - routing tables
neigh, neighbor - ARP/neighbors
maddr, maddress - multicasts
tunnel - tunnels
netns - namespaces

QUICK EXAMPLES

ip link show - list interfaces
ip addr show - show IPs
ip addr add 192.168.1.10/24 dev eth0 - add IPv4
ip route add default via 192.168.1.1 - add default route

HISTORY

Developed by Alexey Kuznetsov in 1999 for Linux 2.2 as part of iproute2, replacing net-tools. Evolved with kernel netlink API, adding IPv6, namespaces, and JSON support. Standard in distros since early 2000s.

SEE ALSO

ifconfig(8), route(8), arp(8), netstat(8), ss(8), tc(8)

Copied to clipboard