How to Configure Network Static IP Address on RHEL/CentOS 8?


Introduction

Configuring a static IP address is essential for maintaining network stability and security on RHEL/CentOS 8. Unlike dynamic IP addresses, static IP addresses remain constant, ensuring that devices can be easily identified and located on the network.

This is particularly important in enterprise environments where multiple servers, virtual machines, or other devices may be running at the same time. Static IP addressing also offers several benefits over dynamic addressing.

For example, it reduces the risk of conflicts that can occur when multiple devices attempt to use the same IP address. Additionally, it provides more control over network traffic by allowing administrators to set up specific policies and rules for different devices.

Understanding Network Interfaces on RHEL/CentOS 8

Definition and Explanation of Network Interfaces

A network interface is a hardware device or software component that connects a computer to a network. It provides the physical and logical connection between the computer and the network, allowing data to be transmitted between them.

In RHEL/CentOS 8, a network interface is represented by an object in the /sys/class/net directory. It can have various configuration options, including IP address, netmask, gateway, DNS server, and more.

Types of Network Interfaces Available on RHEL/CentOS 8

RHEL/CentOS 8 supports several types of network interfaces, including −

  • Ethernet − This is the most common type of network interface used in RHEL/CentOS 8. It supports wired connections using Ethernet cables.

  • Wireless − This type of interface allows wireless connections using Wi-Fi or Bluetooth.

  • Bonding − Bonding interfaces combine two or more physical interfaces into one logical interface for load balancing or failover purposes.

  • VLAN − VLAN (Virtual Local Area Network) interfaces allow multiple virtual networks to share the same physical infrastructure.

  • Bridge − Bridge interfaces enable communication between two or more networks by forwarding packets between them.

Each type of interface has its own unique configuration options and use cases. Understanding these options is essential when configuring a static IP address on RHEL/CentOS 8. In the next section, we will discuss how to identify network interface information using command-line tools like ifconfig and nmcli.

Identifying Network Interface Information

Using the ifconfig command to identify network interface information

The ifconfig command is a powerful tool for managing network interfaces on RHEL/CentOS 8. It provides detailed information about each interface, including its IP address, netmask, and MAC address.

To use the command, simply open a terminal window and type ifconfig. This will display information about all of your system's network interfaces.

When you run the ifconfig command, you'll see a list of all your system's network interfaces. Each interface will be identified by a name such as eth0 or enp0s3.

Along with the name, you'll also see details about the interface's IP address, netmask, and other important configuration settings. If you're having trouble identifying which interface you need to configure for static IP addressing, make note of this information from the output and compare it with what is displayed in Network Manager later on.

Using the nmcli command to identify network interface information

Another way to identify network interface information on RHEL/CentOS 8 is by using the nmcli command-line tool. This tool provides a set of commands that allow you to manage NetworkManager-based connections.

To use nmcli, open up a terminal window and enter "nmcli d". This will display all available NICs on your system.

You can also use "-p property_name" argument along with "-d show device_name " option to get more detailed information on specific properties−

$ nmcli -p ipv4.address -d show eno1 GENERAL.DEVICE:            eno1 

GENERAL.TYPE: ethernet IP4.ADDRESS[1]: 192.168.1.100/24 
IP4.GATEWAY: 192.168.1.1 .

This will display detailed information about the selected network interface, including its IP address, netmask, gateway and DNS settings. Both of these tools are very useful for identifying network interface information on RHEL/CentOS 8, and can help you to troubleshoot problems with your network configuration.

Configuring Static IP Address using nmcli Command

Steps involved in configuring a static IP address using nmcli command

When it comes to configuring a static IP address on RHEL/CentOS 8, the nmcli command is one of the most commonly used methods. It involves a few simple steps which can be easily executed from the command line interface.

Disable DHCP client

The first step in this method is to disable the Dynamic Host Configuration Protocol (DHCP) client that is responsible for assigning IP addresses dynamically. This can be done by executing the following command −

sudo nmcli connection modify ipv4.method manual .

Replace `` with the name of your network interface.

This will change the IPv4 configuration method from automatic (DHCP) to manual, which means you will have to manually configure an IP address for your interface.

  • Configure static IP address, netmask, gateway and DNS serverNow that DHCP has been disabled, you need to configure your network interface with a static IP address, netmask, gateway and DNS server.

Execute this command −

sudo nmcli connection modify ipv4.addresses /
sudo nmcli connection modify ipv4.gateway sudo nmcli connection modify ipv4.dns  

Replace `` with your desired IPv4 address and `` with its corresponding subnet mask. Also replace `` and `` with their respective IPs.

  • Activate changes and restart networking service

You need to activate these changes by restarting your networking service using this command −

sudo systemctl restart NetworkManager.service   

This will apply the changes you made to your network interface.

You can check if the changes were successful by running the `ifconfig` command and looking for your interface's IPv4 address, netmask, and gateway. Overall, configuring a static IP address using the nmcli command is a quick and easy method that can help ensure your RHEL/CentOS 8 system has a stable network connection.

Configuring Static IP Address using GUI method

Steps involved in configuring a static IP address using GUI method

Open Network Manager from system tray or terminal

The first step in configuring a static IP address using the GUI method on RHEL/CentOS 8 is to open the Network Manager. This can be done either by clicking on the network icon in the system tray or by opening a terminal and typing "nm-connection-editor" command.

Edit connection settings for desired interface

Once inside the Network Manager, locate and select the network interface you wish to configure. Click on "Edit" to change its settings.

Set IPv4 configuration type as Manual

Under IPv4 tab, change from "Automatic (DHCP)" to "Manual". This allows you to manually enter your desired static IP address, netmask, gateway, and DNS server.

Enter your desired static IP address information

Enter your desired static IP address information under the IPv4 tab. Make sure that you fill out all required fields correctly. Once done, click on "Save" to save changes.

Conclusion

Configuring a static IP address using GUI method is a simple process that involves just a few steps. By understanding how to use this feature effectively on RHEL/CentOS 8 systems, you can easily configure your network interfaces for optimal connectivity and performance. Whether it's for personal or professional use, knowing how to set up a static network makes managing your system much easier!

Updated on: 11-Jul-2023

177 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements