How to add IPv4 addresses to a VPS, put all of them into netplan and check that the server answers and goes out from each. Ubuntu 24.04.
A second address helps when one server hosts sites with their own certificates, when mail should live apart from everything else, or when a project must not share an address with its neighbour. You can add an address in WeaselCloud yourself in a couple of minutes, but the server will not start using it by itself: the addresses from the panel have to be written into the network settings of the system. Below is how to do it on Ubuntu 24.04, and the trap we ran into while testing.
Short version. Extra addresses are ordered in the client area: service → Upgrade/Downgrade Options → number of IP addresses (from 1 to 10), each one costs $1.50 a month. In the panel all addresses sit on one network interface of the server and show on the service page. The system does not pick them up: DHCP hands the server just one address, and after a purchase the new one may become the main address while the old one disappears. So you put all addresses, including the one you started with, into a separate netplan file and apply it. Check with
ip -br aandcurl --interface <IP> https://api.ipify.orgfor each address.
The examples use documentation addresses: 203.0.113.10 is the original address of the server, 198.51.100.21 and 198.51.100.24 are the added ones. Yours will differ.
When one address is not enough
People usually buy a second address for one of three reasons. The first is mail reputation: a mail server on its own address does not share it with a website, and the PTR record can carry the name of exactly that server. The second is certificates and old clients that need an address of their own for every site. The third is keeping projects apart, so that outgoing traffic of one does not spoil the reputation of another's address.
If you simply want a second website, you do not need an address: the web server tells sites apart by name, not by address.
How to add an address
- Open the list of services in the client area and choose the server.
- On the service page click Upgrade/Downgrade Options (in the Russian interface it is «Параметры обновления»).
- In the IP addresses block, enter in the New configuration field the total number of addresses the server should have. It has one now and we need two more, so we set 3. The limit is 10.
- Click the continue button, check the amount, choose a payment method and click Checkout.
An address costs $1.50 a month, but when you add one in the middle of a period, a proportional part is charged. We added two addresses 29 days before the next payment, and the order came to $2.90 instead of $3.00. From then on the renewal amount of the server grows by $1.50 per address.
The same slider is in the order form of a new VPS, so addresses can be taken at the moment of purchase.
What the panel shows
After payment the addresses appear in the panel almost at once. On the service page they show in two places: in Instance details, in the IP addresses row, and below, in Network interfaces. There is one network interface, NIC 1, and it carries the whole list: all addresses of the server are attached to one interface and one MAC address, with no separate network card per address.
The full list with reverse records is on the IP addresses tab: every address has a row and an Edit reverse DNS link.
Note that the addresses may come from different subnets. On our server the original address was from one network and the two added ones from another.
Why the server does not see the new addresses
The panel lists the addresses, the server does not have them. Here is what the network looked like before the purchase:
The words "proto dhcp" matter: the address is given to the server by DHCP, and the DHCP server of the provider hands out one address per interface. The third, fourth and further addresses do not arrive this way.
Now the trap. When we restarted the network service of the server after the purchase, DHCP handed out the new address as the main one, and the original one was gone from the lease. The server stayed alive, but it stopped answering SSH on the old address, and we could only get in on the new one:
The conclusion is simple: write down all addresses of the server, including the one you came with. Otherwise, after the next lease renewal or a reboot, the familiar address that your DNS records point to may stop answering. Keep a spare way in before you edit anything: the Console button on the service page.
How to configure the addresses on Ubuntu 24.04
Ubuntu configures the network with netplan. The main file /etc/netplan/50-cloud-init.yaml is generated by cloud-init and is better left alone: the header of the file itself says that changes do not persist across a reboot. Create your own file next to it, and netplan will merge it into the main one. DHCP stays on in the main file: it supplies the default route and DNS.
A few notes:
ens3is the interface name on our server. Yours may be different, find it withip -br a.- The list holds three addresses: the original and the two new ones. The
/32mask means "this address on its own, without a subnet of its own". For addresses from another subnet that is the simplest way, and no gateway or mask is needed: the default route stays from DHCP, and that is exactly how it worked for us. chmod 600is there because netplan complains about files with open permissions.- If you are afraid of losing access, run
sudo netplan tryinstead ofnetplan apply: it applies the settings and rolls them back after two minutes unless you confirm.
You can create the file in an editor such as nano too. Just indent with spaces, never tabs.
How to check that it works
First see that all addresses are on the interface. Then check outgoing traffic from each one: the --interface key makes curl send the request from the chosen address, and the ipify service reports where the request came from.
The extra 198.51.100.21/24 in the list is the one DHCP gave out: it duplicates the static one and does no harm. For incoming traffic, test the addresses from outside, from another machine: ping 198.51.100.24 and ssh [email protected]. On our server ping and SSH answered on all three addresses.
One consequence: the address used for outgoing connections when a program has not chosen one is set by DHCP. After the purchase on our server it turned out to be the new address, not the original. If a mail server or a client must go out from a particular address, set it in the program itself (for Postfix that is smtp_bind_address, many clients have a bind-address option).
A PTR for every address
Each address can have its own reverse record, set by yourself: on the IP addresses tab click Edit reverse DNS next to the address and enter the name. The panel first checks that this name has an A record for this very address, and if it does not, it asks you to create it and save the form again. Details and the check with dig -x are in the article about PTR and an additional IPv4.
How to roll it back
If the extra addresses are no longer needed, open the same Upgrade/Downgrade Options and set the previous number. We went from 3 back to 1: the order came to $0.00, and the renewal amount went back to what it was. The order of steps:
- Remove the extra addresses from
60-extra-ips.yaml, or delete the file if no additional addresses remain, and apply the settings. - Reduce the number in Upgrade/Downgrade Options and place the order.
- Check
ip -br a: DHCP gave us the original address back on its own. If settings for the old addresses remain on the server, they simply answer nothing, but it is better to remove them.
FAQ
How many addresses can I add?
The slider in the order form and in the upgrade options allows from 1 to 10 addresses per server, counting the original one.
How much does an additional IPv4 cost?
$1.50 a month per address. If you add one in the middle of a paid period, a proportional part is charged, and from then on the address is part of the renewal amount.
Do I need to reboot the server after the purchase?
No. The addresses appear in the panel without a reboot, and in the system they start working after netplan apply.
Why can I not log in on the old address after the purchase?
Most likely DHCP replaced the main address of the server with the new one. Log in on the new address or through the Console button on the service page, and put all addresses into netplan as described above.
Is a separate gateway needed for the new addresses?
Not on our server: addresses from another subnet worked as /32 on the same interface with the default route from DHCP.
Takeaways
- An additional IPv4 costs $1.50 a month and is ordered in Upgrade/Downgrade Options of the service.
- In the panel all addresses of the server are attached to one interface, NIC 1.
- The system does not pick them up by itself: DHCP hands out one address, and after a purchase it may change.
- Put all addresses, including the original one, into a separate netplan file with the /32 mask and apply it.
- Check:
ip -br aandcurl --interface <IP> https://api.ipify.org. - A PTR for each address is set on the IP addresses tab, provided the A record already points to that address.
What's next
- PTR record and an additional IPv4 — reverse DNS for each address.
- Billing cycle and auto-renewal — how added addresses enter the renewal amount.
- Client area overview — where things are.
🎁 40% off the first month of a new VPS. Promo code GUIDE40
Need a server for your tasks? The first month at a discount.
EnterGUIDE40at checkout. One use per customer.
Pick a VPS and claim the discount →
