Configuring additional IP address on Ubuntu using Netplan.

This guide is applicable only for KVM based VPSes, for OpenVZ based VPSes please click here

In this article, we will learn how to configure networking in newer versions of Ubuntu, such as Ubuntu 18.04, 19.04 and 19.10 using Netplan.

To Find The Network Gateway and Netmask

To know the gateway and netmask of your IP address, please see this guide http://wiki.crowncloud.net/?viewing_network_gateway_netmask

Configuring additional IPv4

First, We find the Network Interface Name,

ifconfig -a

Output:

ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 193.29.58.131  netmask 255.255.255.0  broadcast 193.29.58.255
        inet6 fe80::5652:ff:fee4:7796  prefixlen 64  scopeid 0x20<link>
        ether 54:52:00:e4:77:96  txqueuelen 1000  (Ethernet)

Note

In this example, the system is configured with the network interface name as ens3, this might not be the case with your system, please verify the system network interface name with the ifconfig -a command above before proceeding with the guide below!

Second, to add additionall ip address.

vi /etc/netplan/60-static.yaml

File Content should be,

network:
  version: 2
  renderer: networkd
  ethernets:
    [below your system interface name needs to use]
    ens3: 
      addresses:
             - ip address here

To configuration the network.

 netplan try

output:

 Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
Do you want to keep these settings?

Press ENTER before the timeout to accept the new configuration

Changes will revert in 113 seconds
Configuration accepted.

After this step try ping the ip.

ping ip address

If ip address is not pinging adding additional ip is unsuccessfull and if it is ping, adding additional ip is successfuly Completed.