LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ip

modern Linux networking command for showing and manipulating routing

TLDR

Show every interface and address as a compact, colored table
$ ip -c -br address
copy
Show the addresses of a single interface
$ ip address show dev [eth0]
copy
Restrict the output to IPv4 (or `-6` for IPv6)
$ ip -4 address
copy
Assign an address to an interface, with its prefix length
$ sudo ip address add [192.168.1.10]/[24] dev [eth0]
copy
Remove an address from an interface
$ sudo ip address del [192.168.1.10]/[24] dev [eth0]
copy
Bring an interface up (or `down` to disable it)
$ sudo ip link set dev [eth0] up
copy
Change an interface's MTU
$ sudo ip link set dev [eth0] mtu [9000]
copy
Print per-interface error and packet counters
$ ip -s link show dev [eth0]
copy
Print the routing table
$ ip route
copy
Ask which route the kernel would actually use for one destination
$ ip route get [1.1.1.1]
copy
Set the default gateway
$ sudo ip route add default via [192.168.1.1] dev [eth0]
copy
Inspect the neighbour (ARP) cache
$ ip neighbour show
copy

SYNOPSIS

ip [-br] [-c] [-4|-6] object [command]

DESCRIPTION

ip is the modern Linux networking command for showing and manipulating routing, devices, policy routing, and tunnels. It replaces the older ifconfig, route, and arp commands.

PARAMETERS

address, a

Display and manage IP addresses
link, l
Display and manage network interfaces
route, r
Display and manage routing table
neighbour, n
Display and manage ARP/neighbor cache
tunnel
Display and manage IP tunnels
maddr
Display and manage multicast addresses
rule
Display and manage routing policy database
-br, -brief
Print output in brief format
-c, -color
Use color output
-4
IPv4 only
-6
IPv6 only
-s, -stats
Output more statistics
-o, -oneline
Output each record on a single line

INSTALL

sudo apt install iproute2
copy
sudo pacman -S iproute2
copy
sudo apk add iproute2-minimal
copy
sudo zypper install iproute2
copy
brew install iproute2
copy
nix profile install nixpkgs#iproute2
copy

CAVEATS

Changes made with ip are not persistent across reboots. Use network configuration files or NetworkManager for persistent changes.

HISTORY

Part of the iproute2 package, introduced in Linux 2.2 as a replacement for the older net-tools package (ifconfig, route, arp).

SEE ALSO

ifconfig(8), route(8), arp(8), ss(8), ip-address(8), ip-route(8)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid