How To Configure Additional IPs In An Ubuntu Instance
Ubuntu Instances on the F2H network use Netplan and Cloud-init to configure the correct network settings. We already configure your NVMe Instance IPv4 address and also provide routes to the gateway. But to configure additional IPs in an Ubuntu instance you must list them in the /etc/netplan/50-cloud-init.yaml file.
Netplan Configuration
When editing the YAML file. It should be constructed in a specific way. Do not use tab spaces. When editing this file only use the space bar. Open up the /etc/netplan/50-cloud-init.yaml file. It will look similar to this.
nano /etc/netplan/50-cloud-init.yaml
network:
version: 2
ethernets:
eth0:
addresses:
- 51.89.70.449/28
- 2001:41wc:800:2c78::87ff/120
gateway4: 51.89.195.254
gateway6: 2001:41d0:800:2cff:ff:ff:ff:ff
match:
macaddress: 02:00:00:49:30:81
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
search:
- first2host.co.uk
set-name: eth0
Configure Addtional IPs
The information in this file is populated by Cloud-init. Under the addresses: section is where we add our additional IP addresses. Use the space bar to create a new line and add your first IP. End the IP with the subnet assigned to you. For single IPs use a /32. For blocks of 8 IPs use /29. You can get this information from the Discovery control panel.
network:
version: 2
ethernets:
eth0:
addresses:
- 51.89.70.449/28
- 51.89.251.32/30
- 51.89.251.33/30
- 51.89.251.34/30
- 51.89.251/35/30
- 2001:41wc:800:2c78::87ff/120
gateway4: 51.89.195.254
gateway6: 2001:41d0:800:2cff:ff:ff:ff:ff
match:
macaddress: 02:00:00:49:30:81
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
search:
- first2host.co.uk
set-name: eth0
We have added the IP block 51.89.251.32/30 to our confirmation file. Next, reboot your Instance by issuing the reboot command. On boot, your additional IPs will be configured. But, unlike the old way of adding interfaces, Netplan makes configuring additional IPs simple and quick.
How was this article? How To Configure Additional IPs In An Ubuntu Instance
You might also like
More from Instance Management
How To Enable IPv6 Netplan Ubuntu Instances
On the Discovery network, we automatically configure IPv4 but sometimes to enable IPv6, Netplan needs some tweaks. In Ubuntu NVMe …
How To Configure An Internal MySQL Database Server
How To Configure An Internal MySQL Database Server High-value assets like database servers are always a target for hackers. Typically, these …