Skip to content

How to edit a CentOS network connection from the command line

If you’re struggling to edit your CentOS network connections from the command line, Jack Wallen shows you a tool that will ease that struggle.

What happens, after you install a GUI-less instance of CentOS as a server OS and you find the network connection isn’t working? What do you do? Are you required to manually edit the network configuration files? Fortunately not.

More about Networking

With CentOS, there’s a built-in tool to help you edit those connections. The tool is called nmtui (NetworkManager Text User Interface). This tool makes it quite easy to manage those network connections on a terminal-only instance of CentOS. 

Let me show you how to use it. 

Log in to your CentOS machine and, at the terminal, type sudo nmtui

In the resulting window, select Edit A Connection with your cursor keys and hit Enter on your keyboard. In the next window, select the NIC to be configured, hit Tab, select Edit (using your cursor keys), and hit Enter. You should now find yourself in the Edit Connection window, where you can enter all of the details for your connection. 

SEE: Network security policy (TechRepublic Premium)

You’ll use your keyboard cursor keys to navigate through the various configuration options. You’ll find plenty of options to change, so make sure to look through everything carefully. Once you have the NIC setup exactly as you need it, scroll down (using your cursor keys) to the bottom of the window and select OK. 

Hit Enter on your keyboard and the changes are saved. Go back to the first nmtui window and select Activate A Connection. Select the connection you just edited and tab to Deactivate. 

Once the connection has deactivated, you’ll then need to reactivate it by selecting the connection, tabbing to Activate, and hitting Enter on your keyboard. Your changes are now applied and everything should be good to go. 

Congratulations, you just edited your CentOS network connection, without a GUI.  

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.

Also see

Man working in network server roomMan working in network server room

Image: Getty Images/iStockphoto