How to configure a static IP address on RHEL 8

To configure a static IP address on Red Hat Enterprise Linux (RHEL) 8, you can follow these steps:

  1. Open the /etc/sysconfig/network-scripts/ifcfg-interface file, where interface is the name of the network interface you want to configure. For example, if you want to configure the eth0 interface, you would open the /etc/sysconfig/network-scripts/ifcfg-eth0 file.
  2. Change the BOOTPROTO line to BOOTPROTO=static. This tells the system to use a static IP address rather than DHCP.
  3. Add the following lines to the file, replacing the values with your desired IP address, netmask, and gateway:
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
  1. Save and close the file.
  2. Bring the interface down and up:
sudo ifdown interface
sudo ifup interface
  1. Verify the new IP address by running the following command:
ip addr show interface
  1. You can also check the routing table by running this command:
ip route show

It is important to note that these steps are for basic use case, your network setup might be different and you might need to configure DNS, routes and other settings. It is also recommend to backup your configuration before doing any changes.

Leave a Comment