To configure a static IP address on Red Hat Enterprise Linux (RHEL) 8, you can follow these steps:
- Open the
/etc/sysconfig/network-scripts/ifcfg-interface
file, whereinterface
is the name of the network interface you want to configure. For example, if you want to configure theeth0
interface, you would open the/etc/sysconfig/network-scripts/ifcfg-eth0
file. - Change the
BOOTPROTO
line toBOOTPROTO=static
. This tells the system to use a static IP address rather than DHCP. - 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
- Save and close the file.
- Bring the interface down and up:
sudo ifdown interface
sudo ifup interface
- Verify the new IP address by running the following command:
ip addr show interface
- 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.