This guide handles environments where a Virtual Router (VR) manages the Public IPs, meaning they cannot be assigned directly to the Ubuntu interface. We must map them to internal 10.x.x.x addresses.
Navigate to Network > Public IP Addresses. Acquire the necessary IPs in your allocated range.
Go to Instances > [VM Name] > NICs. Click the primary interface and acquire Secondary IPs (e.g., 10.1.1.225, 10.1.1.227, etc.).
Under Public IP Addresses, select each IP and map it to its respective internal Secondary IP.
Identify your interface name using ip link show, then modify your configuration.
Open the config: sudo nano /etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0: # Replace with ens3/ens18 if needed
addresses:
- 10.1.1.225/24
- 10.1.1.227/24
- 10.1.1.228/24
- 10.1.1.229/24
- 10.1.1.230/24
routes:
- to: default
via: 10.1.1.1
nameservers:
addresses: [1.1.1.1, 8.8.8.8]
Apply changes and verify the DNS symlink:
sudo netplan apply sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
Run this script to verify all IPs are successfully routing through the NAT:
for ip in 10.1.1.225 10.1.1.227 10.1.1.228 10.1.1.229 10.1.1.230; do ping -I $ip -c 1 -W 2 8.8.8.8 > /dev/null && echo "IP $ip ONLINE" || echo "IP $ip OFFLINE" done