Using Cloudinit and Netplan with IP’s on a different Network and Gateway

If you’ve ever had to utilize a hosting provider that offers the option to buy extra IPs or failover IP addresses, you may have observed instances where these IPs shared the same gateway as your original IPs, rather than being part of the additional IP network.

Here are some of the providers I’m aware of that require this.

  • OVH
  • SoYouStart

The problem is when you use Cloudinit to deploy your VM’s on Ubuntu which uses netplan and unfortunately, there isn’t a method to configure netplan through Cloudinit to use a gateway that isn’t on the same network as the IP address.

I’m using Proxmox, and although you can create a custom network configuration for netplan.yml and deploy it as a snippet via Cloudinit. This isn’t ideal.

Canonical looks to have fixed the bug this year (2023) in January https://github.com/canonical/cloud-init/pull/1931

However, that most likely relates to the new Ubuntu LTS. I’ve tested this within Ubuntu 20.04, and the appropriate config is in place. Here’s the generated /etc/netplan/50-cloud-init.yaml

root@srv01:~# cat /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    ethernets:
        eth0:
            addresses:
            - 147.135.0.0/24
            match:
                macaddress: 02:00:00:79:e4:73
            nameservers:
                addresses:
                - 213.186.33.99
                search:
                - domain.com
            routes:
            -   on-link: true
                to: default
                via: 15.0.0.254
            set-name: eth0
        eth1:
            dhcp4: true
            match:
                macaddress: 8a:ca:d3:4d:c9:28
            set-name: eth1
    Reddit – Dive into anything
    www.reddit.com
    BUG: No routing in VM with cloud init (ubuntu 18.x – 19.4) | Proxmox Support Forum
    It´s possible a bug in the network setting from proxmox to VMs with cloud-init and ubuntu. I have see many forum entries about the same problemas! The big…
    forum.proxmox.com

    https://linuxconfig.org/how-to-add-static-route-with-netplan-on-ubuntu-22-04-jammy-jellyfish-linux

    Cheapest Cold Storage Backup

    Introduction

    Someone posted on a Facebook group looking for the cheapest means for cold storage backups. I did some research and collected some data.

    Response

    Tapes

    All depends, if you have a petabyte or half a petabyte it might work. It might be cheaper to just sync data to another data center. LTO8/9 are 12/18TB uncompressed.

    But you have to buy new tape drives every 5 years as the technology changes and data gets bigger. If you have a tape library that has four drives, it can be costly.

    You also have to rehydrate, sending tapes back and forth and having backup software manage them. You also need to replace tapes due to lifespan or duplicate tapes for redundancy (they’re not 100% reliable).

    For a small setup, you could look at this, which offers to stage. I haven’t used it but looks cool https://eshop.macsales.com/shop/owc-mercury-pro-lto

    You’ll have a massive upfront cost for tape, the drive being the most expensive, then an appropriate HBA which is usually pretty cheap, and then the tapes, which are also relatively inexpensive.

    But what about the storage of the tapes? Do you ship them to a friend? What software are you going to use for backups? There are lots of caveats with tape, even with LTFS https://getprostorage.com/blog/lto-ltfs-archiving/

    SSDs + Safety Deposit Box

    You could get a safety deposit box, buy 4x8TB SSD’s M.2 and plop them into this bad boy and get 32GB RAW or less in a software RAID.

    https://www.storagereview.com/…/qnap-tbs-464-mini-all…

    You could buy two or even a spinning disk QNAP and rehydrate every month.

    The only issue is M2 SSD’s are expensive, you’d want a SATA 8TB for around $900 pop. and grab this little guy https://www.storagereview.com/…/synology-diskstation…

    Or you could just buy 2TB SSDs and use a docking station like this https://www.amazon.com/…/ref=cm_sw_r_apan_glt_fabc… 

    Use SSDs like tapes. Just keep an eye on https://diskprices.com/ for the cheapest per GB SSDs. The cheapest SSD out there is the SAMSUNG 870 QVO 4TB.

    You could put the SSDs into an electrostatic bag with a dry pack and seal it 🙂

    Online Storage

    Backblaze B2 (Per TB)

    At USD $5/month/TB this is pretty affordable if you have over 20TB per month you can reach out for reserve capacity which requires time commitments.

    https://www.backblaze.com/…/reserve-capacity-storage.html

    Backblaze Personal Backup (Unlimited)

    At USD $5/month if you can use Backblaze Personal Backup, you can back up an unlimited amount of data. The operating system would just need to be able to see the data. This doesn’t come with versioning.

    Backblaze Largest Personal Backup (2018)

    I saw this thread on Lowend Box about the largest personal backup at Backblaze on the Personal Plan that is $5/month. Granted this is data from 2018.

    https://news.ycombinator.com/item?id=20998010

    Here’s a screenshot of the post.

    Here’s the screenshot from imgur.

    Here’s the original image, in case the one from Imgur get’s taken down.

    S3 Glacier

    Cost USD $3/month/TB, and actually cold storage.

    Mega.nz

    Cost EUR €1.56/month/TB, not cold storage.

    Wasabi

    Cost USD $5.99 TB/month, not cold storage.

    OVH Cloud Storage

    Cost USD %$9.5 TB/month, not cold storage.

    Conclusion

    There really isn’t much of a conclusion, the cheapest solution is Backblaze but you can’t backup NAS devices. Mega.nz seems to be the cheapest.

    OVH Public Cloud CentOS 7 Change Hostname

    If you’ve tried to change the hostname on your OVH public cloud instance running CentOS 7, you may have had issues with it persisting after reboot.

    Took me way to long to find this solution, but someone had already spent way too much time figuring it out.

    This GitHub Gist explains it all https://gist.github.com/zmjwong/77ee37deb1749c2582eb

    Basically you need to edit /etc/cloud/cloud.cfg and add “preserve_hostname: true” and then set your hostname using hostnamectl.

    hostnamectl –transient set-hostname your.new.hostname
    hostnamectl –static set-hostname your.new.hostname

    Hope that helps and thank zmjwong!