Configuring CentOS 6/7 Network Interface

This manual will explain how to configure network interface.

Viewing interfaces

Enter the command that will list all interfaces of the server

ifconfig -a

To configure an interface, create a configuration file for it, enter the command:

touch /etc/sysconfig/network-scripts/ifcfg-ens34

 (Important! : a network interface may have a different name in your server; in such case, you need to specify correct interface name instead of "ens34" at the end of the command)

Installing Nano

We need an editor to make the following settings. Install it from the repository. We will use the editor "nano".

Enter the following command:

yum install nano

During the installation process, you will be asked whether you agree to continue the installation. Tick 'agree'nano_0.png:

Now when the editor is installed, our configuration file can be edited.

Configuring interface

Enter the command:

nano /etc/sysconfig/network-scripts/ifcfg-Ваш интерфейс

The interface editor has opened

Enter the following values, each with a new line:

DEVICE=Your Intf
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.0.1 (Your ip-addr)
NETMASK=255.255.255.0 (Your masc)

E.g.:

Save the changes „Ctrl + O“ and "Enter" , Exit the editor „Ctrl + X“

Starting interface

Enter the command:

ifup Your interface

Let's restart the network services of our server:

service network restart

E.g.:

After successful restart, enter:

ifconfig -a

E.g.:


The interface we configured is ready for use