Step 1: Identify Your Network Interface

  1. Run the following command to list all network interfaces:

    ip addr show
  2. Identify your active network interface (e.g., ens33, eth0, etc.).

Step 2: Add the Additional IP Using nmcli

CentOS Stream 9 uses NetworkManager by default. You can add an IP with the nmcli command.

  1. Add the new IP address:

    sudo nmcli connection modify <interface_name> +ipv4.addresses <new_ip>/<subnet_mask>

    Example:

    sudo nmcli connection modify ens33 +ipv4.addresses 192.168.1.101/24
  2. Set the connection to manual (if it's not already):

    sudo nmcli connection modify <interface_name> ipv4.method manual
  3. Apply the changes by bringing the connection down and up:

    sudo nmcli connection down <interface_name> && sudo nmcli connection up <interface_name>

Step 3: Verify the IP Binding

To ensure the new IP is bound correctly, run:
ip addr show <interface_name>

You should see the new IP address listed.

Optional: Add IP via Configuration File

If you prefer to configure it manually via configuration files:

  1. Navigate to the network-scripts directory:

    cd /etc/sysconfig/network-scripts/
  2. Edit the primary interface configuration file (replace ens33 with your interface name):

    sudo nano ifcfg-ens33
  3. Add the following line at the end of the file:

    IPADDR2=192.168.1.101
  4. Save and close the file (Ctrl + O, Enter, Ctrl + X).

  5. Restart the network service:

    sudo systemctl restart NetworkManager

Step 4: Test the New IP

Try pinging the new IP or accessing services bound to it:

ping 192.168.1.101
Was this answer helpful? 58 Users Found This Useful (230 Votes)