Assigning a static IP address to a server translates that the address doesn't change.
Most Servers uses dynamic IP addresses assigned to the network when they connect and changes over time.
Here at Linux APT as part of our Linux Support Services, we regularly help our customers to fix Linux, CentOS, Debian and Ubuntu Server Issues.
In this context, we will look into the steps to take in configuring Static IP Address on CentOS 8.
There are two main methods of configuring Static IP address on CentOS 8 as outlined below;
i. Via Graphical Desktop Environment.
ii. Via Command Line.
Here, you will see how to set up Static IP address on CentOS 8 via the graphical user interface.
So follow the steps below;
1. Start by opening the "Settings" application from the Application menu of CentOS 8.
2. Next, navigate to the "Network" Section where you will see your network interface. You will see the gear icon of the network interface where you can configure the network interface.
3. Now this will take you to the "Details" tab where you will see the current network configuration.
4. For IPv4 address implementation, configure a static IPv4 address via the "IPv4" tab.
5.For IPv6 address implementation, configure a static IPv6 address via the "IPv6" tab.
Note that this article will be solely based on a static IPv4 address setup as the same processes can be followed in the case of IPv6.
6. It is important for you to know that a network interface is configured to automatically get an IP address, DNS as well as the Routing information through DHCP by default.
7. So to configure a static IPv4 address, you should select "Manual" as the IPv4 method. You will see "Addresses" section where you can enter your IPv4 "Address", "Netmask" and "Gateway".
8. Here you can set up multiple IPv4 address to the same network interface.
9. You can toggle "OFF" the marked button from the DNS section to configure the DNS server address manually.
10. Here you can enter in your DNS Server address.
11. Additionally, you can add multiple DNS Server addresses. This can be implemented by separating each addresses with a comma (,).
12. To effect changes, click on "Apply" button.
13. Now, click on toggle "OFF" button of the network interface. Then click on toggle "ON" button of the network interface to enable the new configuration.
Now the configuration will become active.
14. Next, click on the gear icon to verify the network configuration. here you can set your desired IPv4 address as per your requirement in the Network interface.
Here you will see how to set up Static IP address on CentOS 8 via the command line.
To configure the network interface on your CentOS 8 machine, you can use the nmtui (Network Manager Text User Interface) command.
So follow the steps below;
1. Start by running the following command to start the "nmtui service;
2. Now you will be able to Modify the connection by selecting the "Edit a connection" and then pressing <Enter> to continue.
3. Next, select your network interface, where you can select "<Edit...>" followed by pressing "<Enter>".
4. The "IPv4 CONFIGURATION <Automatic>" should be selected if your need to configure IPv4 static IP address.
5. To configure IPv6 static IP address, simply go to "IPv6 CONFIGURATION <Automatic>" followed by pressing "<Enter>".
This article will cover the configuration of a static IPv4 address.
6. Next, you can select "Manual" followed by pressing "<Enter>".
7. Now you can select "<Show>" followed by pressing "<Enter>".
8. Here, you can configure your IP address, gateway as well as the DNS Server address.
9. Now go to "Addresses <Add...>" followed by pressing "<Enter>". Here you can enter in your desired IP address.
Note the the IP address must be in CIDR notation format "IP_ADDRESS/MASK_LENGTH". The "MASK_LENGTH" is "24" which is equivalent to subnet mask "255.255.255.0".
If you encounter any difficulty in getting the correct "MASK_LENGTH", simply use the "Online IP CIDR/VLSM Calculator" .
10. Now you can use multiple IP addresses as per your situation.
11. Navigate to the "Gateway" section and enter in your gateway address.
12. You can add DNS server addresses by navigating to the "DNS servers <Add...>" section followed by pressing "<Enter>".
Here enter in your DNS server address.
13. You can add multiple DNS server addresses by selecting "Add..." which is available in the "DNS Servers" section followed by pressing "<Enter>".
Here you can enter in another DNS address. Once done, select "<OK>" followed by pressing "<Enter>".
To implement, simply press <Esc>.
14. Next, select "Activate a connection" followed by pressing "<Enter>".
15. Here, you can select the network interface which you configured previously. Continue by selecting "<Deactivate>" followed by pressing "<Enter>".
16. Now, select "<Activate>" followed by pressing "<Enter>".
Exit by pressing "<Esc>". Then press "<Esc>" again.
17. To verify whether the IP address is well configured, simply run the following command;
You will get an output showing that the IP address is correctly configured.