Interfaces & Routing
The ip command (iproute2)
Older Linux networking tools (ifconfig, route, netstat) are officially deprecated - still present on some systems for compatibility, but no longer maintained or guaranteed to show everything the kernel can do. The modern replacement is one unified tool: ip, from the iproute2 package.
| Command | Shows / does |
|---|---|
ip addr (ip a) | Interface addresses |
ip link | Interface state (up/down) |
ip route (ip r) | Routing table |
ip addr add 192.168.1.5/24 dev eth0 | Add an address |
ip link set eth0 up | Bring interface up |
ip route add default via 192.168.1.1 | Set default gateway |
The routing table, shown by ip route, is how the kernel decides which network interface (and which next hop) to send outbound traffic through, based on the destination address. The default gateway is the catch-all entry: "if no more specific route matches, send it here" - typically your router, which then forwards it onward toward the wider internet.
$ ip -br addr
lo UNKNOWN 127.0.0.1/8
eth0 UP 192.168.1.10/24
ip -br ("brief") gives a compact one-line-per-interface summary: lo is always the loopback interface (talking to yourself, at 127.0.0.1), and eth0 here is up with an address on a /24 network.
Warning: Every change you make withip(adding an address, setting a route) is applied live to the running kernel, but is not saved anywhere - reboot, and it's gone as if it never happened. This makesipperfect for quick troubleshooting or temporary test changes, but the wrong tool for permanent configuration. To make network settings survive a reboot, use NetworkManager (nmcli, covered next) or your distro's persistent network config files instead.