0% found this document useful (0 votes)
93 views

How To Configure CentOS 7 Network Settings - Serverlab

The document provides instructions for configuring static and DHCP network settings on CentOS 7. To configure a static IP, edit the interface configuration file to add IP address, netmask, and gateway settings and restart the interface. To configure DHCP, edit the interface file to set the DHCP parameter to yes and restart the interface. Network settings can be validated using the ip command to check the interface address and settings.

Uploaded by

NaReN Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views

How To Configure CentOS 7 Network Settings - Serverlab

The document provides instructions for configuring static and DHCP network settings on CentOS 7. To configure a static IP, edit the interface configuration file to add IP address, netmask, and gateway settings and restart the interface. To configure DHCP, edit the interface file to set the DHCP parameter to yes and restart the interface. Network settings can be validated using the ip command to check the interface address and settings.

Uploaded by

NaReN Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

6/21/2021 How to Configure CentOS 7 Network Settings - Serverlab

Configuring a Static IP
A static address is one that is permanently assigned to one host. It is an address that is manually
configured by the administrator.

. Open the configuration file for your network interface.

vi /etc/sysconfig/network-scripts/ifcfg-eth0

. Add the following settings to the file:

DEVICE=enp3s0

ONBOOT=yes
IPADDR=192.168.1.10

NETMASK=255.255.255.0

GATEWAY=192.168.1.1

. Save your changes and exit


. Your new settings will not apply until the network interface is restarted or brought online. If you are
remotely logged into the server and modifying the network settings of the interface you are
connected to, reboot the system.
. Restarting the network interface.

ifdown enp0s3

ifup enp0s3

Configuring DHCP Settings


A dynamic address is one leased from a DHCP server when a system boots or a network interface
comes online. The following settings configure a network interface for DHCP.

. Open the configuration file for your network interface.

vi /etc/sysconfig/network-scripts/ifcfg-

https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-configure-centos-7-network-settings/ 1/2
6/21/2021 How to Configure CentOS 7 Network Settings - Serverlab

. Add the following settings. If a configuration already exists, modify it to look like the following:

DEVICE=enp3s0

ONBOOT=yes
DHCP=yes

. Save your changes and exit


. Your new settings will not apply until the network interface is restarted or brought online. If you are
remotely logged into the server and modifying the network settings of the interface you are
connected to, reboot the system.
. Restarting the network interface.

ifdown enp0s3

ifup enp0s3

Validate Your Network Settings


You will want to ensure that your network interface has applied your new settings. You can use the
IP command to output its settings.

ip a show enps3s0

The output will display basic information about the interface, such as device name, IP address,
MAC address, etc. The following is an example of the output.

https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-configure-centos-7-network-settings/ 2/2

You might also like