How edit a NIC (Network Interface Card) on Centos 7

1). Check with the command ‘IP a' which NICs you have, and what they are called (for example ‘eno1’).

2). Change to the directory /etc/sysconfig/network-scripts/

The name of the file to be edited contains the NIC name. For example: ifcfg-eno1

3). Edit the file. E.g. with the NANO editor.

nano ifcfg-eno1

You’ll see something like this, in this case it’s for a fixed IP address.

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eno1
UUID=xxxxx (you’ll see a long unique code)
DEVICE=eno1
ONBOOT=yes
IPADDR=10.10.10.30 (or your IP address)
PREFIX=24 (which is the same as a DNS mask of 255.255.255.0)

 

A typical DHCP setting looks like this:

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=no
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eno2
UUID=xxxxx (you’ll see a long unique code)
DEVICE=eno1
ONBOOT=yes

4) Make changes and save them (in the case of NANO by ctr – O to save, and then ctr – X to quit).

5) Restart the network service as follows:

systemctl restart network

 

 

Scroll to Top