iproute2

networkingLinux
The iproute2 command is one of the most frequently used commands in Linux/Unix-like operating systems. iproute2 A collection of utilities for controlling TCP/IP networking and traffic control in Linux

Quick Reference

Command Name:

iproute2

Category:

networking

Platform:

Linux

Basic Usage:

iproute2 [options] [arguments]

Common Use Cases

    Syntax

    Various commands including ip, tc, ss, bridge, rtacct, rtmon, etc.

    Options

    Command Description
    ip Show/manipulate routing, devices, policy routing and tunnels
    tc Traffic control for bandwidth management and packet scheduling
    ss Socket statistics, replacement for netstat
    bridge Configure bridge devices
    rtacct Network statistics tools
    rtmon Route monitoring utility
    lnstat Linux network statistics
    nstat Network statistics tools
    routel List routes with pretty output format
    ifstat Interface statistics
    genl Generic netlink utility

    Examples

    How to Use These Examples

    The examples below show common ways to use the iproute2 command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

    # Common commands in the iproute2 package
    ip addr show
    Display IP addresses and property information.
    ip link set dev eth0 up
    Bring interface eth0 up.
    ip route show
    Display the routing table. tc qdisc add dev eth0 root netem delay 100ms Add 100ms of network delay to eth0 using traffic control. ss -tuln Show TCP and UDP listening sockets with numeric addresses. bridge link show Show bridge port information. ip -s link Show interface statistics. ip route add default via 192.168.1.1 Add a default route through 192.168.1.1. ip neigh show Show the ARP/neighbor table. ip rule list List routing policy rules.

    Try It Yourself

    Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

    Understanding Syntax

    Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

    Notes

    iproute2 is a collection of utilities for network configuration in Linux, developed as a replacement for the older net-tools package (which includes commands like ifconfig, route, arp, netstat). The iproute2 suite provides more advanced features and a consistent command syntax across its various tools. Key aspects of iproute2: 1. Comprehensive Networking Suite: iproute2 includes numerous utilities that collectively provide control over almost all aspects of networking on Linux systems, from basic interface configuration to advanced traffic shaping and policy-based routing. 2. Modern Replacement: The suite was designed to replace the aging net-tools package, offering more functionality and better support for modern networking features like policy routing, traffic control, and network namespaces. 3. Core Components: - ip: The central utility for most network configuration tasks - tc: Traffic Control for QoS (Quality of Service) and packet scheduling - ss: Socket Statistics tool (replacement for netstat) - bridge, rtmon, rtacct, lnstat, etc.: Additional specialized utilities 4. Consistent Interface: Unlike the disparate commands in net-tools, iproute2 utilities follow a more consistent command structure and syntax. 5. Advanced Features Support: iproute2 fully supports modern networking features including: - Network namespaces - Policy-based routing - Traffic control and shaping - VLANs, VXLANs, and other virtual networking - Multipath routing - IPv6 6. Kernel Integration: iproute2 is tightly integrated with the Linux kernel networking stack and uses the netlink socket interface for communication with the kernel, enabling access to more advanced features. 7. Standard in Modern Distributions: Most current Linux distributions include iproute2 by default and many system management tools and scripts now rely on these utilities rather than the older net-tools commands. The iproute2 package is essential for modern Linux network administration, especially in complex environments like data centers, container deployments, and software-defined networking setups. While it has a steeper learning curve than the older net-tools, its power, flexibility, and consistent design make it the preferred choice for network configuration in Linux.

    Related Commands

    These commands are frequently used alongside iproute2 or serve similar purposes:

    Use Cases

    Learn By Doing

    The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the iproute2 command works in different scenarios.

    $ iproute2
    View All Commands