ip Command Guide for Inspecting and Configuring Network Interfaces
ip is the modern Linux tool for showing and configuring what your machine’s network connections look like — interfaces, IP addresses, routes, and neighbors.
What is ip, and Why Use It?
ip is part of the iproute2 package, which replaces a pile of older networking tools (ifconfig, route, arp, netstat) with one consistent command. The subcommand you will use most is ip addr (often abbreviated ip a), which shows every network interface on the machine, its MAC address, and its assigned IP addresses. Everything else — routes, DNS-related configuration, link state — hangs off sibling subcommands.
Why Learn ip?
- It answers “what is my IP?” — the single most common question in remote work, answered by one short command.
ifconfigis deprecated — most distributions still ship it for compatibility, butipis what new systems, guides, and documentation assume.- One tool, many jobs — interfaces, addresses, routes, and ARP tables all come from
ip, so you learn one syntax family instead of four.
If you only learn one command from this section, make it
ip addr show. It tells you how your machine is connected to the world.
1. Show All Interfaces and Their Addresses
The everyday form of the command:
ip addr show
Output, trimmed to one interface:
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:ab:cd:ef brd ff:ff:ff:ff:ff:ff
inet 192.168.1.42/24 brd 192.168.1.255 scope global dynamic enp0s3
valid_lft 86397sec preferred_lft 86397sec
inet6 fe80::a00:27ff:feab:cdef/64 scope link
valid_lft forever preferred_lft forever
Read it like this:
2: enp0s3— interface number and name.enp0s3is the predictable name for the first Ethernet card; wireless cards are usually namedwlan0orwlp2s0.state UP— the interface is physically connected and enabled.link/ether 08:00:27:ab:cd:ef— the MAC (hardware) address.inet 192.168.1.42/24— the IPv4 address, with/24meaning “the local subnet is 192.168.1.1–255”.lo— the loopback interface, always127.0.0.1; every machine has one and it never leaves the machine.
The abbreviated form does the same thing:
ip a
2. Show Only One Interface
Filter by name when you do not want the whole list:
ip addr show enp0s3
ip addr show wlan0
Useful when you have several interfaces (Ethernet, Wi-Fi, a VPN tunnel, a Docker bridge) and want just the one you care about.
3. Find Your Machine’s Local IP Address
To answer “what address do other machines on my LAN use to reach me?”:
ip -4 addr show scope global
The -4 restricts output to IPv4, and scope global filters out link-local addresses (169.254.x.x) and the loopback. If you only want the bare address:
ip -4 -o addr show scope global | awk '{print $4}'
-o prints each record on one line so awk can pull out the fourth field (the address with its prefix).
Note: this shows your private address. To find your public IP (as the internet sees it), query an external service instead:
curl ifconfig.me.
4. Check Which Interfaces Are Up or Down
Interface state matters when troubleshooting:
ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> state UP
3: wlan0: <BROADCAST,MULTICAST> state DOWN
state UP with LOWER_UP means the cable is in and the link is negotiated. state DOWN means the interface has been administratively disabled or has no carrier (no cable, no Wi-Fi association).
5. Show the Routing Table
Where does traffic for a given destination go?
ip route show
default via 192.168.1.1 dev enp0s3 proto dhcp metric 100
192.168.1.0/24 dev enp0s3 proto kernel scope link src 192.168.1.42
The default via 192.168.1.1 line is your gateway — the router everything else goes through. If this line is missing, your machine can talk to its local subnet but nothing beyond it. That is the first thing to check when “the network is broken”.
6. Show the ARP / Neighbor Table
Which IP addresses have been seen on the local network?
ip neigh show
192.168.1.1 dev enp0s3 lladdr a4:2b:b0:11:22:33 REACHABLE
192.168.1.50 dev enp0s3 lladdr d8:31:cf:44:55:66 STALE
REACHABLE means the neighbor answered recently; STALE means “I learned this a while ago and haven’t re-confirmed”. Handy when you suspect an IP is in use by the wrong machine.
7. Bringing Interfaces Up and Down (Administrative)
ip can also change configuration. The classic pair:
sudo ip link set enp0s3 down
sudo ip link set enp0s3 up
This is a soft reset of the interface — often the fastest fix when a connection has hung. Be careful: if you are connected through that interface (for example over SSH), taking it down disconnects you.
These changes do not survive a reboot. Persistent configuration lives in files like
/etc/netplan/(Ubuntu) or/etc/NetworkManager/— use those for permanent changes.
Common Pitfalls
- Using
ip addroutput as ififconfigprinted it — the two tools use different labels (inetvsinet addr); old tutorials will confuse you if you mix them up. - Forgetting the loopback — seeing
127.0.0.1underlois normal, not a misconfiguration. - Expecting
ipchanges to persist — link and address changes made withipvanish on reboot; permanent settings go in your distribution’s network config files. - Reading
state UNKNOWNonloas a problem — the loopback interface legitimately reports this.
Related Pages
| Page | Relationship |
|---|---|
| ifconfig | The deprecated tool ip replaced; same job, older syntax |
| ping | Once you know your address, test reachability |
| traceroute | Follow the route ip route describes |
| ss | Shows open connections on the interfaces ip configures |
ip Cheatsheet
| Command | What it does |
|---|---|
ip a | Show all interfaces with addresses |
ip addr show enp0s3 | Show one interface |
ip -4 addr show scope global | Show only global IPv4 addresses |
ip -4 -o addr show scope global | awk '{print $4}' | Print just the IPv4 addresses |
ip link show | Show link state (up/down, MAC, MTU) |
ip route show | Show the routing table and default gateway |
ip neigh show | Show the neighbor (ARP) table |
sudo ip link set enp0s3 down | Disable an interface |
sudo ip link set enp0s3 up | Enable an interface |