Configure networking

Fedora uses NetworkManager to manage network connections, with nmcli and nmtui as the primary tools for configuration from the command line or a terminal UI.

Networking on Fedora

You plugged in your new Fedora machine, opened the terminal, and realized the network is either not working or configured exactly wrong for your lab. Maybe you need a static IP for a server role, or your Wi-Fi keeps dropping because the profile is fighting with a wired connection. You tried editing /etc/sysconfig/network-scripts/ifcfg-eth0 out of habit from old Red Hat documentation, but that file doesn't exist anymore. Fedora uses NetworkManager now. Everything goes through nmcli, nmtui, or the keyfiles in /etc/NetworkManager/system-connections/. Get the profile right, and the network stays up. Get it wrong, and you lose access to the box.

How NetworkManager manages connections

NetworkManager does not just toggle interfaces on and off. It manages connections as profiles. Think of a connection profile like a saved configuration for a specific cable or Wi-Fi network. You can have a profile for your home Wi-Fi and a profile for your office Wi-Fi. NetworkManager watches the hardware. When it sees the office router, it activates the office profile. When you move home, it switches.

This decoupling means you can change the IP address or DNS without touching the hardware settings. The hardware stays the same. The profile changes. This is why nmcli connection show lists profiles, not just devices. The device is the wire or the chip. The connection is the rules for how that device talks to the world. A single device can have multiple profiles saved. Only one profile can be active on a device at a time.

Check the device state before editing profiles. Half the time the device is disconnected because no profile is bound to it.

Inspect the current state

Before you change anything, see what NetworkManager thinks is happening. The nmcli command is the primary interface. It talks directly to the daemon and reflects the live state.

nmcli device status
# Shows the physical state of every interface.
# 'connected' means a profile is active and the link is up.
# 'disconnected' means the device is up but no profile is applied.
# 'unmanaged' means NetworkManager is ignoring the device entirely.
nmcli connection show
# Lists all saved profiles.
# The 'NAME' column is what you use to modify or delete a connection.
# The 'DEVICE' column shows which interface the profile is currently active on.

Configure Wi-Fi

Wi-Fi requires scanning and connecting. NetworkManager handles the handshake and saves the credentials.

nmcli device wifi list
# Scans for available access points.
# Look for the SSID you want. Note the security type in the 'SECURITY' column.
# WPA2 and WPA3 are standard. Open networks show '--'.
nmcli device wifi connect "MySSID" password "MyPassword"
# Creates a new profile and activates it immediately.
# NetworkManager saves the credentials securely. You don't need to run this again.
# The profile name defaults to the SSID.

Set a static IP address

Static IPs are common for servers and lab environments. The critical flag is ipv4.method manual. Without it, NetworkManager ignores your address and asks the router for one via DHCP.

nmcli connection add type ethernet ifname eth0 con-name my-static \
  ipv4.addresses 192.168.1.100/24 \
  ipv4.gateway 192.168.1.1 \
  ipv4.dns "1.1.1.1 8.8.8.8" \
  ipv4.method manual
# Creates a new profile named 'my-static' bound to interface 'eth0'.
# 'ipv4.method manual' tells NetworkManager to ignore DHCP and use the addresses you provided.
# Without this flag, the connection will try DHCP and your static IP will be ignored.
# The '/24' defines the subnet mask. Adjust for your network.
nmcli connection up my-static
# Activates the profile.
# If the interface is already up, this applies the new settings immediately without a reboot.
# NetworkManager handles the transition gracefully.

Verify the method is manual. A profile with ipv4.method auto and static addresses set will still use DHCP.

Edit keyfiles directly

You can edit the configuration files directly. This is useful for backups, version control, or bulk edits. The files are INI-style keyfiles stored in /etc/NetworkManager/system-connections/.

sudo nano /etc/NetworkManager/system-connections/my-static.nmconnection
# Edit the keyfile. Changes here persist across reboots.
# Never edit files in /usr/lib/NetworkManager/system-connections/. Those are package defaults.
# Editing /usr/lib/ files will be overwritten on the next package update.
nmcli connection reload
# Forces NetworkManager to re-read the keyfiles from disk.
# Without this, your edits sit on disk until the daemon restarts or the system reboots.
# NetworkManager caches profiles in memory for performance.

Reload the connection after editing keyfiles. Memory and disk drift apart fast if you skip this step.

Verify the configuration

Don't guess. Check the IP and the route. The ip command shows the kernel state. nmcli shows the profile state. Both should match.

ip addr show eth0
# Confirms the interface has the IP address you assigned.
# Look for 'inet 192.168.1.100/24'.
# If the address is missing, the profile is not active or the method is wrong.
nmcli connection show my-static | grep ipv4
# Verifies the profile settings match what you expect.
# Check 'ipv4.method' is 'manual' and 'ipv4.addresses' is correct.
# This shows the saved configuration, not necessarily the live state.

Check the IP address before you blame the cable. Half the time the profile is active but the IP is wrong.

Common pitfalls and errors

The most common error is setting ipv4.method auto while providing addresses. NetworkManager prefers DHCP. You will get a random IP from the router, and your static config is useless. The command will succeed, but the result is not what you want.

Interface name drift breaks profiles. Fedora uses predictable network interface names. If you clone a VM, the MAC address changes, and the name might change from eth0 to eth1. Your profile is bound to eth0. It won't activate. You will see this error:

Error: Connection activation failed: No suitable device found for this connection.

Fix this by editing the profile to remove the ifname constraint or update it to the new name.

nmcli connection modify my-static connection.interface-name ""
# Removes the interface name constraint.
# The profile will activate on any available ethernet device.
# Use this when you expect hardware changes or VM cloning.

Firewall divergence blocks traffic. NetworkManager handles IP and routing. It does not handle ports. If you set up a web server and can't reach it, check firewalld.

firewall-cmd --state
# Confirms the firewall daemon is running.
# If it's not running, start it with 'systemctl start firewalld'.
firewall-cmd --zone=public --add-service=http --permanent
# Adds HTTP to the persistent configuration.
# The '--permanent' flag writes to disk. It does not affect the running firewall yet.
firewall-cmd --reload
# Applies the persistent changes to the runtime configuration.
# Always reload after adding permanent rules. Otherwise the runtime and persistent configs diverge.

Reload the firewall after every rule change. Runtime and persistent configs diverge fast if you forget.

Debugging with logs

When things break, nmcli gives you the state, but journalctl gives you the reason. NetworkManager logs everything.

journalctl -xeu NetworkManager
# Shows recent logs for the NetworkManager unit.
# The '-x' flag adds explanatory text for common errors.
# The '-e' flag jumps to the end of the log.
# Read the last 20 lines. Look for 'Error' or 'Failed'.
# This is the standard muscle-memory command for checking service logs.

Read the log before guessing. The error message usually points to the exact misconfiguration.

Choose the right tool

Use nmcli when you need to script network changes or integrate configuration into automation tools.

Use nmtui when you are on a headless server and prefer a menu-driven interface over memorizing command syntax.

Use the keyfiles in /etc/NetworkManager/system-connections/ when you need to version control your network configuration or perform bulk edits across multiple profiles.

Use the GUI settings app when you are on a desktop and only need to toggle Wi-Fi or change a single IP address occasionally.

Stay on DHCP unless you have a specific reason for a static IP. Static IPs introduce manual maintenance and conflict risks that DHCP avoids.

Where to go next