+5 votes
1.3k views
asked in Linux by (3.8k points)

How to Configure interfaces on Red Centos  7


1 Answer

+6 votes
answered by (140k points)

Centos  7 is a posed some changes includes new commands and changes some ways to manage the system and something you'll always warn Centos 7 is that at boot network interfaces are disabled version. This is the system default, which is why you have to configure and activate network interfaces manually behavior. Here I tell you how to configure the network interfaces on Centos 7. 
 
 
I'll give you the steps to configure the interface using the terminal command for a server usually accessed remotely via ssh and then perform the commands you need. In this case must be done locally on the server or home computer since this service is not available. 
 
Identifying Network Interfaces 
 
In previous versions usually only had to find the network interface called eth0 and cambiabas the number 0 for the network interface that you wanted, but in Centos 7, the interface names are different and it is important to identify, for this you can use add the ip command in which you will apply the IP address of the system and the output of the command will display the name of each interface.
 
$ ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
The output of this command may not see any eth0 or eth1 as in previous versions, instead of this you will see sequences like the example "enp0s3". 
 
These new IDs are created based on certain rules and patterns that are now taken into account for naming network devices as indicated in the documentation for Red Hat 7: Networking_Guide -Consistent_Network_Device_Naming). 
 
Once you have identified the name of the interface to be configured can locate the corresponding file.
 
Configuring your Network Interface on Centos 7 
 
The next thing to do is to locate the configuration file that you modify the interface, so you must go the following path: / etc / sysconfig / network-scripts /
$ cd /etc/sysconfig/network-scripts/

Once there you will look for the file with the name you anteriormene located with the "ip add" command in this example is enp0s3, and you'll do with the command "ls"

$ ls
 ifcfg-enp0s3
 ifcfg-lo
 ...

This file called ifcfg-enp0s3 is where the settings of your network interface and must edit the "nano" command but with root privileges, so:

$ su -
# nano ifcfg-enp0s3

When editing the file you have to pay attention to the items marked with bold are the ones I recommend modifying

TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s3
UUID=b7... ...32a
ONBOOT=no
HWADDR=08:x:xx:xx:xx:A7
IPADDR0=
PREFIX0=
GATEWAY0=
DNS1=
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

The above parameters should be set as you enter the ISP or LAN administrator if a test server you can determine an appropriate IP for your local network. I leave an example of configuration settings for the above options (do not copy this as is, edit the values ​​without changing the name of the parameters):

BOOTPROTO=static
IPV6INIT=no
IPV6_AUTOCONF=no
ONBOOT=yes
IPADDR0=192.168.0.77
PREFIX0=24
GATEWAY0=192.168.0.1
DNS1=192.168.0.2
Once you modify the parameters changes recorded by the Ctrl + O keys to finish editing and exit using Ctrl + X. Now I'll explain the parameters usually modify: 
 
BOOTPROTO determines the type of configuration that the interface can be none (none), static (static) or dhcp (dynamic IP assignment by dhcp) usually always on a server must be configured as static. 
 
IPV6INIT IPV6_AUTOCONF Indica and whether to activate the IP protocol version 6 and reconfigure itself, in the example we select to not use it and not configure. 
 
ONBOOT if the network interface you are configuring should r

Ask a Question
Welcome to WikiTechSolutions where you can ask questions and receive answers from other members of the community.

You can ask a question without registration.

Categories

...