Skip to main content

IP Command Cheatsheet

By Dejan Panovski Updated on Download PDF

Quick reference for using ip command to manage addresses, routes, links, and network diagnostics in Linux

The `ip` command is the standard Linux tool for managing network interfaces, IP addresses, routes, ARP/neighbor entries, and policy routing. This cheatsheet covers the most common commands you will use in daily administration and troubleshooting.

Basic Syntax

Use this structure for most ip operations.

CommandDescription
ip [OPTIONS] OBJECT COMMANDGeneral ip command syntax
ip -br aShow addresses in brief format
ip -c aShow colorized output
ip -4 aShow only IPv4 addresses
ip -6 aShow only IPv6 addresses

Show Interfaces and Addresses

Inspect links and assigned IP addresses.

CommandDescription
ip link showShow all network interfaces
ip link show dev eth0Show one interface
ip addr showShow all IP addresses
ip addr show dev eth0Show addresses on one interface
ip -br addrBrief interface and address overview

Add and Remove IP Addresses

Assign or remove IP addresses on interfaces.

CommandDescription
sudo ip addr add 192.168.1.50/24 dev eth0Add IPv4 address
sudo ip addr del 192.168.1.50/24 dev eth0Remove IPv4 address
sudo ip addr add 2001:db8::50/64 dev eth0Add IPv6 address
sudo ip addr flush dev eth0Remove all addresses from interface
ip addr show dev eth0Verify interface addresses

Bring Interfaces Up or Down

Enable, disable, or rename network links.

CommandDescription
sudo ip link set dev eth0 upBring interface up
sudo ip link set dev eth0 downBring interface down
sudo ip link set dev eth0 mtu 9000Change MTU
sudo ip link set dev eth0 name lan0Rename interface
ip -br linkShow link state quickly

Routing Table

Inspect and manage network routes.

CommandDescription
ip route showShow IPv4 routing table
ip -6 route showShow IPv6 routing table
ip route get 8.8.8.8Show route used for destination
sudo ip route add default via 192.168.1.1Add default gateway
sudo ip route del defaultRemove default gateway
sudo ip route add 10.10.0.0/16 via 192.168.1.254 dev eth0Add static route

Neighbor (ARP/NDP) Table

View and manage neighbor cache entries.

CommandDescription
ip neigh showShow neighbor table
ip neigh show dev eth0Show neighbors for one interface
sudo ip neigh flush dev eth0Clear neighbor entries on interface
sudo ip neigh del 192.168.1.10 dev eth0Remove a neighbor entry
ip -s neighShow neighbor statistics

Policy Routing

Work with multiple routing tables and rules.

CommandDescription
ip rule showList policy routing rules
sudo ip rule add from 192.168.10.0/24 table 100Route source subnet using table 100
sudo ip route add default via 10.0.0.1 table 100Add default route to custom table
sudo ip rule del from 192.168.10.0/24 table 100Remove policy rule
ip route show table 100Show routes in table 100

Network Namespaces

Inspect or run commands inside network namespaces.

CommandDescription
ip netns listList network namespaces
sudo ip netns add ns1Create namespace
sudo ip netns exec ns1 ip aRun ip a inside namespace
sudo ip netns del ns1Delete namespace
ip -n ns1 routeShow routes in namespace

Troubleshooting

Fast checks for common network issues.

IssueCheck
No IP assigned to interfaceip addr show dev eth0
Interface is downip link show dev eth0 then sudo ip link set dev eth0 up
Wrong default routeip route show and verify default via ...
Cannot reach destinationip route get DESTINATION_IP
Stale ARP/neighbor entrysudo ip neigh flush dev eth0

Use these articles for detailed networking workflows.

GuideDescription
Linux ip Command with ExamplesComplete ip command guide
How to Find Your IP Address in LinuxPublic and private IP lookup methods
Traceroute Command in LinuxPath and hop diagnostics
UFW CheatsheetFirewall rules quick reference