Linux Ethernet Configuration: Set Up Wired Network
In this article
Configuring Ethernet on Linux ensures your system has a stable, high-speed network connection, essential for servers, streaming, gaming, or remote access. Unlike Wi-Fi, wired connections don’t rely on signal strength or interference and often provide lower latency and higher throughput. This guide covers static and DHCP configuration using command-line tools common across most Linux distributions. Before you begin, ensure your system has a physical Ethernet port and a properly connected cable. You’ll also need administrator privileges to modify network settings.
What You'll Need
- A Linux system with an Ethernet port
- An Ethernet cable connected to a router or switch
- Administrator (sudo) access
- Basic familiarity with the terminal
Step-by-Step
- Identify your Ethernet interface by running
ip link show. Look for an interface named something likeeth0,enp3s0, oreno1. Note the exact name — it varies by system. - Check if the interface is up by looking for the word
UPin the output. If it saysDOWN, bring it up withsudo ip link set [interface-name] up, replacing[interface-name]with your actual interface. - Verify network connectivity by running
ping -c 4 8.8.8.8. If you get replies, your system already has DHCP connectivity. If not, proceed to configure manually. - To use DHCP (automatic IP assignment), run
sudo dhclient [interface-name]. This requests an IP address from your router. Wait a few seconds, then runip addr show [interface-name]to confirm an IP was assigned. - To set a static IP, edit the network configuration file. On systemd-networkd systems (Ubuntu 18.04+, CentOS 8+, Fedora), create or edit
/etc/systemd/network/10-eth.networkwithsudo nano /etc/systemd/network/10-eth.network. Add:
[Match]
Name=[interface-name]
[Network]
DHCP=no
Address=192.168.1.100/24
Gateway=192.168.1.1
DNS=8.8.8.8
DNS=8.8.4.4
- On older systems using NetworkManager, use
nmcli:sudo nmcli con add type ethernet ifname [interface-name] ipv4.addresses 192.168.1.100/24 ipv4.gateway 192.168.1.1 ipv4.dns 8.8.8.8,8.8.4.4 ipv4.method manual. - On systems using netplan (Ubuntu 18.04+), edit the YAML file in
/etc/netplan/(e.g.,01-netcfg.yaml). Replace its content with:
network:
version: 2
ethernets:
[interface-name]:
dhcp4: no
addresses:
- 192.168.1.100/24
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
- Apply netplan changes with
sudo netplan apply. For systemd-networkd, restart withsudo systemctl restart systemd-networkd. - Test the configuration: ping your gateway (
ping -c 4 192.168.1.1), then ping an external site likeping -c 4 google.com. - Make the configuration persistent across reboots. On most modern systems, the above methods are persistent by default. If not, ensure the network service is enabled:
sudo systemctl enable systemd-networkdorsudo systemctl enable NetworkManager.
Common Mistakes
- Using the wrong interface name — double-check with
ip linkbefore applying settings. - Typing an incorrect subnet mask (e.g., using /32 instead of /24) — this breaks local network access.
- Configuring a static IP in the same range as your router’s DHCP pool — this causes IP conflicts. Always choose an IP outside the DHCP range (e.g., if DHCP gives 192.168.1.100–199, use 192.168.1.200).
- Forgetting to set a gateway, which prevents internet access even if local ping works.
- Editing the wrong config file — different distributions use different tools (netplan vs. NetworkManager vs. systemd-networkd). Check your distribution’s documentation.
Tips
- Use
ip route showto see your current routing table — this confirms the default gateway is set. - If you’re configuring a server, leave DHCP enabled for simplicity unless you need a fixed IP for DNS or port forwarding.
- Always back up config files before editing:
sudo cp /etc/netplan/01-netcfg.yaml /etc/netplan/01-netcfg.yaml.bak. - Use
nmcli dev show [interface-name]to see detailed interface information, including connection state and IP assignments. - For headless systems, configure Ethernet before disconnecting the console — you may lose access if misconfigured.
Troubleshooting
- If
ping 8.8.8.8fails butping 192.168.1.1works, your gateway is reachable but DNS or outbound routing is broken. Checkcat /etc/resolv.confto confirm DNS servers are listed. If empty, manually addnameserver 8.8.8.8to that file temporarily. - If the interface won’t come up, check for driver issues:
dmesg | grep -i ethernet. Look for errors likeeth0: Failed to initialize. - If NetworkManager is running but not managing the interface, run
nmcli device status. If the interface showsunmanaged, edit/etc/NetworkManager/NetworkManager.confand remove or comment out the lineunmanaged-devices=interface-name:[interface-name]. - On some systems, Ethernet is disabled in BIOS/UEFI. Reboot, enter firmware settings, and ensure the onboard LAN is enabled.
- If no network interface appears at all, the hardware may be missing or faulty. Run
lspci | grep -i ethernetto verify detection. If nothing appears, the card may need replacement.
Frequently Asked Questions
How do I find my Ethernet interface name in Linux?
Runip link show. The interface names are listed as eth0, enp3s0, eno1, etc. Look for the one marked as UP or with a MAC address.