LinuxXX · Linux Network ConfigurationInterface config
Linux interface configuration - addresses, MTU, offloads
What you'll learn
- Assign a static IPv4 and IPv6 address to an interface
- Change MTU and verify it took effect
- Recognise common offload settings and their trade-offs
- Tune ring buffers and other low-level parameters
Prerequisites
Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09
Interface configuration on Linux happens at three levels:
- Logical: address, route, MTU.
- Driver: ring buffers, queue count, interrupt coalescing.
- Hardware / firmware: offloads, RSS, firmware settings.
The right tool depends on the level. ip works at level 1;
ethtool works at levels 2 and 3.
Configure a static address
ip addr add 10.0.0.10/24 dev eth0
ip addr add 2001:db8:85a3:1::10/64 dev eth0
ip link set eth0 up
For a working host, you also need a route:
ip route add default via 10.0.0.1
And, for IPv6, a default route via the link-local router:
ip -6 route add default via fe80::1 dev eth0
These are all transient. They are useful for debugging but disappear at reboot. Persistent configuration is covered in the Netplan, NetworkManager, and systemd-networkd lessons.
MTU
MTU (Maximum Transmission Unit) is the largest IP packet an interface will send without fragmenting. The default on Ethernet is 1500 bytes. Jumbo frames use 9000; some tunnels require 1400-1450.
ip link show eth0 # current MTU
ip link set eth0 mtu 1400 # change it
ip link set eth0 mtu 9000 # jumbo frames
A wrong MTU causes silent packet loss. Symptoms:
- Small flows work; large transfers fail.
- TCP connections stall after handshake.
ping -M do -s 1472fails;ping -M do -s 1400works.
Offloads
Network cards can do work in hardware to relieve the CPU:
| Offload | What it does | Trade-off |
|---|---|---|
| TSO (TCP Segmentation Offload) | NIC splits large TCP segments | Saves CPU; can confuse some packet captures |
| GRO (Generic Receive Offload) | Coalesces incoming packets | Reduces CPU; can hurt latency measurements |
| LRO (Large Receive Offload) | Older, similar to GRO | Deprecated in favour of GRO |
| RSS (Receive Side Scaling) | Hashes flows to queues | Needed for multi-queue performance |
| checksum offload | NIC computes IP/TCP/UDP checksum | Saves CPU; needed for high throughput |
| scatter-gather | DMA from multiple buffers | Saves CPU |
ethtool -k eth0 # show all offloads
ethtool -K eth0 tso off # disable TSO
ethtool -K eth0 gro off # disable GRO
Common reason to disable offloads: packet captures look wrong, or an application measures sub-microsecond latency and the coalescing adds jitter.
Ring buffers
The NIC ring buffer holds packets between the NIC and the kernel:
ethtool -g eth0 # show current and max
ethtool -G eth0 rx 4096 # set the rx ring to 4096
A small ring buffer drops packets under load (visible in
ifconfig errors or ip -s link). Increase the ring if
you see drops and CPU has headroom.
Tuning low-level driver parameters
ethtool -c eth0 # show coalesce settings
ethtool -C eth0 adaptive-rx on # adaptive rx coalescing
ethtool --set-priv-flags eth0 <flag> on # driver-specific
Driver-specific settings vary. Always read the driver’s documentation before changing private flags.
Verify configuration took effect
ip -br addr show eth0
ip -br link show eth0
ip route show dev eth0
ethtool eth0
ethtool -k eth0 | grep -E 'tcp-segmentation|generic-receive'
If ip shows the change but the application still misbehaves,
restart the application or the network service. Some
applications cache the MTU at startup.
Knowledge check
Knowledge check · 3 questions
Q1. How do you set the MTU on eth0 to 1400?
Q2. TCP Segmentation Offload (TSO) saves CPU by having the NIC segment large TCP segments.
Q3. Which of the following are reasons to disable a network offload? Select all that apply.
Passing score: 75%. Answers are checked in this browser.