Settings additional IP’s on Ubuntu 18.04

Connect to the server via SSH and edit file /etc/netplan/01-netcfg.yaml:

nano /etc/netplan/01-netcfg.yaml

The current settings are as follows:

network:
         version: 2
          renderer: networkd
          ethernets:
              ens3: addresses: [ 94.103.83.39/24 ]
               gateway4: 94.103.83.1
                nameservers:
                       addresses: — «8.8.8.8»

And then add the following:

network:
         version: 2
          renderer: networkd
          ethernets:
              ens3: addresses: [ 94.103.83.39/24, 95.142.45.241/24 ]
               gateway4: 94.103.83.1
                nameservers:
                       addresses: — «8.8.8.8»
               routes:
                   — to: 0.0.0.0/0
                      via: 94.103.83.1
                      metric: 100
                   — to: 0.0.0.0/0
                      via: 95.142.45.1
                       metric: 100 

where 95.142.45.241 is an additional dedicated IP, and 95.142.45.1 is a gateway.

Check:

netplan try   

If there are no errors, then apply the settings.