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 a|-brief address]]
copy

List interfaces with brief link layer info
$ ip [[-br l|-brief 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]] [interface] [up|down]
copy

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

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

SYNOPSIS

ip [ OPTIONS ] OBJECT { COMMAND | help }

PARAMETERS

link
    Manage network interfaces (e.g., bringing interfaces up/down, setting MTU).

addr
    Manage IP addresses on interfaces (e.g., assigning, deleting addresses).

route
    Manage the routing table (e.g., adding, deleting routes).

neigh
    Manage ARP entries (neighbor discovery).

rule
    Manage routing policy database rules.

maddr
    Manage multicast addresses.

tunnel
    Manage IP tunnels.

xfrm
    Manage IPsec policies.

netns
    Manage network namespaces.

OPTIONS
    Global options: -V[ersion], -h[uman-readable], -s[tatistics], -d[etails]

DESCRIPTION

The ip command is a powerful and versatile Linux utility used for configuring and managing network interfaces, routing tables, and network devices.
It's part of the iproute2 suite, designed as a replacement for older tools like ifconfig and route. ip offers a unified syntax and more advanced features for network administration.

With ip, you can bring interfaces up or down, assign IP addresses, configure routing rules, manage ARP entries, and more. It provides granular control over network parameters, making it essential for both simple and complex network configurations.

Unlike older tools, ip operates on objects (links, addresses, routes) and provides a more object-oriented approach to network management, providing a more flexible and extensible solution for network administration. The command is used by system administrators to configure their systems, but can also be used by developers to test network configuration.

NAMESPACES

The 'ip netns' command allows managing network namespaces, providing network isolation. This is often used in containerization and virtualization to create separate network environments.

MTU DISCOVERY

You can adjust the Maximum Transmission Unit (MTU) using the ip link command. Finding the correct MTU is crucial for avoiding fragmentation and ensuring efficient network communication. When the MTU is too high, packets could get fragmented.

HISTORY

The ip command is part of the iproute2 suite, which was developed to replace the older net-tools package (containing commands like ifconfig and route).
It was introduced in the early 2000s, offering more advanced features and a more object-oriented approach to network configuration.
The iproute2 suite was created with the intention of supporting new kernel features and providing a more robust and extensible networking management solution. Its usage has grown steadily as Linux systems have adopted it as the standard tool for network management.

SEE ALSO

ifconfig(8), route(8), arp(8)

Copied to clipboard