How to configure a static IP address on CentOS 7 / RHEL 7

w‮ww‬.lautturi.com
How to configure a static IP address on CentOS 7 / RHEL 7

To configure a static IP address on CentOS 7 or RHEL 7, you can follow these steps:

  1. Open the network configuration file for the interface you want to configure. For example, to configure the eth0 interface, you can open the /etc/sysconfig/network-scripts/ifcfg-eth0 file.

  2. Find the BOOTPROTO line in the file and change the value to none. This will disable DHCP and allow you to configure a static IP address.

  3. Find the IPADDR line in the file and set it to the desired static IP address. For example:

IPADDR=192.168.0.100
  1. Find the NETMASK line in the file and set it to the appropriate subnet mask. For example:
NETMASK=255.255.255.0
  1. Find the GATEWAY line in the file and set it to the appropriate default gateway. For example:
GATEWAY=192.168.0.1
  1. Save the file and exit.

  2. Restart the network service to apply the changes. You can use the following command:

systemctl restart network

This will apply the changes and set the static IP address for the specified interface.

It's important to note that you may need to have root privileges to edit the network configuration files and restart the network service.

For more information about configuring a static IP address on CentOS 7 or RHEL 7, you can refer to the documentation or use the --help option with the ifconfig and ip commands. For example:

man ifconfig
man ip
ifconfig --help
ip --help
Created Time:2017-10-28 21:39:00  Author:lautturi