I’ve been following this guide to set up a VPC gateway: https://docs.digitalocean.com/products/networking/vpc/resources/droplet-as-gateway/
My droplets are running Ubuntu 20.04
I’m using the
runcmd section of userdata to modify my droplet’s routing table on boot. specifically, I’m changing the default gateway to point at another droplet. The commands are as follows:
runcmd: - ip route add 169.254.169.254 via <OLD_GATEWAY> dev eth0 - route delete default gw <OLD_GATEWAY> eth0 - route add default gw <NEW_GATEWAY> eth1
These changes are visible if I connect to the droplet immediately after boot, as expected. However, after a few minutes the changes are overwritten and the routing table shows that the default gateway has returned to the original value.
I’m aware that these changes will not persist between boots, but it seems that they’re not sticking for more than a few minutes after first boot.
Why might this happen?