Pcornel
Linux

Linux Networking

Cheat sheet · https://pcornel.dk/topic.php?topic=129

Back to the Topic

Answer

Linux networking is configured in the kernel (interfaces, addresses, routes, neighbour cache, netfilter) and made persistent by one management tool: NetworkManager, systemd-networkd (often via Netplan on Ubuntu) or ifupdown.

Remember

The ip command shows and changes the live kernel state, but changes are lost at reboot — make them in the managing tool. Find out first which tool owns the interface; two tools fighting over one interface cause settings that revert.

First checks

  • ip -br addr — interfaces and addresses
  • ip route — routing table and default route
  • ip neigh — ARP/neighbour cache
  • ip route get <dest> — route, interface and source chosen for a destination
  • nmcli device status / networkctl — which tool manages each interface

Commands

ip
Inspect or change Linux networking objects through the iproute2 interface.
ip addr
Inspect or change IPv4 and IPv6 addresses assigned to network interfaces.
ip link
Inspect or change interface link state, MTU, MAC address and link-layer properties.
ip -s link show [DEV]
Interface state and counters.
ip route
Inspect or change kernel routing-table entries and route-selection attributes.
ip neigh
Inspect or change ARP and IPv6 neighbor-cache entries and reachability state.
nmcli
Inspect or change NetworkManager devices, connections, addressing and activation state.
ip addr show [DEV]
Display interface addresses and state.
ip neigh show [to ADDRESS]
Display ARP/ND neighbor cache.
ip -br link
ip -br addr
ip route get <destination>
ss -lntup
show vlan brief

Verify in this order

management tool applies config → interface up with carrier → address → route/gateway → neighbour resolved → remote reachable

Where it usually breaks

First mismatch in link/interface → address/namespace → route/neighbor → firewall/policy → socket/daemon → DNS/TLS/SSH/application peer path; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=129

Confirmation

Confirm action

Continue?