
- Kali Linux Tutorial
- Kali Linux - Home
- Installation & Configuration
- Information Gathering Tools
- Vulnerability Analyses Tools
- Kali Linux - Wireless Attacks
- Website Penetration Testing
- Kali Linux - Exploitation Tools
- Kali Linux - Forensics Tools
- Kali Linux - Social Engineering
- Kali Linux - Stressing Tools
- Kali Linux - Sniffing & Spoofing
- Kali Linux - Password Cracking Tools
- Kali Linux - Maintaining Access
- Kali Linux - Reverse Engineering
- Kali Linux - Reporting Tools
- Kali Linux Useful Resources
- Kali Linux - Quick Guide
- Kali Linux - Useful Resources
- Kali Linux - Discussion
3 Ways to Set a Static IP Address in RHEL 8
RHEL 8 (Red Hat Enterprise Linux 8) is a popular Linux-based operating system used by many organizations for their servers and workstations. In RHEL 8, IP (Internet Protocol) addresses can be set dynamically or statically. A dynamic IP address is assigned automatically by a DHCP (Dynamic Host Configuration Protocol) server, while a static IP address is manually configured by user. In this article, we will discuss three ways to set a static IP address in RHEL 8.
Using Network Manager GUI
The Network Manager GUI is a graphical user interface that makes it easy to manage network settings, including setting a static IP address. Here are steps to follow −
Step 1 − Open Network Manager GUI
Click on network icon in system tray (the icon that looks like two arrows pointing up and down). Then click on gear icon to open Network Manager settings.
Step 2 − Select network interface
In Network Manager settings, select network interface that you want to set a static IP address for. This could be your Ethernet connection or a Wi-Fi connection.
Step 3 − Click on IPv4 tab
Click on IPv4 tab in Network Manager settings to configure IPv4 settings for selected network interface.
Step 4 − Select manual method
Under IPv4 tab, select "Manual" method for "Addresses" setting.
Step 5 − Add static IP address
In "Addresses" section, click on "+" button to add a new IP address. Enter IP address, subnet mask, and gateway address for your network.
Step 6 − Save changes
Click on "Apply" button to save changes and set static IP address for selected network interface.
Using nmcli Command Line Tool
The nmcli command line tool is a powerful way to manage network settings in RHEL 8. Here are steps to follow −
Step 1 − Open a terminal window
Open a terminal window by pressing "Ctrl+Alt+T" or by clicking on terminal icon in system tray.
Step 2 − List available network connections
Run following command to list available network connections −
nmcli connection show
This will show a list of available network connections on your system.
Step 3 − Select network interface
Run following command to select network interface that you want to set a static IP address for −
nmcli connection modify <interface> ipv4.method manual
Replace "<interface>" with name of network interface that you want to configure. For example, if you want to configure your Ethernet connection, command would be −
nmcli connection modify eth0 ipv4.method manual
Step 4 − Add static IP address
Run following command to add static IP address −
nmcli connection modify <interface> ipv4.addresses <ip_address>/<subnet_mask> <gateway_address>
Replace "<interface>" with name of network interface that you want to configure. Replace "<ip_address>" with static IP address that you want to set. Replace "<subnet_mask>" with subnet mask for your network. Replace "<gateway_address>" with gateway address for your network
For example, if you want to set IP address to "192.168.1.100", subnet mask to "255.255.255.0", and gateway address to "192.168.1.1", command would be −
nmcli connection modify eth0 ipv4.addresses 192.168.1.100/24 192.168.1.1
Step 5 − Set DNS server
Run following command to set DNS server for network interface −
nmcli connection modify <interface> ipv4.dns <dns_server>
Replace "<interface>" with name of network interface that you want to configure. Replace "<dns_server>" with IP address of your DNS server.
For example, if your DNS server's IP address is "8.8.8.8", command would be −
nmcli connection modify eth0 ipv4.dns 8.8.8.8
Step 6 − Save changes
Run following command to save changes −
nmcli connection up <interface>
Replace "<interface>" with name of network interface that you configured. For example, if you configured your Ethernet connection, command would be −
nmcli connection up eth0
Using Network-scripts Configuration Files
The network-scripts configuration files are a set of files that define network interface configurations in RHEL 8. Here are steps to follow −
Step 1 − Open network-scripts directory
Open network-scripts directory by running following command −
cd /etc/sysconfig/network-scripts/
Step 2 − Edit network interface configuration file
Run following command to edit network interface configuration file −
sudo nano ifcfg-<interface>
Replace "<interface>" with name of network interface that you want to configure. For example, if you want to configure your Ethernet connection, command would be −
sudo nano ifcfg-eth0
Step 3 − Set static IP address
Add following lines to configuration file −
BOOTPROTO=none IPADDR=<ip_address> NETMASK=<subnet_mask> GATEWAY=<gateway_address> DNS1=<dns_server>
Replace "<ip_address>" with static IP address that you want to set. Replace "<subnet_mask>" with subnet mask for your network. Replace "<gateway_address>" with gateway address for your network. Replace "<dns_server>" with IP address of your DNS server.
For example, if you want to set IP address to "192.168.1.100", subnet mask to "255.255.255.0", gateway address to "192.168.1.1", and DNS server to "8.8.8.8", configuration file would look like this −
BOOTPROTO=none IPADDR=192.168.1.100 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 DNS1=8.8.8.8
Step 4 − Save changes
Save changes to configuration file and exit text editor.
Step 5 − Restart network service
Run following command to restart network service −
sudo systemctl restart network
Conclusion
In this article, we have discussed three ways to set a static IP address in RHEL 8. Network Manager GUI provides an easy-to-use graphical interface for configuring network settings, while nmcli command line tool and network-scripts configuration files provide more advanced options for configuring network interfaces. By following steps outlined in this article, you can set a static IP address in RHEL 8 to ensure that your system has a consistent and reliable network connection.
- Related Articles
- Difference between Static IP Address and Dynamic IP Address
- 3 Ways to Create a Network Bridge in RHEL CentOS 8
- Validate IP Address in C#
- Validate IP Address in Python
- Validate IP Address in C++
- Difference between IP Address and MAC Address
- Difference between MAC Address and IP Address
- Alias/Secondary IP Address
- How to get a Docker Container IP address?
- How to hide an IP address
- Defanging an IP Address in Python
- How to identify server IP address in PHP?
- How to get the ip address in C#?
- Program to convert IP address to hexadecimal in C++
- C Program to validate an IP address
