How to Use the ip Command in Linux to Manage Network Interfaces and Routing

For decades, system administrators and Linux users relied on legacy net-tools utilities—primarily ifconfig, route, and arp—to inspect and configure network adapters. However, net-tools was officially deprecated in the Linux kernel ecosystem years ago due to its inability to handle complex modern networking features such as multi-table policy routing, VLAN tagging, network namespaces, and modern IPv6 address structures. In modern Linux distributions (including Ubuntu, Debian, Red Hat, Fedora, and Arch), the definitive, universal command-line utility for managing network interfaces, IP addresses, ARP tables, and routing is the ip command (part of the iproute2 package).

Why iproute2 Replaced the Legacy net-tools Suite

The ip command communicates directly with the Linux kernel via the modern Netlink socket interface:

  • Direct Netlink Protocol Communication: Unlike ifconfig, which relies on outdated ioctl system calls, ip talks directly to the kernel’s Netlink subsystem, delivering instantaneous configuration updates and event notifications.
  • Unified Command Structure: Replaces dozens of fragmented legacy binaries (ifconfig, route, arp, netstat -r) with a single, consistent hierarchical syntax.
  • Advanced Routing & Policy Control: Supports multiple independent routing tables, policy routing rules, and isolated network namespaces for Linux containers (Docker and Podman).
  • Modern Abbreviation Syntax: Commands can be abbreviated cleanly (for example, typing ip a instead of ip address show).

Understanding the Hierarchical Syntax of the ip Command

Every ip command follows a predictable structure:

ip [options] OBJECT COMMAND [arguments]

The primary OBJECTS include:

  • link (or l): Physical and virtual network interface devices (Ethernet, Wi-Fi, bridges, loopback).
  • address (or a, addr): IPv4 and IPv6 protocol addresses assigned to interfaces.
  • route (or r): IP routing table entries and default gateway paths.
  • neigh (or n): Neighbour cache (ARP and IPv6 ND mappings).

Inspecting and Managing IP Addresses (ip addr)

To inspect active network addresses and adapters across your machine:

1. Displaying All Network Addresses

ip addr show

(Or simply: ip a).

The output displays all interfaces (e.g., eth0, enp3s0, wlan0), their MAC addresses (link/ether), assigned IPv4 addresses (inet), and IPv6 addresses (inet6).

2. Filtering by a Specific Interface

ip addr show dev eth0

3. Assigning a Temporary Static IP Address

To assign an IPv4 address with subnet mask (CIDR notation) to an interface:

sudo ip addr add 192.168.1.150/24 dev eth0

4. Deleting an Assigned IP Address

sudo ip addr del 192.168.1.150/24 dev eth0

Managing Network Interface States (ip link)

To view physical link statuses and toggle devices on or off:

1. Listing All Physical Interfaces

ip link show

2. Bringing an Interface Up or Down

Equivalent to the legacy ifconfig eth0 up and ifconfig eth0 down:

sudo ip link set dev eth0 down
sudo ip link set dev eth0 up

3. Modifying the Interface MTU (Maximum Transmission Unit)

To enable Jumbo Frames for high-speed local storage transfers (e.g., setting MTU to 9000 bytes):

sudo ip link set dev eth0 mtu 9000

Inspecting and Managing the Routing Table (ip route)

Routing rules determine which network gateway your Linux machine contacts to dispatch outbound packets:

1. Displaying the Active Routing Table

ip route show

(Or simply: ip r).

Look for the default via line, which identifies your default internet gateway IP address.

2. Adding a Default Gateway

sudo ip route add default via 192.168.1.1 dev eth0

3. Adding a Static Route to a Specific Subnet

To route all traffic destined for the 10.50.0.0/16 network through a secondary router at 192.168.1.254:

sudo ip route add 10.50.0.0/16 via 192.168.1.254 dev eth0

4. Deleting a Route

sudo ip route del 10.50.0.0/16

Inspecting the ARP / Neighbour Cache (ip neigh)

To view mappings between local IP addresses and physical MAC addresses (replaces the legacy arp -a command):

ip neigh show

To flush or clear the local ARP cache during network changes:

sudo ip neigh flush all

ip Command vs Legacy net-tools (Quick Reference)

Action Modern ip Command (iproute2) Legacy net-tools Command
View all IP addresses ip addr show (or ip a) ifconfig -a
Add an IP address ip addr add 192.168.1.50/24 dev eth0 ifconfig eth0 192.168.1.50 netmask 255.255.255.0
Disable an interface ip link set dev eth0 down ifconfig eth0 down
View routing table ip route show (or ip r) route -n or netstat -r
View ARP table ip neigh show arp -a

Making Configuration Changes Permanent

Changes executed directly via the ip command apply instantly to the running Linux kernel, but are ephemeral; they reset upon a system reboot. To make static IP assignments and routing permanent:

  • On Ubuntu / Debian: Edit your YAML network configuration in /etc/netplan/ and apply with sudo netplan apply.
  • On RHEL / CentOS / Rocky Linux: Use NetworkManager via nmcli or configure connection profiles in /etc/NetworkManager/system-connections/.

Frequently Asked Questions

Can I display coloured and formatted output with the ip command?

Yes. Pass the -c (colour) flag for readable, syntax-highlighted output: ip -c a or ip -c r.

How do I assign multiple IP addresses to a single interface without aliases?

Unlike ifconfig which required virtual alias devices (like eth0:1), the ip command natively supports multiple IPs on one physical device. Simply run sudo ip addr add 192.168.1.101/24 dev eth0 and both addresses will co-exist seamlessly.

Is the ip command available on minimal Linux server images?

Yes. The iproute2 package is an essential core component included on virtually every Linux distribution and container image.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.