ip command from iproute2 – utilities for TCP/IP networking in Linux
This ip command guide is a follow-up of my previous 90 Linux Commands frequently used by Linux Sysadmins article. Every week, or as time allows, I will publish articles on the ~ 90 commands geared toward Linux sysadmins and Linux power users. Let’s continue this series with the IP
command.
For Linux sysadmins, it is crucial to have a basic understanding of networking tools when managing and troubleshooting Linux servers. While we’ve covered some tools made primarily for monitoring, iproute2 and specifically the IP
command is used to configure, view, and modify network settings.
iproute2 is a Linux networking toolkit that replaced net-tools (including ifconfig
and route
). Instead of using a separate tool for every aspect of network management, with IPRoute2, sysadmins now have a unified interface.
The iproute2 contains the following command-line utilities: arpd
, bridge
, ctstat
, devlink
, ip
, lnstat
, nstat
, rdma
, routef
, routel
, rtacct
, rtmon
, rtstat
, ss
, tc
and tipc
. Most of the networking functionality is consolidated into the ip
command. There’s also tc
for managing traffic policies (QoS), and ss
which replaced netstat
.
IP command with examples
The ip
command is a part of the iproute2 package that is installed on all modern Linux distributions. This suite of networking commands allows system administrators to adjust addresses, link-state, neighbor objects, routing tables, and manage other network components. The ip
command also provides access to VRF, network namespaces, policy-based routing, and so on. It offers a uniform syntax.
IP command examples:
To list interfaces with detailed info, use:
ip address
To list interfaces with brief network layer info, use:
ip -brief address
To list interfaces with brief link layer info, use:
ip -brief link
To display the routing table, use:
ip route
To show neighbors (ARP table), use:
ip neighbour
To make an interface up/down, use:
ip link set interface up/down
To add/delete an ip address to an interface, use:
ip addr add/del ip/mask dev interface
To add a default route, use:
ip route add default via ip dev interface
IP command & iproute2 useful reading:
- Task-centered iproute2 user guide.
- IP command cheat sheet.
- Linux Advanced Routing & Traffic Control HOWTO.
IProute2 and the IP command are essential to Linux network management. We should know how to use the commands to assist in network and system administration.