Every interface carries addresses, and the routing table decides which interface a packet leaves through. The ip command from iproute2 shows both; ifconfig belongs to the retired net-tools package.
ip -br addr
ip routelo UNKNOWN 127.0.0.1/8 10.255.255.254/32 ::1/128 eth0 UP 172.23.167.60/20 fe80::215:5dff:fe5f:9750/64 default via 172.23.160.1 dev eth0 proto kernel 172.23.160.0/20 dev eth0 proto kernel scope link src 172.23.167.60
lo is loopback: 127.0.0.1 and ::1 never leave the machine. eth0 holds the address other machines use, and /20 means the first 20 bits name the network, so 172.23.160.0 to 172.23.175.255 is reached directly and everything else goes to the default gateway. 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 are private ranges (RFC 1918); a cloud instance usually has one on eth0, while its public address lives on the provider's gateway and is translated in both directions.
Ubuntu 225 Server describes interfaces in YAML under /etc/netplan/, and Netplan (1.2 in Ubuntu 26.04) generates configuration for systemd-networkd on servers or NetworkManager on desktops. Cloud images use DHCP; a fixed address looks like this (203.0.113.0/24 is a documentation range):
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses: [203.0.113.10/24]
routes:
- to: default
via: 203.0.113.1
nameservers:
addresses: [1.1.1.1, 9.9.9.9]Keep the file at mode 600. sudo netplan try applies a change and rolls it back after 120 seconds unless you confirm it, which saves you when a typo would cut off your SSH session. netplan generate --root-dir /tmp/np only translates; for this file it wrote a networkd unit with Address=203.0.113.10/24, two DNS= lines and Gateway=203.0.113.1.
Names are resolved by systemd-resolved on the stub address 127.0.0.53, after /etc/hosts. resolvectl status lists the upstream servers. Never hand-edit /etc/resolv.conf, which is generated, and add the server's own hostname to /etc/hosts, or sudo prints "unable to resolve host" on every call.