Add New IPs (Ubuntu) Print

  • 1

Ubuntu Tools – Add New IPs

This guide shows how to assign additional IP addresses to Ubuntu servers.

Temporary (until reboot)

sudo ip addr add 203.0.113.5/24 dev eth0
sudo ip addr show dev eth0

Remove temporary IP:

sudo ip addr del 203.0.113.5/24 dev eth0

Permanent (Netplan – Ubuntu 18.04+)

sudo nano /etc/netplan/01-netcfg.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses:
        - 203.0.113.10/24
        - 203.0.113.11/24
      gateway4: 203.0.113.1
      nameservers:
        addresses: [8.8.8.8, 1.1.1.1]

Apply changes:

sudo netplan apply
ip -4 addr show dev eth0

Tip: Always check your provider’s documentation for special routing rules when using additional IPs.


Was this answer helpful?

« Back