How to Configure Network Static IP Address and Manage Services on RHEL/CentOS 7.0

This scope of this tutorial is to explain how we can edit and make changes to Network Configurations on RHEL/CentOS 7.0 from command line only, and, more specific how we can set up a Static IP addresses on network interfaces using system network scripts, which is a must be configured to serve Internet-facing network services, and how to configure or change RHEL/CentOS 7.0 system hostname.

Configure Network Interface in CentOS 7
Configure Static IP in Linux

Also will show you, how we can manage or disable unwanted system services, such as Network Manager, which is no longer needed in-case you use a manual static IP configured on network scripts, Avahi-Daemon which is, also, not needed on a server and represents a seriously security gap, unless you installed the server on your Laptop and you want to instantly browse your network for other services, and on the final will present you Network Manager Text User Interface – nmtui, a system utility that can ease the job of editing your system network settings with advanced Interface configurations like creating Bond, Bridge, Team and VLAN Interfaces.


  1. RHEL 7.0 Minimal System Installation
  2. Active RHEL 7.0 Subscriptions and Functional Repositories
  3. CentOS 7.0 Minimal System Installation

Also be aware that most of configurations offered by editing system files should not be performed from a remote location using SSH service until you establish an continue and reliable network connection using a fixed IP address.

Step 1: Disable Unwanted System Services

1. Before actually starting to do anything we need to make sure that our system has some necessary editing and networking tools like netstat, ifconfig, wget and curl installed, some of them will not be used on this step but
it’s better to have them installed for future configurations.

# yum install nano wget curl net-tools lsof
Install wget in Linux
Install wget in Linux
Install net-tools in Linux
Install net-tools in Linux
Install lsof in Linux
Install lsof in Linux

2. After the tools have installed run ifconfig to get your Network Interfaces settings and status, and, then run netstat or lsof command to check what services are running by default on our server.

# ifconfig
# netstat -tulpn
# lsof -i
netstat-tulpn Command
netstat-tulpn Command

3. The netstat command output is pretty self-explanatory and shows a list of sockets associated with their running program name.

If, for example, our system will not be used as a mail service you can stop Postfix master daemon which runs on localhost and, also stop and disable other unwanted services using the following commands – the only service I advise not to stop or disable for now is SSH, if you need remote control over server.

# systemctl stop postfix
# systemctl stop avahi-daemon
# systemctl disable postfix
# systemctl disable avahi-daemon
Stop Avahi Daemon
Stop Avahi Daemon
Stop Postfix Service
Stop Postfix Service

4. You can, also, use old init commands to stop or disable services but since Red Hat now implements systemd process and service management, you should better get used to systemctl command and use it often.

If you used Arch Linux then it should be a piece of cake to switch to systemd – although all init commands now are linked and pass-through systemd filter.

# service postfix stop
# chkconfig postfix off

5. If you want to get a list of all started services run service command and for an exhaustive report use systemctl.

# service --status-all
# systemctl list-unit-files
List All Services in Linux
List All Services in Linux
List All Services Report
List All Services Report

6. To manage services run systemctlcommand using the most important switches: start, stop, restart, reload, disable, enable, show, list-dependencies, is-enabled etc. followed by your service name.

Also, another important feature that systemctl command can also run on remote server through SSH service on a
specified host using –H option and perform the same actions as locally. For example, see the command and screenshot below.

# systemctl -H remote_host start remote_service
Run systemctl on Remote Server
Run systemctl on Remote Server

Step 2: Configuring Static IP and Set Hostname

7. Before starting editing Network Interface Card system files make sure that from now on and until you set static IP, you have physical or any other type of access to your server, because this step requires bringing down your network interface and connections.

Although it can be done smoothly without disrupting your connectivity and activate connection after reboot. There is no way you can test it before reboot, if you only have a single NIC attached. Still I will present you the entire method and indicate the steps needed to be avoided in case you want to maintain your connectivity and test it afterwards.

For beginning start by stopping and disabling NetworkManager service.

** Don’t run this command if you still want to maintain connection **
# systemctl stop NetworkManager.service
# systemctl disable NetworkManager.service

8. Now move to /etc/sysconfig/network-scripts/ path, open and choose your Network Interface you want to assign static IP for editing – to get all NICs names use ifconfig -a or ip -a commands.

# nano /etc/sysconfig/network-scripts/ifcfg-eno16777736

9. Use the next template to edit file and make sure that ONBOOT statement is set on YES , BOOTPROTO is set to static or none and don’t change HWADDR and UUID values provided by default.

Configure IP Address in CentOS 7
Configure IP Address in Linux

10. After finishing editing the file, close it and move to resolv.conf file if you want DNS servers enabled system wide.

# nano /etc/resolv.conf

Here just add your DNS servers using nameserver statement.

nameserver 192.168.1.

11. Now Network Interface is configured with a static IP, the only thing remaining is to restart your network or reboot your system and use ifconfig or ip command to view IP address and test configuration using ping command.

# systemctl restart network

NOTE: After restart use the newly static IP address configured to perform remote login with SSH.

# service network status
# ifconfig
# ip addr show
Start Newtork in Linux
Start Newtork in Linux

12. To adjust system hostname system-wide, open hostname and hosts file located on /etc path and edit both the following way.

Hostname File
# nano /etc/hostname

Here you can add just the name of the system but it’s a good idea to append the .dot domain to.

Hosts File
# nano /etc/hosts

Here add the same hostname as above on line before localhost.localdomain statements.              server.rheltest.lan  localhost.localdomain …
Set Hostname in CentOS 7
Set Hostname in Linux

To test if your hostname is correctly set use hostname command.

# hostname -s  # For short name
# hostname -f  # For FQDN mame

Step 3: Use Network Manager Text User Interface

13. NetworkManager Text User Interface (TUI) tool, nmtui, is a RHEL intuitive tool which provides a text interface to configure networking by controlling Network Manager, which helps editing advanced network settings such as assign static IP addresses to Network Interfaces, activate or disable a connection, edit WI-FI connections, set your system hostname or create advanced Network interfaces like InfiniBand, bond, bridge, team or VLAN.

NetworkManager-tui is installed by default in RHEL/CentOS 7.0, but if for some reasons its missing issue the following command to install it.

# yum install NetworkManager-tui

14. To start Network Manager Text User Interface run nmtui command and use TAB or arrow keys to navigate through and press Enter to select an option. If you want to directly edit or connect a specific interface run the following options.

# nmtui edit eno16777736
# nmtui connect eno16777736
NetworkManager Text User Interface
NetworkManager Text User Interface
Select Network Connection
Select Network Connection

If you want to set static IP you can, also, use Network Manager Text User Interface as a facile alternative to actually edit network interfaces files, with a limited number of options that method has to offer, but make sure Network Manager service is enabled and started on your system.

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

11 thoughts on “How to Configure Network Static IP Address and Manage Services on RHEL/CentOS 7.0”

  1. After 2 hours tests, Good all be fine, it works fine, just Added : In smb.conf file configuration in [Anonymous]

    1- be sure that your server has a static connection
    2- added user with password : smbpasswd -a username

    Thank For Author I have make a samba configuration in 2 hours

    I feel learning with quick manner in this site Thank you very much

  2. I also routinely disable NetworkManager on my servers, but do note that “nmtui” (and also nmcli) are NetworkManager clients, so you cannot use them if you have disabled NetworkManager.

  3. Excellent!. This is the ONLY post on setting static IP on Centos which is correct. Simple flow.

    All: Just follow the steps as is.

    Great explanation. Great job guys.

  4. Great article. The static IP configuration works great on my RHEL 7 server vm.

    Just have a question. The Red Hat documentation says that BOOTPROTO should be set to “none”. My copy of your configuration only works with BOOTPROTO=static as you used in your example. If I set it to none the ip address does not get updated. I am having some discussions with our Linux sys admins since they are insisting that I should follow only the Red Had docs and this is a problem as I can’t make it work with BOOTPROTO=none. Is there a reason why it only works with BOOTPROTO=static?

    • If it works with bootptoto=static then stick with this option as long as it does the job right! As far as i know it should work also with none (none actually specifies that no boot-time protocol should be used but the IP value from IPADDR= variable should be updated for NIC at boot time).

  5. @Ehwan Kho: Just use ip link show or ifconfig -a command and you should see all your NICs names. You can also use nmtui to edit your new card settings.

  6. How do I add a new network card – NIC? I tried using lspci | grep Ethernet, it display that it 2 cards. My question now how could I know its name? as they are not using the eth1, eth2 et al.. And I can’t see /etc/udev/rules.d/70-persistent-net.rules. Your thoughts are highly appreciated.

  7. In my opinion you can use both approaches, manual editing NICs interfaces or configure static IP using NM or nmtui if you dont have a GUI. But for a better control and flexibility over your NICs you should go with manual configurations, without NM. If you go with manual without NM don’t forget to use NM_CONTROLLED=no and ONBOOT=yes parameters.

    • please matie cezar can you teach me how to network a small firm.
      i will be happy if you can teach me form scratch to the level of networking a firm.
      i want to learn the installation and configuration

  8. I ALWAYS disable network manager on Servers, it’s too dynamic and wastes resources. Why Red Hat is pushing that crap I don’t know, but I haven’t met anyone who wants it on a server. It’s great for desktops, and laptops, but NOT servers.
    Also, the DNS settings need to stick to being setup in the resolv.conf file, not spread out in the ifcfg scripts. Keeps the config manageable and easy to troubleshoot.

  9. From going over the documentation on RHEL/CentOS 7, it appears that they’re really pushing for NetworkManager to be the default way to manage networking. For servers (not desktop) do you believe it’s best to disable NetworkManager and just assign static IPs normally as you have instructed or do you believing managing all the network through net manager is worth it?

    The reason I ask is because I only deal with servers (not desktops) and I’ve seen many times NetworkManger causing major network issues. So I’m still on the fence whether or not to do things through netManager. Specially considering that rhel 7 is using it by default.


Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.