{"id":403,"date":"2021-10-02T15:03:16","date_gmt":"2021-10-02T21:03:16","guid":{"rendered":"https:\/\/thecweb.com\/?p=403"},"modified":"2021-12-23T19:16:41","modified_gmt":"2021-12-24T01:16:41","slug":"wireguard-vpn","status":"publish","type":"post","link":"https:\/\/thecweb.com\/index.php\/2021\/10\/02\/wireguard-vpn\/","title":{"rendered":"WireGuard VPN"},"content":{"rendered":"\n<p>I&#8217;ve been just spinning up VMs left and right since I setup that Oracle VM.  I decided that if I&#8217;m going to be out of town for a week, then I&#8217;d like to have a VPN in to the home network, so that I can get some work done.  It is my vacation, so I&#8217;d like to do some hobbies.  <\/p>\n\n\n\n<p>So far the config is pretty simple.  I like the approch they are using with wiregaurd too.  Very &#8220;unixy&#8221; in that it is just a network interface, that will encrypt with a private key, and decrypt with the client&#8217;s public key.  There is almost no CPU usage.   It does one thing and it does it well.  Use what ever key management or authentication scheme you want.  <\/p>\n\n\n\n<p>New VM on Universe.  2 GB ram and 25GB storage.  Its pool is 100GB.  <\/p>\n\n\n\n<p>package is just called wireguard<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>## Create the Wireguard virtual network adapter\n$ sudo ip link add dev wg0 type wireguard\n\n## Set proper umask for key files, and generate private and public key files\n$ umask 077\n$ wg genkey > privatekey\n$ wg pubkey &lt; privatekey > publickey\n\n## Setup network\n$ sudo ip addr add 10.0.0.1\/24 dev wg0\n\n## attach key to interface\n$ wg set wg0 private-key .\/private\n## up\n$ sudo ip link set wg0 up\n\n## create \/etc\/wireguard\/wg0.conf\n$ sudo vi \/etc\/wireguard\/wg0.conf\n\n<em>contents of new file<\/em>\n\n&#91;Interface]\nSaveConfig = true\nPostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o enp1s0 -j MASQUERADE;\nPostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o enp1s0 -j MASQUERADE;\nListenPort = 56990\nPrivateKey = QETsE2fXOXC81R\/MRYDYjHTyjZxfSlF2vuiCgK5nv0U=\n\n&#91;Peer]\nPublicKey = L\/VrqKjC5\/harAftr+2w0I0hs0MPy0QgXGvvAKqYZlA=\nAllowedIPs = 10.0.0.2\/32\n<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been just spinning up VMs left and right since I setup that Oracle VM. I decided that if I&#8217;m going to be out of town for a week, then I&#8217;d like to have a VPN in to the home network, so that I can get some work done. It is my vacation, so I&#8217;d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[30],"class_list":["post-403","post","type-post","status-publish","format-standard","hentry","tag-tinkering"],"_links":{"self":[{"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/posts\/403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/comments?post=403"}],"version-history":[{"count":2,"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/posts\/403\/revisions"}],"predecessor-version":[{"id":405,"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/posts\/403\/revisions\/405"}],"wp:attachment":[{"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}