Managing Power Cuts

Well it’s not as if power cuts are a new thing.  But I had to learn this before I was ready of course:

  • Router resets itself after a power-cut.  No surprises there;
  • Ubuntu LXC containers assign a new MACVLAN address when you launch a new container from an old one (like after major changes, or a make-over, as I have done a few times now);
  • If containers have a new MACVLAN, they won’t connect to your static assigned LAN IP’s after a power-cut, but they won’t drop a current router LAN connection beforehand even if the MACVLAN MAC ID changes.  In other words, unless you remember to do this at the time of creating a new container, you have a surprise coming the next time the router reboots;
  • ..After said power-cut, if your public-IP facing server is one that had a new MAC ID assigned then your your public-IP facing server suddenly has no port 80 and 443 traffic, as the router is sending it to the OLD fixed LAN IP;
  • You go to access a site (say this blog…), and nothing works!

NET RESULT  –>  Everything goes down and it requires a little groping-in-the-dark to find out what happened.

  • My fault.  I should reset my connections when I launched new containers.  Better yet, I might even one day soon learn to use the non-MACVLAN network connector so I don’t have to bother that anymore, but that’s a job for another day.
  • Dumb-luck bonus: my SSH is tunneled directly to my host machine, not the LXC containers, and the MAC address of my hardware at least has not changed – so I could at least log back in via SSH to the LXC host after the router had power restored.  That made it easy to see my new LAN IP addresses so I could make correct assignments to the router for forwarding ports from WAN to LAN; and to the haproxy server for routing to the LAN servers.  So the tip here is – if you elect to use MACVLAN, always SSH into the LXC host, not the LXC container.  🙂

So today’s admin work: reset static LAN IP’s to the LXC containers that have new MAC ID’s via MACVLAN setting and forward ports to the new IP address of the haproxy public-ip facing proxy server.   And all this was after power was restored, which in itself was more groping in the dark… 🙂
Tip:  you can find/verify MAC ID from this command:
lxc info container_name
And, also today…after that self-inflicted fiasco, I ordered an uninterruptible power supply for my modem and router as power-cuts clearly have the potential to catch me flat-footed again.  🙂