How to configure networking in CentOS Desktop with command line

If you want to configure networking in CentOS Desktop by using command line utilities, you should be aware that networking on CentOS Desktop is by default managed by a daemon with GUI interface, which is called NetworkManager. This means that whenever you want to change network configuration, you are supposed to do so via NetworkManager. Any change made otherwise will be lost or overwritten by NetworkManager later.

So the first step to configuring networking using command line on CentOS Desktop is to disable NetworkManager, and enable network service.

To disable NetworkManager permanently on CentOS, do the following.

$ sudo service NetworkManager stop
$ sudo chkconfig NetworkManager off

Then, activate network service instead.

$ sudo service network start
$ sudo chkconfig network on

Once NetworkManager is disabled, you can now configure networking simply by editing files in /etc/sysconfig/network-script, as described in the post.

When you are done with configuring all existing interfaces, restart network to activate the change.

$ sudo /etc/init.d/network restart

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.
Your name can also be listed here. Write for us as a freelancer.

One thought on “How to configure networking in CentOS Desktop with command line

  1. I wanted to modify the DNS config in CLI. But the modification to /etc/resolv.conf will usually be overwritten by NetworkManager.
    Instead of disabling NetworkManager, I changed its config under /etc/sysconfig/networking/profiles/default/. Then it works well.

Leave a comment

Your email address will not be published. Required fields are marked *