wg genkey | tee my_private | wg pubkey > my_public # both for Client and Server
ip link add wg0 type wireguard
ip addr add 192.168.2.2/24 dev wg0
wg set wg0 private-key ./my_private # server's private key
ip link set wg0 upIf you've added some runcmd lines to your cloud-init config, and the commands don't seem to be executing, here's a few things you should know:
runcmdonly has code to "shellify" your strings or array of strings (i.e: turns them into a shell script)runcmdwill only write a shell script into the file/var/lib/cloud/instance/scripts/runcmdruncmdis part of thecloud_config_modulesboot stage- You need to
executethat runcmd shell script using thescripts-usermodule scripts-useris part of thecloud_final_modulesboot stage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env sh | |
| # Copyright (c) 2015 Nathan Schulte | |
| # set LOGIN and API_KEY below -- | |
| # see bottom for example use, in this case, checking and updating the default DNS A RR for a domain | |
| # 0: request URI, e.g. '/dns/example.com/listRRs' | |
| # 1..n: parameters | |
| make_request () { | |
| LOGIN='' |