iproute2 commands

12 commands, each with a one-line explanation. Click a command to copy it, or its title for details.

Commands 12 shown

  • ip addr add 10.0.0.5/24 dev <name> && ip addr show dev <name>

    Assign a secondary IP/prefix live; note: not persisted across reboot

    network · troubleshooting

  • ip link set dev <name> mtu 9000 && ip link set dev <name> up

    Set jumbo MTU and bring link up; note: path MTU must match end-to-end

    network · performance

  • ip -j a | jq -r '.[] | select(.operstate=="UP") | .ifname + " " + (.addr_info[]?.local // "-")'

    Machine-readable interface dump; list UP links with their local IPs

    observability · network

  • ip route get <ip>

    Show the exact route, src IP and oif the kernel picks for a destination

    network · troubleshooting · debug

  • ip rule add from <ip> table 100 && ip route add default via 192.168.1.1 dev <name> table 100

    Route by source IP via a separate table; check with ip rule show

    network · security · troubleshooting

  • ip netns add test && ip netns exec test ip -br a

    Create an isolated network namespace and run commands inside it

    network · k8s · debug

  • tc qdisc add dev <name> root netem delay 100ms loss 1% && tc -s qdisc show dev <name>

    Simulate WAN latency/packet loss for testing; remove with tc qdisc del

    network · performance · troubleshooting

  • tc qdisc del dev <name> root

    Drop the root qdisc to restore normal traffic after netem testing

    network · performance

  • ip monitor all

    Live stream of route/link/addr/neigh changes; great for flapping debug

    monitoring · network · debug

  • bridge fdb show br <name>; bridge link show

    Inspect L2 forwarding DB (MAC->port) and bridge port states

    network · troubleshooting · k8s

  • ss -tip state established '( dport = :443 )'

    Show rtt/cwnd/retrans per socket for 443; pinpoint slow/lossy peers

    ss · performance · network · debug

  • ss -K dst <ip> dport = :8080

    Forcibly close matching sockets (kernel>=4.9); needs CONFIG_INET_DIAG_DESTROY

    ss · network · troubleshooting · security