Network Configuration
Concepts
The ip Command
The ip command is the modern way to view and configure network interfaces. It replaces the deprecated ifconfig.
Viewing Configuration
# Show all interfaces with IP addresses
ip addr show
# or shorthand:
ip a
# Show a specific interface
ip addr show enp0s3
# Show only IPv4
ip -4 addr show
# Show link status (up/down, MAC addresses)
ip link show
# Show routing table
ip route show
# or:
ip r
Understanding ip addr Output
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP
link/ether 08:00:27:ab:cd:ef brd ff:ff:ff:ff:ff:ff
inet 192.168.1.100/24 brd 192.168.1.255 scope global dynamic enp0s3
inet6 fe80::a00:27ff:feab:cdef/64 scope link
| Field | Meaning |
|---|---|
enp0s3 |
Interface name (en=ethernet, p0s3=PCI bus location) |
UP |
Interface is active |
mtu 1500 |
Maximum Transmission Unit (packet size) |
link/ether |
MAC address |
inet 192.168.1.100/24 |
IPv4 address and subnet |
dynamic |
Obtained via DHCP |
inet6 fe80::... |
IPv6 link-local address |
Interface Naming
| Old Style | New Style | Type |
|---|---|---|
eth0 |
enp0s3, ens33 |
Ethernet |
wlan0 |
wlp2s0 |
Wi-Fi |
lo |
lo |
Loopback (always 127.0.0.1) |
Temporary Configuration (Lost on Reboot)
# Add an IP address
sudo ip addr add 192.168.1.200/24 dev enp0s3
# Remove an IP address
sudo ip addr del 192.168.1.200/24 dev enp0s3
# Bring an interface up or down
sudo ip link set enp0s3 up
sudo ip link set enp0s3 down
# Add a default route
sudo ip route add default via 192.168.1.1
# Add a static route
sudo ip route add 10.0.0.0/8 via 192.168.1.1
These changes are temporary — they are lost on reboot. For persistent configuration, use Netplan (Ubuntu) or /etc/network/interfaces (Debian).