Fedora Network Administration via CLI: nmcli and nmtui Tips from Basic to Advanced

Fedora tutorial - IT technology blog
Fedora tutorial - IT technology blog

Why CLI is Still King for Fedora Network Administration

After using Fedora as my primary OS for over 2 years, I absolutely love its stability. But let’s be honest: no matter how beautiful the GNOME interface is, it becomes useless when you’re SSHing into a remote server. At that point, mastering nmcli and nmtui is no longer optional—it’s a requirement for survival.

Modern Fedora has fully transitioned to storing configurations in /etc/NetworkManager/system-connections/ using the .nmconnection format. Manually editing these files often leads to errors if you forget to reload the configuration. Using command-line tools allows you to change settings accurately and apply them immediately without a reboot.

Device vs. Connection: Don’t Get Them Confused!

Before typing commands, you need to clearly distinguish between these two concepts to avoid configuring the wrong object:

  • Device: This is the actual hardware, such as the LAN card enp3s0 or Wi-Fi card wlp2s0.
  • Connection: This is the configuration “profile” (IP, DNS, Gateway). A single network card can have multiple profiles (e.g., one for home, one for work), but only one profile can be active at a time.

1. nmtui: The Solution for Those Who Dislike Memorizing Commands

If you find nmcli parameters too complex, nmtui (Network Manager Text User Interface) is an excellent choice. It provides a pseudo-graphical interface right inside the Terminal window.

sudo nmtui

This tool helps you assign static IPs or change the Hostname in seconds using arrow keys and Enter. It’s particularly useful for quick operations without looking up documentation.

2. Professional Static IP Configuration with nmcli

Suppose you need to assign a static IP to the enp1s0 card for a Web Server. Instead of fumbling with the GUI, execute this precise command sequence:

# Check the active connection name
nmcli connection show

# Set IP 192.168.1.100, Gateway, and DNS
nmcli con mod "Wired connection 1" ipv4.addresses 192.168.1.100/24
nmcli con mod "Wired connection 1" ipv4.gateway 192.168.1.1
nmcli con mod "Wired connection 1" ipv4.dns "8.8.8.8, 1.1.1.1"
nmcli con mod "Wired connection 1" ipv4.method manual

# Activate changes
nmcli con up "Wired connection 1"

As soon as you switch to manual, NetworkManager will prioritize your input and ignore DHCP. This is the fastest way to fix a network entity within an internal system.

3. Deploying Network Bonding: Increasing Bandwidth and Redundancy

In an enterprise environment, losing network connectivity for even a second can cause significant damage. I often combine two 1Gbps network cards into a single 2Gbps Bond port or run it in redundancy mode (active-backup).

Initializing the Bond Master Interface

nmcli con add type bond con-name bond0 ifname bond0 bond.options "mode=active-backup"

Assigning Physical Cards (Slaves) to the Bond

nmcli con add type ethernet slave-type bond con-name bond0-port1 ifname eth0 master bond0
nmcli con add type ethernet slave-type bond con-name bond0-port2 ifname eth1 master bond0

After activating with nmcli con up bond0, you can check the status at /proc/net/bonding/bond0. If a cable is pulled, the system will switch to the remaining one in less than 100ms, ensuring uninterrupted service.

4. VPN Management: More Than Just a GUI

Fedora supports WireGuard and OpenVPN exceptionally well via CLI. This is extremely convenient when you want the VPN to connect automatically upon server boot.

Quickly Importing OpenVPN Configurations

sudo nmcli connection import type openvpn file /path/to/office_vpn.ovpn
nmcli con up office_vpn

Setting Up WireGuard

With WireGuard, you can create a direct connection:

nmcli connection add type wireguard con-name wg-work ifname wg0 autoconnect yes

Use the command nmcli connection edit wg-work to fine-tune the Private Key and Peer. This approach allows you to manage the routing table centrally, avoiding IP conflicts between home and office networks.

Troubleshooting When the Network “Disappears”

If you’ve finished configuring and still can’t ping the network, don’t panic. Check the device status first or verify your firewalld settings:

nmcli device status

If you accidentally edited a configuration file with vim, force NetworkManager to recognize the new file with the following command:

sudo nmcli connection reload
sudo nmcli connection load /etc/NetworkManager/system-connections/my-office.nmconnection

To investigate errors in detail, monitor the real-time logs: journalctl -u NetworkManager -f. All notifications regarding IP rejection or incorrect Wi-Fi passwords can be found here.

Conclusion

Mastering nmcli helps you professionalize your workflow on Fedora. Much like configuring SELinux on Fedora, instead of wasting time clicking through menus, a few scripted command lines will help you deploy network infrastructure faster and more accurately. Try disabling the GUI and managing your network entirely via CLI next week; you’ll see a significant difference in productivity.

Share: