Press ESC to close

configure ip address centos 8

Easy guide to assign Static IP Address on CentOS / RHEL (7 & 8)

DHCP servers are used almost in all organizations or even in our home routers for assigning IP addresses to get access to the internet. Usually, when we enable our network interface on our CentOS 7 or 8 systems, an IP address is assigned automatically through that DHCP server & we have access to the internet or to our LAN network. But we might be required to assign static IP addresses in our CentOS 7 or 8 machines.

So what do we do? We need to manually assign a static IP address to our servers. In this tutorial, we will learn how to assign static IP addresses in CentOS 7 or 8 machines.

There are two ways we can assign a static IP address in CentOS 8 systems,

1- Using Network manager 2- Assigning IP using network files

Let's discuss both these methods one by one.

Recommended Read: IP Route command: Create static routes or Change the default Gateway in Linux

Also Read: How to manage network in Ubuntu 18.04 – Netplan Command

1- Assign static IP using Network Manager

To configure a static using the network manager, we will be using a tool called 'nmtui'. NMTUI is a CLI-based user interface for Network Manager & even works for a system that does not have GUI installed.

To assign IP address, open terminal & execute the following command,

You will see the following screen,

assign static ip address

Click on ' Edit a connection ', press ‘ Enter ’. Use the ‘ Tab ’ key to navigate.

On the next screen, select the network interface from the list of interfaces & press ENTER key,

assign static ip address

Add the IP address and other necessary details as required & complete the setup. Next, we need to restart the NetworkManager service to implement the changes,

# systemctl restart NetworkManager

2- Assigning IP using Network files

Network files for all the network interfaces are located in the directory ‘/etc/sysconfig/network-scripts'. Open the primary network interface file i.e. enp0s3, & add the following content to the file. Add what’s not in the file.

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

DEVICE="enp0s3" BOOTPROTO=static ONBOOT=yes TYPE="Ethernet" IPADDR=10.10.10.10 NETMASK=255.0.0.0 GATEWAY=10.10.10.100 HWADDR=32:0A:21:54:ND:6D

Save the file & restart the network service for changes to take effect.

# systemctl restart network

After the service has been started, our static IP has been assigned to our CentOS 8 system. To verify the assigned IP address, use the IP command,

That’s it, this completes our tutorial on how to assign a static IP in CentOS 7 or 8 systems. Please do send in any questions or queries using the comment box below.

We are giving you exclusive deals to try Linux Servers for free with 100$ credit, check these links to claim your 100$,

DigitalOcean - 100$ free credit & Linode - 100$ free credit

Check some Exclusive Deals, HERE .

Also, check out DevOps Book You should read section.

Share Article:

Passionate about Linux & open source. Loves to learn, read & write about Linux as well as new technologies.

Create Ubuntu bootable USB / Live USB from command line

Search a file in linux using find & locate command.

configure ip address centos 8

on this example “$ vi /etc/sysconfig/network-scriptsifcfg-enp0s3” I believe you left out a forward slash after network-scripts and before ifcfg-enp0s3. It should read “$ vi /etc/sysconfig/network-scripts/ifcfg-enp0s3”

Avatar

Thanks for mentioning it, it’s been updated.

Leave a Reply Cancel reply

Save my name, email, and website in this browser for the next time I comment.

  • Trending Categories

Data Structure

  • Selected Reading
  • UPSC IAS Exams Notes
  • Developer's Best Practices
  • Questions and Answers
  • Effective Resume Writing
  • HR Interview Questions
  • Computer Glossary

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−

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 −

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 −

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 −

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.

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!

Satish Kumar

Related Articles

  • How to Configure Network Static IP Address in Ubuntu 18.04?
  • 3 Ways to Set a Static IP Address in RHEL 8
  • How to Install and Configure Cloudera Manager on CentOS/RHEL 8?
  • How to Change or Set Hostname on CentOS 8/RHEL 8?
  • How to Install and Configure Memcached on CentOS 8
  • How to Install and Configure Nginx on CentOS 8?
  • 3 Ways to Create a Network Bridge in RHEL CentOS 8
  • How to Enable NUX Dextop Repository on RHEL/CentOS 8
  • Difference between Static IP Address and Dynamic IP Address
  • How to Install and Configure GitLab on CentOS 8/7?
  • How to Disable NetworkManager in CentOS/RHEL 8?
  • How to Change Hostname in CentOS/RHEL 8?
  • How to configure samba on centos
  • How to Enable RPMForge Repository in RHEL/CentOS 8?
  • How To Enable HTTPS for Varnish Cache using Hitch on CentOS/RHEL 8?

Kickstart Your Career

Get certified by completing the course

  • IT Management
  • Infrastructure
  • High Performance

LinuxToday

How to Configure Static IP Addresses in CentOS 8 / RHEL 8

2DayGeek: In this article, we’ll demonstrate how to assign or configure Static IP addresses on RHEL 7/8 and CentOS 7/8 systems.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis

Access ChatGPT Prompt in your Linux Terminal

How to create a windows 10/11 bootable usb on linux, how to install grafana on alma linux, how to install gitea devops platform using docker on debian 12, 15 best free and open-source linux file managers.

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

  • Privacy Policy
  • California – Do Not Sell My Information

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.

IMAGES

  1. How to Configure Static IP Address on CentOS 8

    configure ip address centos 8

  2. Comment Configurer L'adresse IP Statique Du Réseau Sur RHEL / CentOS 8/

    configure ip address centos 8

  3. Comment Configurer L'adresse IP Statique Du Réseau Sur RHEL / CentOS 8/

    configure ip address centos 8

  4. Configuring Static IP on CentOS 8

    configure ip address centos 8

  5. Cómo configurar dirección IP estática en CentOS 8

    configure ip address centos 8

  6. How to Configure Static IP Address on CentOS 8

    configure ip address centos 8

VIDEO

  1. COMO CONFIGURAR IP ESTATICO IP AUTOMÁTICO NO LINUX USANDO VIRTUALBOX

  2. How to Install Zimbra Mail Server in CentOS 8/7

  3. Use CentOS Linux for Routing, Proxy, NAT, DHCP

  4. Install CentOS 7.6 and configure it as a firewall router

  5. How to Change IP address in iPad or iPhone Without App or Software 2024

  6. Configuring network interfaces Centos 8 with nmcli, nmtui

COMMENTS

  1. How to configure a static IP address on RHEL 8 / CentOS 8 Linux

    In this tutorial we learn how to set a static IP address for a network interface in RHEL 8 / CentOS 8. We show three methods to perform said action: by manually editing a connection file, by using the nmcli command line utility, and finally by using nmtui, a text-user interface.

  2. Configure Static IP Address on CentOS 8|CentOS 7

    There is an existing guide on how to configure static IP address using ip and ifconfig commands available on: Using ip and ifconfig to configure Linux networking. Wrapping Up. We have covered complete steps of How to configure static IP address on CentOS using manual modifications of network configuration files and using nmcli command line tool.

  3. How to Configure Static IP on CentOS 8 (CLI)

    You will see the list of Ethernet interfaces, Select the interface you want to configure, Then select Edit option on the right side of the interface. Keep the profile name and device name unchanged. Set the IP address, gateway and DNS servers under the IPv4 configuration option. You can add multiple addresses by selection option just below IP ...

  4. How To Configure static IP address on RHEL 8 / CentOS 8

    Method 2: Set Static IP Address on RHEL 8 using nmcli. Nmcli is a command-line tool used to control NetworkManager and for reporting network status. With this command line tool, you can set RHEL 8 static IP address with few commands. Check available connections. # nmcli connection show.

  5. How to Configure CentOS Network Settings {via terminal or GUI)

    To configure your CentOS network interface via GUI, you need to open the Network Manager and modify the configuration according to your needs. 1. ... To set a static IP address for the IPv4 configuration, open the drop-down menu next to the name of the appropriate connection. 3.

  6. How to Configure Static IP Address in RHEL 8 / CentOS 8

    Whenever we install RHEL 8 / CentOS 8 server then ' nmcli ', a command line tool is installed automatically, nmcli is used by network manager and allows us to configure static ip address on Ethernet cards. Run the below ip addr command to list Ethernet cards on your server. [root@linuxtechi-rhel8 ~]# ip addr.

  7. How To Configure Static IP Address in CentOS 8 / RHEL 8

    Verify Static IP Address. Use ifconfig -a command to verify the IP address. Static IP. Also, verify the DNS server entries. cat /etc/resolv.conf. Output: DNS Server Information Conclusion. That's All. You have successfully configured a static IP address to a network interface in CentOS 8 / RHEL 8. Please share your feedback in the comments ...

  8. How to Configure Static IP Address on CentOS 8

    Step 2 - Setup Static IP on CentOS 8. Under the IPv4 Method select the "Manual" option. Now go to the Addresses section and set your IP Address, Netmask, and Gateway. You can also set remote DNS IP addresses. If you don't know what to set here use 8.8.8.8 and 8.8.4.4 as shown in the above screenshot.

  9. How to Configure Network Static IP Address on RHEL/CentOS 8/7

    Configure IP Address in CentOS 8. 10. After finishing editing the file, close it, and move to resolv.conf file if you want DNS servers enabled system-wide. # nano /etc/resolv.conf. Here just add your DNS servers using nameserver statement. nameserver 192.168.1.1. nameserver 8.8.8.8. 11.

  10. How to set a static IP address on CentOS 8/ RHEL 8 / Oracle Linux 8

    Now, check the new IP address with this command::~# ip addr show. 3.- Check the changes. So, everything is OK. Conclusion. In this post, you have learned to set a static IP address in CentOS 8, RHEL 8 and Oracle Linux 8. This way you will be able to manage some servers a little better and it is a very used network function.

  11. How to configure static IP address in CentOS 8 / RHEL 8

    Method-1: Configure a static IP address using nmcli command on CentOS 7/8 and RHEL 7/8. The nmcli is a command line tool, which is used for controlling NetworkManager and reporting network status. It is used to create, display, edit, delete, activate, and deactivate network connections. Identifying interfaces. Before proceeding to configure a ...

  12. How to Configure Static IP on RHEL/CentOS 8

    An IP Address is a unique numerical representation of a computer on a network. When you set up a text-only and GUI-less CentOS server, you may need to configure static IP on it. So, join this article to learn How to Configure Static IP on RHEL/CentOS 8. This guide will teach you three different methods to make you an expert in setting up the static IP address on your CentOS server.

  13. How to Configure a Static IP Address on CentOS 8

    How to Configure a Static IP Address on CentOS 8. By Muhammad Arul . October 28, 2019. In this tutorial, I will show you three different ways to set up a static IP address on CentOS 8 by using nmcli, nmtui and by editing the interface configuration file directly. Complete Story. Facebook. Twitter. Linkedin. Email. Print. Previous ...

  14. Easy guide to assign Static IP Address on CentOS / RHEL (7 & 8)

    To assign IP address, open terminal & execute the following command, $ nmtui. You will see the following screen, Click on ' Edit a connection ', press ' Enter '. Use the ' Tab ' key to navigate. On the next screen, select the network interface from the list of interfaces & press ENTER key, Add the IP address and other necessary details ...

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

    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.

  16. Static IP

    The CentOS Project is a community-driven free so... What's up Linux Community!!! In this video I walk through how to set a static IP address in CentOS 8 Server.

  17. How to configure static IP address on RHEL 8 / CentOS 8

    Method 2: Set Static IP Address on RHEL 8 using nmcli. Nmcli is a command-line tool used to control NetworkManager and for reporting network status. With this command line tool, you can set RHEL 8 static IP address with few commands. Check available connections. # nmcli connection show.

  18. How to configure Static IPv4 address on CentOS 8

    There are multiple ways to configure your network interface. In our article, we will describe how you can change your network configuration from DHCP (dynamic) IP address to Static IPv4 address in CentOS 8. Prerequisites. Cloud VPS or Dedicated Server with CentOS 8 installed. You must be logged in via SSH as sudo or root user.

  19. How to Configure Static IP Addresses in CentOS 8 / RHEL 8

    In this article, we'll demonstrate how to assign or configure Static IP addresses on RHEL 7/8 and CentOS 7/8 systems.---News. IT Management. Infrastructure. Developer. Security. High Performance. Storage. Blog. Search ...

  20. How to configure a static IP address on CentOS 7 / RHEL 7

    Verification. Verify new IP settings using the ip command for the NIC named eth0: # ip a s eth0. Verify new routing settings: # ip r. Next, verify DNS servers settings using the cat command or grep command to query the /etc/resolv.conf file as follows: # cat /etc/resolv.conf. Finally verify the internet connectivity using the ping command: