

To do so, add or modify the above lines in the following configuration file.

These files are named with the "ifcfg-" prefix and the name of the interface.įor instance, to configure a static IP address for “enp0s3” with the following details, see the below steps: IP address = 192.168.1.70
#CENTOS 7 STATIC IP AND INTERFACE UP ON BOOT HOW TO#
When the system boots, it uses these files to determine what interfaces to bring up and how to configure them. Valid_lft forever preferred_lft forever Method-2: Assign a static IP address by editing network scripts files on CentOS 7/8 and RHEL 7/8įor each network interface, a configuration file is created under the ‘/etc/sysconfig/network-scripts’ directory, which controls the interfaces for individual network devices. You can double confirm, if the new IP address is banded with the interface “enp0s3” by using ip command. To view the details, run: # cat /etc/sysconfig/network-scripts/ifcfg-enp0s3 All the new configuration has been saved permanently to the file “etc/sysconfig/network-scripts/ifcfg-enp0s3”. You have successfully configured the interface “enp0s3” with static IP. To save these changes and to reload the interface, run: # nmcli con up enp0s3 To view detailed DHCP configuration of enp0s3, run: Inet6 fe80::a00:27ff:fe97:132e/64 scope linkĪs we can see from the above output, We have an interface named "enp0s3", which has a dynamic IP. # ip aġ: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 Identifying interfacesīefore proceeding to configure a static IP address, use the ip command to identify all the available Ethernet interfaces on your system. It is used to create, display, edit, delete, activate, and deactivate network connections. The nmcli is a command line tool, which is used for controlling NetworkManager and reporting network status. Method-1: Configure a static IP address using nmcli command on CentOS 7/8 and RHEL 7/8

Static IP address can be configured on Red Hat system using below two methods: In this article, we’ll demonstrate how to assign or configure Static IP address on RHEL 7/8 and CentOS 7/8 Server’s.
