Frequently Asked Question

How do I see my IP address and routing table?

ip addr (or ip a) lists every interface on the machine with its assigned addresses, MAC, MTU, and link state. Look for the line beginning inet to see the IPv4 address and CIDR prefix (e.g. inet 192.168.1.42/24), and inet6 for IPv6. ip link shows just the link-layer view without addresses, which is what you want when you're tracking down a cable that's down or an interface that's NO-CARRIER.

ip route (or ip r) prints the routing table. The line beginning default via is the default gateway, the router that handles any destination not on a directly connected network. ip route get 8.8.8.8 asks the kernel which route it would use for a specific destination, which is the fastest way to confirm that a particular packet would actually take the path you think it would.

Further reading and video