CentOS 7 comes with Network Manager, a service that runs by default and has a graphical, text as well as command line interface. You can use Network Manager to create, edit and remove interfaces and it can be used to configure Ethernet, WiFi, Mobile, DSL and PPPoE connections. Using the GUI is pretty straight forward. To invoke the text interface just type: # nmtuiThe command line interface can be invoked by the command nmcli. For example to get a list if all NICs (Ethernet cards):# nmcli dHowever you may not want to run NetworkManager service on your server because of various reasons. Advanced configuration options are limited and it does not yet support some device types like ISDN, IPSec to name a few.
Centos 7 Installation Guide
If you decide to disable NetworkManager service and use just the network service, you can configure your network by editing some config files and restarting the network service. List all network interfacesTo list and manipulate devices, routing, tunnels etc you can use the ip command.# ip link show1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT qlen 1link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:002: enp0s3: mtu 1500 qdisc pfifofast state UP mode DEFAULT qlen 1000link/ether 08:00:27:66:17:c2 brd ff:ff:ff:ff:ff:ff3: enp0s8: mtu 1500 qdisc pfifofast state UP mode DEFAULT qlen 1000link/ether 08:00:27:c3:a3:a7 brd ff:ff:ff:ff:ff:ffConfigure DHCP on an interfaceEdit the config files in /etc/sysconfig/network-scripts directory. In this directory, each device should have a configuration file named ifcfg.
If you want to configure DHCP on device enp0s3, edit the file ifcfg-enp0s3For the device to be activated at startup time ste ONBOOT=yesTo enable DHCP, set BOOTPROTO=dhcpLeave the other settings as such and restart networking # systemctl restart network Configure static IPEdit the config file /etc/sysconfig/network-scripts/ifcfg. Using the example interface enp0s3 from above, the file to edit is /etc/sysconfig/network-scripts/ifcfg-enp0s3. Change ONBOOT to 'yes' if you want interface to be UP on boot. Change BOOTPROTO to 'static' and set a IP address and network mask as shown below.ONBOOT=yesBOOTPROTO=staticIPADDR=10.16.1.108NETMASK=255.255.255.0You could also add a Gateway address as below.GATEWAY=10.16.1.1The default gateway can also be added to /etc/sysconfig/network file like below:NETWORKING=yesGATEWAY=10.16.1.1Remember to restart the network service # systemctl restart networkThe ip command can be used to verify the settings # ip addrThe ip command can be also used to change IP addresses, but the change won't be permanent. For permanent changes you need to edit the config files and restart networking.