LXD and VPN - Stephane Graber updated his script

In 2014 Stephane Graber had written: https://stgraber.org/2014/09/26/vpn-in-containers/

I emailed Stephane today and asked if it could be updated for use in LXD and he graciously updated the script, not necessarily for LXD specifically but so that it could be used in LXD containers. Here was his message to me:

That script doesn’t actually run a container so much as uses some of
the LXC binaries to manage namespaces.
It should be possible to replace those calls to use the “unshare”
command these days.

So I don’t expect there to be any reason for the script to actually
use LXD at all.
Obviously if you want to run a VPN client inside a LXD container,
that’s perfectly fine too and will work just fine.

So here is the Script Stephane updated so it can be used in LXD containers: