For this instance, we use a Red Hat Enterprise Linux (RHEL) Server 7.9. Unlike the latest Ubuntu version that commonly utilizes YAML-based configuration and the netplan
tool for setting up IP addresses of network interfaces, the RHEL network interface can be configured using the configuration script located in /etc/sysconfig/network-scripts
. Several interface configurations and scripts have been automatically generated by RHEL during the installation process. The configuration file is named by its device name such as ifcfg-eth0
for the eth0
device. If we run our RHEL in a VMware-based virtual machine, the device name might be shown up like ens35
or such things.
The following configuration is an example of a network configuration with DHCP enabled.
#/etc/sysconfig/network-scripts/ifcfg-eth0
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
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="eth0"
UUID="666aaacc-1234-4567-bbcc-bcdef5588999"
DEVICE="ens33"
ONBOOT="yes"
If we want a static IP configuration. Some parameters can be added or modified.
BOOTPROTO="none"
PREFIX="24"
IPADDR="192.168.0.123"
GATEWAY="192.168.0.1"
DNS1="192.168.0.1"
DNS2="8.8.8.8"
The UUID can be generated using the uuidgen
command in the bash shell of RHEL. The last, we need to restart the network service by the following command.
systemctl restart network
Comments
Post a Comment