Skip to content

Setting additional static IP address to interface with DHCP

Adding an additional static IP address to an interface that already receives a primary IP via DHCP can be useful for a number of reasons:

  1. The need for a permanent IP address for a service or device on the network. For example, a web server, mail server, network printer, etc.

  2. To organize an additional subnet or VLAN within the main network. The subnet is assigned its own static IP address.

  3. Separate traffic from different services or applications using IP addresses on the same interface. For example, a separate IP for web traffic and a separate IP for databases.

  4. Provide static IP addresses to virtual machines or containers deployed on a physical server.

  5. Provide redundancy - assigning a secondary IP address to switch to if the primary address is unavailable.

  6. Expand the pool of available IP addresses on the network with a limited range assigned by the DHCP server.

Rocky/Alma/CentOS

  1. It is necessary to check the name of the network adapter with the command ip a and remember it:

  2. Then run the command nmtui and select Edit a connection:

  3. Select Add (add interface):

  4. In the list, select the VLAN type:

  5. It is necessary to specify the Profile name and Device with the name of the current interface, adding .0 to it. Parent interface - the main interface in the system. In the IPv4 Configuration section, set the settings for the allocated address and network. If necessary, specify the required DNS. And press <OK>.

    For example in picture below name of parent's interface is esn1.

  6. Then exit the menu. Go to the Activate a connection tab:

  7. Make sure the new created interface is active, activate it if necessary:

  8. Exit the utility and make sure the configuration of the created interface is correct:

Ubuntu (netplan):

  1. Check the interface parameters with the ip a command:

  2. Open the netplan configuration file with any text editor:

  3. Add the VLAN configuration according to the name of your interface (the link parameter) and network settings received for the new IP address (the addresses parameter). For example in picture below name of parent's (parameter link) interface is esn1:

  4. Save the changes and close the editor. Then apply the configuration using the netplan apply command and make sure the settings are correct using the ip a command:

Debian:

  1. Check the interface parameters with the ip a command:

  2. Open the network configuration file with any text editor: /etc/network/interface:

  3. Add the network interface configuration according to the name of your interface, adding :0 to it, and the network settings that were received for the new IP address. For example in picture below name of parent's (parameter 'link') interface is esn1:

  4. Restart the service with service networking restart and check the network settings: