Different Ways to Configure Static IP Address in CentOS 8/ RHEL 8

Different Ways to Configure Static IP Address in CentOS 8/ RHEL 8


Linux Articles / All 60 Views comments

This information supplies totally different strategies, find out how to Configure static IP handle in Centos eight / RHEL8.

After putting in Linux System, step one each Linux Engineer will do is to assign static IP tackle on NIC / Ethernet card, to allow them to have entry of their system over the community.

Strategies 1 – Configure Static IP in CentOS eight / RHEL eight utilizing NetworkManager

  • 1.1 – Utilizing the textual content consumer interface software, nmtui.
  • 1.2 – Utilizing the command-line device, nmcli.

1.1 – Configure a community interface utilizing the NetworkManager’s device, nmtui

nmtui is curser-based textual content consumer interface device (TUI) for NetworkManager.

Set up:


This device is utilized in command line window. It comes with NetworkManager-tui package deal, which isn't coming by default with NetworkManager package deal. However you'll be able to set up it utilizing following command.

# yum set up NetworkManager-tui

The method to vary IP utilizing nmtui:

Launch the nmtui software

# nmtui

You will notice NetworkManager textual content consumer interface beginning menu will seem.

Configure Static IP in CentOS 8

  1. To navigate choices, use the arrow keys or press Tab key to step forwards. As soon as you choose want choice then press Enter.
  2. Selected Edit a connection choice to edit a connection after which utilizing Tab key convey choice on OK button at backside proper aspect then press enter
  3. Then on subsequent display selected your interface, in my case its eno1. See image under.

After you selected to edit your interface, now right here on subsequent display specify IP Handle, prefix, Gateway and DNS Server. Then utilizing tab key navigates to okay then press enter.

In subsequent window selected your community interfaces which is eno1 and deactivate.

Then selected connection once more and click on activate button.

Choose Again after which choose Give up.

Use ifconfig command to confirm whether or not ip tackle has been assigned to interface eno1

Above output is displaying we've got efficiently assigned a static IP tackle to eno1 interface utilizing nmtui software.

The next instructions are additionally obtainable:

# nmtui edit eno1

Above command will open edit connection window instantly see under image.

1.2 – Configure a community interface Utilizing the command-line software, nmcli.

What's nmcli?

nmcli (NetworkManager Command Line Interface) is the command-line utility to configure IP settings by means of NetworkManager. Utilizing nmcli command line device you'll be able to create, show, edit, delete, activate, and deactivate community connections, in addition to management and show community gadget standing.

To show out there community units

# nmcli gadget

Above output displaying nmcli gadget command record all obtainable community units in system. Additionally you'll be able to see highlighted gadget state displaying unmanaged there's related additionally in inexperienced colour. A tool state could be:

  • i) It means it’s beneath the NetworkManager management, and a managed gadget could also be related, which means its configured and activated, or disconnected, it means not configured nevertheless it is able to be activated once more.
    • Unmanaged
      • i) This state imply this system isn't beneath the management of NetworkManager

        • Some helpful nmcli system instructions switches:

          -f, area This feature specifies what fields might be displayed in output.

          Instance: Specify which subject you need to see in output.

          # nmcli –f DEVICE,TYPE,CONNECTION gadget

          -p, fairly

          This feature print output in human-readable format

          See Instance under

          # nmcli –p gadget

          nmcli gadget command takes many arguments however mostly used are: present, standing, join, set, disconnect, modify, edit and wifi. You'll be able to see additional particulars by getting into nmcli gadget assist command.

          Assign Static IP Utilizing nmcli.

          Bellow command will assign a static ip handle to our interface eno1

          # nmcli con mod eno1 ipv4.addresses


          we used shorter model of nmcli connection modify command by changing connection key phrase with con and modifiy with mod.

          Assign gateway utilizing under command.

          # nmcli con mod eno1 ipv4.gateway

          Set technique of interface eno1 from dhcp to static utilizing under command.

          # nmcli con mod eno1 ipv4.technique guide

          Establishing DNS server IP

          # nmcli con mod eno1 ipv4.dns “eight.eight.eight.eight”

          Now to save lots of all modifications we've made, use following nmcli command.

          # nmcli con up eno1

          To verify modifications use under IP command

          # ip addr present eno1

          We will see above output exhibits, Static ip handle is configured efficiently on eno1 interface.

          Strategies 2 – configure static IP in CentOS eight / RHEL8 with out utilizing NetworkManager.

          • 2.1 – Edit community configuration script file ifcfg-* manually.

          2.1 – Edit community configuration script file ifcfg-* manually

          A configuration script file is created for every community interface inside /etec/sysconfig/network-scripts/ listing. All configuration script file identify began with ifcfg- plus the identify of the interface. If I view my system interface eno1 script file, see the way it seems like.

          # cat /and so forth/sysconfig/network-scripts/ifcfg-eno1

          Above configuration displaying static ip configuration the place we use:

          • 1: BOOTPROTO – none choice is specified, since we're utilizing static ip so we no protocol must be there. In case if you wish to get ip from DHCP server so BOOTPROTO ought to BOOTPROTO=dhcp.
          • 2: IPADDR – This feature we used to specify IP tackle.
          • three: PREFIX – Used to outline community prefix in our case it's /24 community.
          • four: GATEWAY – used to outline default gateway for this community.
          • 5: DNS – Utilizing this feature we will outline a number of DNS server with progressive quantity, ranging from 1. See level quantity 5, displaying DNS1 & DNS2.

          After you end modifying your community configuration script file, you need to put interface down and up once more to make our modifications efficient.


          Remember that it will disrupt existent ssh connections by way of stated interface:

          # nmcli connection down eno1 && nmcli connection up eno1

          You'll be able to confirm modifications utilizing ip addr command.

          # ip addr|grep eno1|grep inet


          We study three strategies we will use to configure static IP on CentOS eight / RHEL eight. We see what choices we should always change and what we should always add within the interface configuration file when modifying it manually, and easy methods to carry out the identical modifications utilizing nmtui and nmcli, that are respectively a textual content consumer interface command line utility; each are used to regulate the NetworkManager daemon.

          Thanks for subscribing! Please examine your e-mail for additional directions.

          Publish Views: 125