How to Set a Static IP Address in RHEL 8 or Centos8

Windows Articles

How to create backups in Windows 10 with FileFort Backup

There is no doubt that the computer is an essential element in our lives. Indeed, its uses go beyond work or study....

Trisquel 9.0 available

Trisquel is a GNU/Linux distribution endorsed and supported by the Free Software Foundation. This means that in addition to incorporating the Linux...

How to install PandoraFMS on CentOS 8?

Worldwide many IT infrastructures are running Linux on one of their servers. This opens the door to an endless number of different...

How to force close a program using PowerShell

Hi! We have mentioned in the past that Windows allows you to open multiple programs at once. In fact, that is one...

How to install the Owncloud desktop client Ubuntu 20.04?

In this post, You will learn how to install the Owncloud desktop client on Ubuntu 20.04. Many users and...
Mel Khamlichi
Mel Khamlichihttp://www.osradar.com
Founder of Osradar, from Amsterdam Netherlands

In entreprise Environemtns  you are  dedicated en uniq  IP addresses for every machine. i will show to today from my virtual test Server many ways how to set a static Ip adress to your Centos8 or RHEL8 Server.

Lets begin about my system settings

Hostname

My hostnamne:  osradar-rhel8.local.domain

network Setting

My netwrok device is configured to get autmaticaly Ip address from the rooter via DHCP protocol

Lets  say i want a static IP address  for this Server like 192.168.2.100 and my gateway (router is  192.168.2.254)   lets do it on this way

Method 1

This is the Manual methode

Edit  the Device configuration  file /etc/sysconfig/network-scripts/ifcfg-enp0s3

vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

Please ignore or remove the IPV6 lines if you are not using IPV6 protocols.

Restart  the  Device or just reboot the Server

ifdown enp0s3
ifup enp0s3

Check now

Try login from other machine

ssh  to new Ip address on the  remote Server  192.168.2.100

its wokring!

Method 2

This method is using nmcli tool ( Network Manager command tool)

How to Set a Static IP Address in RHEL 8 or Centos8 using nmcli tool

Before to start ,lets explain about some options to use with nmcli  tool

con  = connection

mod = modify

manual  =  Static ip Address

Set the IP address for interface enp0s3 on RHEL 8 or Centos8.

# nmcli con mod enp0s3 ipv4.addresses 192.168.2.101/24

Set the gateway on RHEL 8 or Centos8:

# nmcli con mod enp0s3 ipv4.gateway 192.168.2.254

Confirm to  the interface to use manual configuration  instead of  dhcp.

# nmcli con mod enp0s3 ipv4.method manual

Configure DNS:   (  8.8.8.8   is  google)

# nmcli con mod enp0s3 ipv4.dns "8.8.8.8"

Reload the interface configuration:

# nmcli con up enp0s3

check

Not that if  you are  doing these commands from an remote server via ssh connection , the connection will be dropped  🙂  because will get  new  IP address

Its Working too

Method 3

Set Static IP Using Nmtui Tool

nmtui

Edit Connection 

Edit Device name 

Change IPv4  from automatic to  Static 

under Show  you add the IP adderess GATEWAY  and  DNS   (  use  TAB to  move between the lines)

Then Go to OK in The bellow page Config / then TAB  to  back

Activate  The Connection  . or Reboot  your  Server 

Enjoy and share

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to create backups in Windows 10 with FileFort Backup

There is no doubt that the computer is an essential element in our lives. Indeed, its uses go beyond work or study....

Trisquel 9.0 available

Trisquel is a GNU/Linux distribution endorsed and supported by the Free Software Foundation. This means that in addition to incorporating the Linux...

How to install PandoraFMS on CentOS 8?

Worldwide many IT infrastructures are running Linux on one of their servers. This opens the door to an endless number of different...

How to force close a program using PowerShell

Hi! We have mentioned in the past that Windows allows you to open multiple programs at once. In fact, that is one...

How to install the Owncloud desktop client Ubuntu 20.04?

In this post, You will learn how to install the Owncloud desktop client on Ubuntu 20.04. Many users and...
x