Ethernet HOWTO: wired networking on Linux with ip, nmcli and netplan
Almost every wired network card works on Linux out of the box. When one does not, the cause is usually one of four things: no driver, missing firmware, no link (cable or switch), or the wrong network configuration. This page checks them in that order, then shows how to set addresses with each of the configuration tools that current distributions use.
Step 1: is the card detected?
ip -br link
lspci -nnk | grep -iA3 ethernet
lsusb
ip -br link lists the network interfaces the kernel has created, one per line. If your card is there, the driver is loaded. lspci -nnk shows each PCI device with its vendor and device numbers (such as [8086:15b8]) and the line Kernel driver in use:. If that line is missing, no driver claimed the card. USB adapters show up in lsusb instead.
Look at the kernel log for the driver's messages, including firmware errors:
sudo journalctl -k -b | grep -iE 'eth|enp|eno|firmware'
sudo ethtool -i enp3s0
ethtool -i prints the driver name, its version and the firmware version. Some cards need a firmware file from the linux-firmware package or your distribution's equivalent. A message that a firmware file could not be loaded means that package is missing or too old. Since Debian 12, Debian’s non-free firmware packages are in the non-free-firmware archive component, so make sure it is enabled in your APT sources.
Interface names
Names like eth0 have been replaced by predictable names that do not change when you add a card. All wired names start with en:
eno1: onboard card, index from the firmware.ens1: card in hot-plug slot 1.enp5s0: card at PCI bus 5, slot 0.enx54ee75cb1dc0: named after the MAC address (common for USB adapters).
To see which names udev would give a card: udevadm test-builtin net_id /sys/class/net/enp5s0.
Step 2: is there a link?
$ ip -br link show enp3s0
enp3s0 UP 52:54:00:12:34:56 <BROADCAST,MULTICAST,UP,LOWER_UP>
$ sudo ethtool enp3s0 | grep -E 'Speed|Duplex|Auto-negotiation|Link detected'
Speed: 1000Mb/s
Duplex: Full
Auto-negotiation: on
Link detected: yes
LOWER_UP and Link detected: yes mean the card sees a working cable and switch port. NO-CARRIER means it does not: check the cable, the switch port, and that the interface is up (sudo ip link set dev enp3s0 up). To find which socket belongs to which interface, sudo ethtool -p enp3s0 10 blinks its LED for 10 seconds.
A link at 100Mb/s on gigabit hardware usually means a damaged cable or a cable with only two pairs connected. Leave auto-negotiation on; forcing speed on one side only (ethtool -s enp3s0 speed 100 duplex full autoneg off) often causes a duplex mismatch and slow, error-filled traffic. Error counters help here:
ip -s link show enp3s0
sudo ethtool -S enp3s0 | grep -iE 'err|drop|crc'
Step 3: who manages the network?
Only one tool should configure a given interface. Find out which one your system uses:
systemctl is-active NetworkManager systemd-networkd networking
ls /etc/netplan/ 2>/dev/null
| System | Usual tool |
|---|---|
| Fedora, RHEL, Alma, Rocky; most desktops | NetworkManager (nmcli) |
| Ubuntu Server | netplan, which writes systemd-networkd configuration |
| Ubuntu Desktop | netplan with NetworkManager |
| Debian | NetworkManager on desktops; servers may use systemd-networkd or the classic /etc/network/interfaces (ifupdown, the networking service) |
Whatever the tool, the ip command shows the result. It replaces the old ifconfig, route and arp commands:
| Old | Today |
|---|---|
ifconfig | ip addr (or ip -br addr) |
ifconfig eth0 up | ip link set dev eth0 up |
route -n | ip route |
arp -n | ip neigh |
mii-tool | ethtool |
Working over SSH. Changing the address, gateway or profile of the interface your SSH session uses can cut you off. Have console access ready, or use netplan try, which rolls back by itself.
For a quick test you can set an address by hand. It lasts until the interface or the machine restarts, and a running network manager may remove it sooner:
sudo ip addr add 192.0.2.10/24 dev enp3s0
sudo ip route add default via 192.0.2.1
NetworkManager (nmcli)
nmcli device status
nmcli connection show
nmcli device show enp3s0
DHCP is the default for a new wired profile. A static address:
sudo nmcli connection add type ethernet con-name office ifname enp3s0 \
ipv4.method manual ipv4.addresses 192.0.2.10/24 \
ipv4.gateway 192.0.2.1 ipv4.dns "192.0.2.53 192.0.2.54"
sudo nmcli connection up office
Change an existing profile with modify, then bring it up again to apply:
sudo nmcli connection modify office ipv4.addresses 192.0.2.20/24
sudo nmcli connection up office
Back to DHCP: sudo nmcli connection modify office ipv4.method auto ipv4.addresses "" ipv4.gateway "". Profiles are stored in /etc/NetworkManager/system-connections/.
systemd-networkd
Files in /etc/systemd/network/ (and the packaged ones in /usr/lib/systemd/network/) are sorted by name and the first matching file wins, so start yours with a low number such as 10- or 20-; the packaged files start at 80-. DHCP on every wired card:
# /etc/systemd/network/20-wired.network
[Match]
Name=en*
[Network]
DHCP=yes
A static address on one card:
# /etc/systemd/network/10-enp3s0.network
[Match]
Name=enp3s0
[Network]
Address=192.0.2.10/24
Gateway=192.0.2.1
DNS=192.0.2.53
sudo systemctl enable --now systemd-networkd
sudo networkctl reload
networkctl status enp3s0
The DNS= line is used by systemd-resolved; if your system does not run it, set the resolver in /etc/resolv.conf instead.
netplan (Ubuntu)
Netplan reads YAML files from /etc/netplan/ and generates configuration for networkd or NetworkManager. A static address:
# /etc/netplan/50-static.yaml
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
dhcp4: false
addresses:
- 192.0.2.10/24
routes:
- to: default
via: 192.0.2.1
nameservers:
addresses: [192.0.2.53, 192.0.2.54]
sudo chmod 600 /etc/netplan/50-static.yaml
sudo netplan try
sudo netplan apply
netplan try applies the change and rolls it back after 120 seconds unless you confirm, so a typo cannot cut off a remote machine. Netplan warns that permissions are “too open” if other users can read the file, hence the chmod. Indentation matters in YAML: use spaces, never tabs. The old gateway4: key is deprecated; use routes with to: default as above.
Debian ifupdown
If systemctl is-active networking says active, the configuration is in /etc/network/interfaces:
auto enp3s0
iface enp3s0 inet static
address 192.0.2.10/24
gateway 192.0.2.1
Apply with sudo ifdown enp3s0 && sudo ifup enp3s0, preferably from a console. For DHCP, the stanza is iface enp3s0 inet dhcp.
Bonding, VLANs and jumbo frames
Bonding joins two cards for failover or more bandwidth. Active-backup needs no switch support; 802.3ad (LACP) needs a switch configured for it. With NetworkManager:
sudo nmcli connection add type bond con-name bond0 ifname bond0 \
bond.options "mode=active-backup,miimon=100" ipv4.method auto
sudo nmcli connection add type ethernet ifname enp3s0 controller bond0 port-type bond
sudo nmcli connection add type ethernet ifname enp4s0 controller bond0 port-type bond
sudo nmcli connection up bond0
cat /proc/net/bonding/bond0
Older NetworkManager releases call these options master and slave-type; if controller is rejected, use those names.
A VLAN interface for VLAN 10 on a trunk port: sudo ip link add link enp3s0 name enp3s0.10 type vlan id 10 (or nmcli connection add type vlan dev enp3s0 id 10). For bridges, see the Bridge HOWTO.
Jumbo frames (MTU 9000) can speed up storage networks, but only if every card and switch on the segment uses the same MTU: sudo ip link set dev enp3s0 mtu 9000, then make it permanent (802-3-ethernet.mtu in NetworkManager, MTUBytes= in a networkd [Link] section, mtu: in netplan). Test with ping -M do -s 8972 192.0.2.20; if it fails, something in the path has a smaller MTU.
Troubleshooting checklist
- Card listed by
ip -br link? If not: driver or firmware (step 1). LOWER_UPandLink detected: yes? If not: cable, switch port, interface down.- Address present in
ip -br addr? If not: the configuration tool or the DHCP server. - Gateway reachable:
ping -c 3 192.0.2.1? If not: wrong subnet or VLAN. See the IP Subnetworking mini-HOWTO. - Names resolve:
resolvectl query kernel.orgorgetent hosts kernel.org? If not: DNS settings.
The classic Ethernet HOWTO, last updated in 2003 and focused on ISA and early PCI cards, is kept by the LDP at tldp.org.
Sources
- ip(8), man7.org and ip-link(8), man7.org
- ethtool(8), man7.org
- lspci(8), man7.org
- systemd.net-naming-scheme(7), freedesktop.org
- nmcli(1), NetworkManager and nm-settings-nmcli(5), NetworkManager
- systemd.network(5), freedesktop.org
- systemd.netdev(5), freedesktop.org
- Netplan YAML configuration reference, netplan.readthedocs.io
- Netplan configuration examples, netplan.readthedocs.io
- netplan try, netplan.readthedocs.io
- NetworkConfiguration, Debian Wiki
- Firmware, Debian Wiki