🐧 Linux Network Toolkit

Command reference organized by the questions you're trying to answer

← Back to Main Prep

State & Configuration

Questions: What's my network config? What interfaces do I have? What's my default gateway?

ip addr (ip a)
❓ What IP addresses are configured on my interfaces?
# Show all interfaces with IPs ip a # Show specific interface ip addr show eth0 # Show only IPv4 ip -4 a # Show only IPv6 ip -6 a
What success looks like:
2: eth0: link/ether 00:0c:29:xx:xx:xx inet 192.168.1.100/24 brd 192.168.1.255 scope global eth0 inet6 fe80::20c:29ff:fexx:xxxx/64 scope link
  • UP: Interface is enabled
  • inet: IPv4 address is assigned
  • /24: Subnet mask (255.255.255.0)
What failure looks like:
  • DOWN: Interface disabled - ip link set eth0 up
  • NO-CARRIER: Cable unplugged or no link
  • No inet: No IP assigned - check DHCP or set static
What to do next:
  • If no IP: Check DHCP logs or manually configure
  • If DOWN: sudo ip link set eth0 up
  • Check routes next: ip route
ip route (ip r)
❓ How does my system route traffic? What's my default gateway?
# Show routing table ip r # Show routes for specific destination ip route get 8.8.8.8 # Add route (requires sudo) sudo ip route add 10.0.0.0/24 via 192.168.1.1 # Delete route sudo ip route del 10.0.0.0/24
What success looks like:
default via 192.168.1.1 dev eth0 proto dhcp metric 100 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.100
  • default via X.X.X.X: Default gateway (where non-local traffic goes)
  • proto dhcp: Route learned from DHCP
  • proto kernel: Automatically added when IP configured
What failure looks like:
  • No default route: Can't reach internet
  • Wrong gateway: Traffic goes to wrong router
What to do next:
  • Test gateway: ping [gateway-ip]
  • Check specific route decision: ip route get 8.8.8.8
  • If no default route: Check DHCP or add manually
ip neigh (ARP cache)
❓ What MAC addresses has my system learned?
# Show neighbor cache (ARP table) ip neigh # Flush all entries sudo ip neigh flush all # Delete specific entry sudo ip neigh del 192.168.1.1 dev eth0
What success looks like:
192.168.1.1 dev eth0 lladdr aa:bb:cc:dd:ee:ff REACHABLE 192.168.1.50 dev eth0 lladdr 11:22:33:44:55:66 STALE
  • REACHABLE: Entry is valid and recently confirmed
  • STALE: Entry exists but hasn't been confirmed recently
  • DELAY/PROBE: System is verifying the entry
What to do next:
  • If no entry for gateway: ARP resolution may be failing
  • If FAILED state: Layer 2 connectivity issue
  • Test: ping [ip] should populate cache