To configure a static IP address on Red Hat Enterprise Linux (RHEL) 8, you will need to perform the following steps:
sudo vi /etc/sysconfig/network-scripts/ifcfg-<interface>
IPADDR=<static IP address> NETMASK=<netmask> GATEWAY=<default gateway>
Save the changes to the configuration file and exit the text editor.
Restart the network service to apply the changes:
sudo systemctl restart network
ip
command:ip addr show <interface>
Alternatively, you can use the nmcli
tool to configure a static IP address. To do so, follow these steps:
nmcli
command with the connection
and modify
options, and specify the interface and the new IP address:nmcli connection modify <interface> ipv4.addresses <static IP address>/<netmask>
nmcli connection modify <interface> ipv4.gateway <default gateway>
nmcli connection modify <interface> ipv4.method manual
sudo systemctl restart network
ip
command:ip addr show <interface>