Networking Basics
The core concepts behind a Linux machine's network configuration - interfaces, IP addresses, and routing - and the modern `ip` command for inspecting all three.
Before troubleshooting anything network-related, it helps to know the three things that have to be correct for a machine to reach anything at all: it needs an address, an interface that address is bound to, and a route telling it where to send traffic that isn't on its local network.
Interfaces
A network interface represents a physical or virtual network connection
(eth0, enp3s0, wlan0, lo for loopback). Modern distributions use
predictable interface names like enp3s0 (encoding the PCI bus location)
rather than the old eth0-style names, precisely because eth0 could
shift between boots if hardware changed.
ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 ...
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ...
ip link is the modern replacement for the older ifconfig, which is
deprecated and not installed by default on many current distributions.
IP addresses
ip addr show
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ...
inet 192.168.1.42/24 brd 192.168.1.255 scope global enp3s0
192.168.1.42/24 is CIDR notation: the address, followed by how many
leading bits define the network portion. /24 means the first 24 bits
(three octets) are the network - so this machine is on the
192.168.1.0/24 network alongside anything else in the
192.168.1.1–192.168.1.254 range.
Private address ranges (not routable on the public internet, reserved for
internal networks) are 10.0.0.0/8, 172.16.0.0/12, and
192.168.0.0/16 - recognizing these ranges by sight is useful for
telling at a glance whether you're looking at an internal or a public
address.
Routing
Once an address is confirmed, the next question is where traffic actually goes:
ip route show
default via 192.168.1.1 dev enp3s0
192.168.1.0/24 dev enp3s0 proto kernel scope link src 192.168.1.42
The default via ... line is the default gateway - where traffic goes
when its destination isn't on a directly connected network. If that line
is missing or wrong, everything on the local network works but nothing
beyond it does, a distinct failure mode from a DNS or firewall problem.
See Troubleshooting Connectivity
for a step-by-step process that includes checking exactly this.
How addresses get assigned
Most machines get their address automatically via DHCP, negotiated at
boot or when a cable is plugged in / a network is joined. Managed by
different services depending on distro: NetworkManager (most desktop
distros, and increasingly servers too), systemd-networkd (common on
minimal/server systems and Arch), or Netplan (Ubuntu's YAML configuration
layer, which itself typically configures NetworkManager or
systemd-networkd underneath). Check which is active with:
systemctl status NetworkManager
systemctl status systemd-networkd
Testing basic reachability
ping -c 4 192.168.1.1 # is the gateway reachable at all?
ping -c 4 8.8.8.8 # is anything outside the local network reachable?
Successful pings to a local address but not an external one point at routing or a further-out problem, not the local interface - see DNS and Resolution for the next thing to check once basic IP connectivity is confirmed.