Add additional IP addresses to Ubuntu

Login as root then enter command

nano /etc/network/interfaces

If have something like this on that file

iface enp1s0f0 inet static
        address 123.124.125.40
        netmask 255.255.255.0
        gateway 123.444.123.1

Then to add additional ips, have it like this

iface enp1s0f0 inet static
        address 123.124.125.40
        netmask 255.255.255.0
        gateway 123.444.123.1

iface enp1s0f0 inet static
        address 123.124.125.41
        netmask 255.255.240.0

iface enp1s0f0 inet static
        address 123.124.125.42
        netmask 255.255.240.0

iface enp1s0f0 inet static
        address 123.124.125.43
        netmask 255.255.255.0

In the above, first 1 is main ip and rest of them are additional ips. enp1s0f0 might vary system to system. After that restart network using safe way:

ifdown enp1s0f0 && ifup enp1s0f0

Check the ips using:

ip addr

The restart

Source: https://www.reddit.com/r/linuxquestions/comments/cfl0mj/how_do_i_add_an_additional_ip_address_to/