• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Monday, May 12, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to Add IPs on Rocky Linux: A Step-by-Step Guide

in Linux OS, Red Hat Enterprise Linux, Rocky Linux
How to Add IPs on Rocky Linux

Rocky Linux is rapidly gaining popularity as a reliable, enterprise-ready, and community-driven Linux distribution. One of the essential tasks when configuring a Rocky Linux server is adding IP addresses. In this blog post, we will discuss how to add IPs on Rocky Linux using various methods, such as IP aliasing and configuring a network interface with multiple IPs.

1. Understanding IP Aliasing

IP aliasing is a technique that allows you to assign multiple IP addresses to a single network interface. This is particularly useful for running multiple services on a single server, each bound to a separate IP address. For instance, you may want to run a LAMP stack and a PowerDNS server on the same machine.

2. Adding IPs using IP Aliasing

Here’s a step-by-step guide to adding IPs using IP aliasing:

  1. Identify the network interface: Use the ip addr command to list all network interfaces and their associated IP addresses.
  2. Create a new configuration file: Copy the existing network interface configuration file to a new file, replacing eth0 with your network interface name and :0 with the desired alias number. For example:
sudo cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
  1. Modify the new configuration file: Edit the newly created configuration file using a text editor, such as vi or nano. Update the DEVICE, NAME, IPADDR, and NETMASK parameters to reflect the new IP address and alias number. For example:
vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
DEVICE=eth0:0
NAME=eth0:0
IPADDR=192.168.1.2
NETMASK=255.255.255.0
Adding IPs
  1. Restart the network service: Restart the network service to apply the changes:
sudo systemctl restart NetworkManager
  1. Verify the new IP address: Use the ip addr command again to verify that the new IP address has been added.

3. Configuring a Network Interface with Multiple IPs

Another approach to adding IPs on Rocky Linux is by configuring a network interface with multiple IP addresses. This method is commonly used with KVM virtualization and Proxmox VE. Follow these steps:

  1. Identify the network interface: Use the ip addr command to list all network interfaces and their associated IP addresses.
  2. Edit the network interface configuration file: Open the network interface configuration file with a text editor, such as vi or nano. For example:
sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0
  1. Add the new IP addresses: Add the new IP addresses using the IPADDR# and PREFIX# parameters, where # is a unique number for each additional IP address. For example:
IPADDR1=192.168.1.3
PREFIX1=24
IPADDR2=192.168.1.4
PREFIX2=24
  1. Restart the network service: Restart the network service to apply the changes:
sudo systemctl restart NetworkManager
  1. Verify the new IP addresses: Use the ip addr command again to verify that the new IP addresses have been added.

4. Managing IP Addresses with NetworkManager

Rocky Linux comes with NetworkManager, a dynamic network control and configuration system that can manage IP addresses more efficiently. NetworkManager supports various network devices, including Ethernet, Wi-Fi, and mobile broadband devices. Here’s how to use NetworkManager to add IPs:

  1. Install NetworkManager: If NetworkManager is not already installed, install it using the following command:
sudo dnf install NetworkManager
  1. Enable and start NetworkManager: Enable and start the NetworkManager service using:
sudo systemctl enable --now NetworkManager
  1. Add IP addresses: Use the nmcli command to add IP addresses to the network interface. For example:
sudo nmcli connection modify eth0 +ipv4.addresses "192.168.1.3/24"
sudo nmcli connection modify eth0 +ipv4.addresses "192.168.1.4/24"
  1. Restart NetworkManager: Restart the NetworkManager service to apply the changes:
sudo systemctl restart NetworkManager
  1. Verify the new IP addresses: Use the nmcli command to verify that the new IP addresses have been added:
nmcli connection show eth0

Conclusion

Adding IPs on Rocky Linux is a crucial step in configuring your server for various purposes, such as hosting multiple services, virtualization, and more. In this blog post, we’ve discussed three different methods to add IPs on Rocky Linux: IP aliasing, configuring a network interface with multiple IPs, and using NetworkManager. Each method has its advantages, so choose the one that best suits your needs.

For more information on managing your Rocky Linux server, check out our tutorials on how to set up RAID 1, how to install Ansible server, and how to install VirtualBox. These guides will help you enhance your server management skills and make the most out of your Rocky Linux experience.

ShareTweet
Previous Post

How to Install and Configure LAMP Stack on Rocky Linux

Next Post

How to Install FTP Server on Rocky Linux

Related Posts

How to Install and Configure OpenVAS on Rocky Linux

How to Install and Configure OpenVAS on Rocky Linux

How to Install and Configure Nikto on Rocky Linux

How to Install and Configure Nikto on Rocky Linux

Set up FreeIPA on Rocky Linux

How to Install and Configure FreeIPA on Rocky Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.