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

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

All

Linux Articles / All 9 Views comments

This information supplies totally different strategies, tips on how to Configure static IP tackle in Centos eight / RHEL8.

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

Web Hosting

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

  • 1.1 – Utilizing the textual content consumer interface device, nmtui.
  • 1.2 – Utilizing the command-line software, 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:

Notice:-

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 deliver 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 Tackle, 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 handle has been assigned to interface eno1

Above output is displaying we now have efficiently assigned a static IP tackle to eno1 interface utilizing nmtui device.

The next instructions are additionally out there:

# nmtui edit eno1

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

Web Hosting


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

What's nmcli?

nmcli (NetworkManager Command Line Interface) is the command-line utility to configure IP settings by way of NetworkManager. Utilizing nmcli command line software 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 system


Above output displaying nmcli system command record all obtainable community units in system. Additionally you possibly can see highlighted system state displaying unmanaged there's related additionally in inexperienced shade. A tool state may be:

Managed
  • 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 gadget is just not underneath the management of NetworkManager

        • Some helpful nmcli system instructions switches:

          -f, subject This feature specifies what fields could be displayed in output.

          Instance: Specify which area 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 system 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 192.168.2.88/24

          Notice:-

          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 192.168.2.100

          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 to be like.

          # cat /and so on/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 should put interface down and up once more to make our modifications efficient.

          Word:-

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

          # nmcli connection down eno1 && nmcli connection up eno1

          You possibly can confirm modifications utilizing ip addr command.

          # ip addr|grep eno1|grep inet

          Conclusions

          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 how one can 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 verify your e-mail for additional directions.

          Publish Views: 45

Comments