+4 votes
541 views
How to change and configure Red Hat 8 static IP (RHEL 8)

in Linux / Unix by (552k points)
reopened | 541 views

1 Answer

+5 votes
Best answer

1. How to set a static Red Hat 8 (Linux) IP address using Network Scripts
2. How to assign the static IP address in Red Hat 8 (Linux) using the Nmtui tool
3. How to configure a static IP address in Red Hat 8 (Linux) using the Nmcli tool

When opting for an operating system, users who choose Linux are especially focused on factors such as security, because due to its structure it is practically impenetrable for viruses and malware of any kind. When working with Linux servers, one of the fundamental steps is to assign a static IP address as this ensures the delivery of the server services and will not be affected by changes in IP addresses..

If we talk about Linux, we can give a special mention to Red Hat, which is a software company that has open source to companies which offers an operating system and a business virtualization product with great security. Relatively recently Red Hat has launched the public beta version of RHEL 8, with which it is now possible to configure the network interface in different ways using the NetworkManager utilities; and it is for this reason that on this occasion TechnoWikis will explain how we can establish a static IP address in Red Hat 8.


1. How to set a static Red Hat 8 (Linux) IP address using Network Scripts


This method involves editing the file / etc / sysconfig / network-scripts / ifcfg- (interface), so that the changes to static IP address are applied.
Step 1

To know what the name of our interface is, we can execute the following:
 nmcli with 
image
Step 2

In this case it is eth0, now, to edit this file we execute the following:
 sudo nano / etc / sysconfig / network-scripts / ifcfg-eth0 
image
Step 3

In the deployed file we must configure the following:
 TYPE = "Ethernet" BOOTPROTO = "none" NAME = "eth0" IPADDR = "192.168.0.14" NETMASK = "255.255.255.0" GATEWAY = "192.168.0.1" DEVICE = "eth0" ONBOOT = "yes" 
image
Note

Some lines are already present, but others must be added manually. We save the changes using the keys:

+ O Ctrl + O

We leave the editor using:

+ X Ctrl + X

We add the IP addresses according to the configuration of the network to use.

Step 4

We proceed to restart the NetworkManager by running:
 systemctl restart NetworkManager 
image
Step 5

Alternatively we can apply the changes by executing the following:
 nmcli with down eth0 && nmcli with up eth0 
To check the new IP we execute:
 ip to show enp0s3 
image

2. How to assign the static IP address in Red Hat 8 (Linux) using the Nmtui tool


Now, we can configure the static IP address in Red Hat 8 using the nmtui tool, which uses a text user interface (TUI).
Step 1

To use it, simply enter the following command in the console:
 Nmtui 
The following will be displayed. There we select the "Edit a connection" line and press "Enter." image
Step 2

We will be redirected to the next window. There we select the current interface and press "Enter." image
Step 3

We will see the following. There we can edit the configuration of the network interface with our keyboard assigning the desired IP address and then select and click on "Ok". image
Step 4

We will see the following. There we will load the network interface by selecting the "Activate a connection" option. image
Step 5

The following window will be displayed where we will select the edited interface and select the "Deactivate" option: image
Step 6

Now we select Activate to activate the interface with the new configuration defined. After this we click on "Back". image
Step 7

We can exit the tool by selecting "Quit": image
Step 8

We check the new IP by running:
 ip to show enp0s3 
image

3. How to configure a static IP address in Red Hat 8 (Linux) using the Nmcli tool


Nmcli is the NetworkManager command line interface with which it will be possible to obtain information or configure a network interface in Red Hat 8.
Step 1

To establish a static IP address, we will use the following lines:
To set the IP address in the desired interface we execute
 nmcli with mod eth0 ipv4.addresses 192.168.0.16/24 
To set the Gateway
 nmcli with mod eth0 ipv4.gateway 192.168.0.1 
To set the method as manual (static) and not DHCP
 nmcli with mod eth0 ipv4.method manual 
To configure the DNS
 nmcli with mod eth0 ipv4.dns "8.8.8.8" 
image
Step 2

After performing this process, we will apply the changes by executing:
 nmcli with up eth0 
image
Step 3

All changes will be stored in the path / etc / sysconfig / network-scripts / ifcfg- (Interface), we can check it by running:
 cat / etc / sysconfig / network-scripts / ifcfg-eth0 
image

Thus, we have learned to establish a static IP address in Red Hat 8..


by (3.5m points)
edited

Related questions

+4 votes
1 answer
asked Jul 2, 2020 in Linux / Unix by backtothefuture (552k points) | 486 views
+5 votes
1 answer
+5 votes
1 answer
+4 votes
1 answer
asked Sep 20, 2019 in Linux / Unix by backtothefuture (552k points) | 337 views
+5 votes
1 answer
asked Mar 29, 2021 in Linux / Unix by backtothefuture (552k points) | 206 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users