<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Networking on Such geek. Wow.</title><link>https://www.ericlight.com/tags/networking.html</link><description>Recent content in Networking on Such geek. Wow.</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Sun, 02 Feb 2020 00:00:00 +1300</lastBuildDate><atom:link href="https://www.ericlight.com/tags/networking/index.xml" rel="self" type="application/rss+xml"/><item><title>FreeNAS finally supports ECC crypto!</title><link>https://www.ericlight.com/post/freenas_ecc.html</link><pubDate>Sun, 02 Feb 2020 00:00:00 +1300</pubDate><guid>https://www.ericlight.com/post/freenas_ecc.html</guid><description>&lt;p&gt;Woo! &lt;a class="link" href="https://www.freenas.org" target="_blank" rel="noopener"
 &gt;FreeNAS&lt;/a&gt; finally supports ECC crypto for it&amp;rsquo;s SSL certificates in 11.3!&lt;/p&gt;
&lt;p&gt;I &lt;a class="link" href="https://redmine.ixsystems.com/issues/27665" target="_blank" rel="noopener"
 &gt;reported this as a bug&lt;/a&gt; almost exactly two years ago, and kept having to do nasty workarounds to make it work every time I installed an update. Very happy that it&amp;rsquo;s finally sorted and I can use my proper shiny elliptic curve SSL setup! :)&lt;/p&gt;</description></item><item><title>New things I didn't know about WireGuard</title><link>https://www.ericlight.com/post/wg3.html</link><pubDate>Thu, 27 Dec 2018 00:00:00 +1300</pubDate><guid>https://www.ericlight.com/post/wg3.html</guid><description>&lt;p&gt;This is part of my &lt;a class="link" href="https://www.ericlight.com/post/wg0.html" &gt;brief&lt;/a&gt; &lt;a class="link" href="https://www.ericlight.com/post/wg1.html" &gt;series&lt;/a&gt; &lt;a class="link" href="https://www.ericlight.com/post/wg2.html" &gt;on&lt;/a&gt; &lt;a class="link" href="https://wireguard.com/" target="_blank" rel="noopener"
 &gt;WireGuard&lt;/a&gt;. I&amp;rsquo;m pretty enamoured with WireGuard and the way it works, and I&amp;rsquo;ve been using it pretty seamlessly for over a year now. I&amp;rsquo;ve learned a couple things that weren&amp;rsquo;t immediately obvious though, so I&amp;rsquo;m documenting them here.&lt;/p&gt;
&lt;h2 id="easy-provisioning"&gt;Easy Provisioning
&lt;/h2&gt;&lt;p&gt;Samuel Holland mentioned an interesting trinket, in his post at &lt;a class="link" href="https://lists.zx2c4.com/pipermail/WireGuard/2018-December/003703.html" target="_blank" rel="noopener"
 &gt;https://lists.zx2c4.com/pipermail/WireGuard/2018-December/003703.html&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;[&amp;hellip;] WireGuard will ignore a peer whose public key matches the interface&amp;rsquo;s private key. So you can distribute a single list of peers everywhere.&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;You can combine this with &lt;code&gt;wg addconf&lt;/code&gt; like this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Each peer has its own &lt;code&gt;/etc/WireGuard/wg0.conf&lt;/code&gt; file, which only contains it&amp;rsquo;s &lt;code&gt;[Interface]&lt;/code&gt; section&lt;/li&gt;
&lt;li&gt;Each peer also has a shared &lt;code&gt;/etc/WireGuard/peers.conf&lt;/code&gt; file, which contains all the peers&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;wg0.conf&lt;/code&gt; file also has a PostUp hook, calling &lt;code&gt;wg addconf /etc/WireGuard/peers.conf&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It&amp;rsquo;s up to you to decide how you want to share the peers.conf, be it via a proper orchestration platform, something much more pedestrian like Dropbox, or something kinda wild like Ceph. I dunno, but it&amp;rsquo;s pretty great that you can just wildly fling a peer section around, without worrying whether it&amp;rsquo;s the same as the interface.&lt;/p&gt;
&lt;h2 id="setting-private-key-from-a-file"&gt;Setting Private Key from a file
&lt;/h2&gt;&lt;p&gt;Another piece of learning, courtesy of Samuel Holland, at &lt;a class="link" href="https://lists.zx2c4.com/pipermail/WireGuard/2018-December/003702.html" target="_blank" rel="noopener"
 &gt;https://lists.zx2c4.com/pipermail/WireGuard/2018-December/003702.html&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can read in a file as the Private Key by doing something like:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;PostUp = wg set %i private-key /etc/WireGuard/wg0.key&lt;/code&gt;&lt;/p&gt;</description></item><item><title>WireGuard - Part Three (Troubleshooting)</title><link>https://www.ericlight.com/post/wg2.html</link><pubDate>Mon, 12 Jun 2017 00:00:00 +1200</pubDate><guid>https://www.ericlight.com/post/wg2.html</guid><description>&lt;p&gt;This is part of my &lt;a class="link" href="https://www.ericlight.com/post/wg0.html" &gt;brief&lt;/a&gt; &lt;a class="link" href="https://www.ericlight.com/post/wg1.html" &gt;series&lt;/a&gt; on &lt;a class="link" href="https://wireguard.com/" target="_blank" rel="noopener"
 &gt;WireGuard&lt;/a&gt;. I&amp;rsquo;m pretty enamoured with WireGuard and the way it works, but there were a couple slightly curly bits that I needed to get my head around. This troubleshooting guide is a rough dump of the issues I had, and how I fixed them.&lt;/p&gt;
&lt;h2 id="gotten-stuck"&gt;Gotten Stuck?
&lt;/h2&gt;&lt;p&gt;At this stage, there are actually a few ways that this can go wrong, even though we haven&amp;rsquo;t done much. Think through all the bits:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Installed WireGuard at both ends&lt;/li&gt;
&lt;li&gt;Set up your NAT rule on the remote side&lt;/li&gt;
&lt;li&gt;Created a private and public key on each side&lt;/li&gt;
&lt;li&gt;Put each public key in the opposite side&amp;rsquo;s [Peer] config&lt;/li&gt;
&lt;li&gt;Put a suitable IP address on each side&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="troubleshooting"&gt;Troubleshooting
&lt;/h2&gt;&lt;p&gt;There are, actually, a myriad of ways this can fail:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Broken routing on the client PC&lt;/li&gt;
&lt;li&gt;Broken NAT on the remote router&lt;/li&gt;
&lt;li&gt;Broken routing on the remote PC&lt;/li&gt;
&lt;li&gt;Broken wg0 configuration on one side&lt;/li&gt;
&lt;li&gt;Lack of TCP forwarding on the remote computer&lt;/li&gt;
&lt;li&gt;Lack of Proxy ARP on the remote computer&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you can&amp;rsquo;t ping the remote server yet, don&amp;rsquo;t panic. Run tcpdump to find out what you&amp;rsquo;re missing.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;On the remote server: &lt;code&gt;tcpdump -i wg0&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;On your local machine: &lt;code&gt;ping -c1 10.20.40.1&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That will tell you whether your packets are reaching the remote server, or if they&amp;rsquo;re not getting through the tunnel.&lt;/p&gt;
&lt;p&gt;If they&amp;rsquo;re not making it through the tunnel at all, you&amp;rsquo;ll probably be seeing error messages in the ping. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;PING 10.20.10.1 (10.20.10.1) 56(84) bytes of data.
From 10.20.40.2 icmp_seq=1 Destination Host Unreachable
ping: sendmsg: Required key not available
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That&amp;rsquo;s the error message I got when I set AllowedIPs too strictly. Because I was trying to ping something that was &lt;strong&gt;routable&lt;/strong&gt;, but wasn&amp;rsquo;t within the AllowedIPs range, there was no applicable key for the packet.&lt;/p&gt;
&lt;h2 id="thanks"&gt;Thanks
&lt;/h2&gt;&lt;p&gt;Huge gratitude to &lt;a class="link" href="https://www.zx2c4.com/" target="_blank" rel="noopener"
 &gt;Jason Donenfeld&lt;/a&gt; (aka zx2c4) for spending his time not only reading this post, but also for sending me some fantastic feedback! I&amp;rsquo;d made some bungles in my original post on this topic, and he vastly helped my understanding.&lt;/p&gt;
&lt;p&gt;Also, huge gratitude to another Jason (&lt;a class="link" href="https://keybase.io/rendition" target="_blank" rel="noopener"
 &gt;@rendition&lt;/a&gt;) who has helped me develop from a junior network admin into a &amp;hellip; &amp;lsquo;moderate&amp;rsquo; network admin. I&amp;rsquo;ve learned more in the last year than I ever thought possible. He&amp;rsquo;s taught me nearly everything I know about managed networking, reviewed this post for me, and is actually the guy who introduced me to WireGuard originally!&lt;/p&gt;</description></item><item><title>WireGuard - Part Two (VPN routing)</title><link>https://www.ericlight.com/post/wg1.html</link><pubDate>Sun, 11 Jun 2017 00:00:00 +1200</pubDate><guid>https://www.ericlight.com/post/wg1.html</guid><description>&lt;p&gt;This is a continuation of my brief series on the new &lt;a class="link" href="https://wireguard.com/" target="_blank" rel="noopener"
 &gt;WireGuard&lt;/a&gt; VPN. &lt;a class="link" href="https://www.ericlight.com/post/wg0.html" &gt;Part One&lt;/a&gt; was about the simple building-blocks to get WireGuard working between two endpoints. Now that we&amp;rsquo;ve got a couple machines able to ping each other by IP address, we can carry on a bit deeper into the inter-LAN routing stuff.&lt;/p&gt;
&lt;p&gt;Extending on from the IP addresses in Part One, instead of JUST connecting to the remote machine, I want to actually have access to everything &lt;em&gt;on the whole 10.20.0.0/16 network&lt;/em&gt;; even the non-WireGuard devices. I want it to be like I&amp;rsquo;m there on-site. The idea here is roughly:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Remote machine:&lt;/strong&gt; wg0: 10.20.40.1 (behind public IP 163.172.161.0)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Local machine:&lt;/strong&gt; wg0: 10.20.40.2 (with eth0 on 192.168.88.207)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Machines on remote LAN:&lt;/strong&gt; 10.20.0.0/16&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Remote LAN Watchguard range:&lt;/strong&gt; 10.20.40.0/16 &amp;ndash; note this is within the remote 10.20.0.0/16 range&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;From my local machine, with minimal interaction, I want to be able to ping something like 10.20.&lt;strong&gt;10.30&lt;/strong&gt;, and get a response.&lt;/p&gt;
&lt;p&gt;Happily, now that the two endpoints are talking with each other, there&amp;rsquo;s really not much that has to happen to get things working the way I want.&lt;/p&gt;
&lt;h2 id="remote-config"&gt;Remote Config
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Many Linux distros disable IPv4 packet forwarding by default. But in this case, we very much want this enabled. Edit your &lt;code&gt;/etc/sysctl.conf&lt;/code&gt; file, and look for the line: &lt;code&gt;net.ipv4.ip_forward&lt;/code&gt;, and set the value to 1. You may need to add this line manually, or uncomment it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You&amp;rsquo;ll also need to enable ProxyARP. This is another kernel setting that&amp;rsquo;s usually disabled, so edit &lt;code&gt;/etc/sysctl.conf&lt;/code&gt;, and add the following line: &lt;code&gt;net.ipv4.conf.all.proxy_arp = 1&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Reload your kernel settings. A reboot will do the trick, or you could just run &lt;code&gt;sudo sysctl -p /etc/sysctl.conf&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="starting-wireguard-on-boot"&gt;Starting WireGuard on Boot
&lt;/h2&gt;&lt;p&gt;There are a variety options to do this, and if you&amp;rsquo;re a seasoned sysadmin you probably already have a favourite way.&lt;/p&gt;
&lt;p&gt;One option is to add &lt;code&gt;post-up wg-quick up wg0&lt;/code&gt; to the tail of your eth0 block (or appropriate interface) in /etc/network/interfaces.&lt;/p&gt;
&lt;p&gt;A second option (for systemd users) is to simply run &lt;code&gt;systemctl enable wg-quick@wg0&lt;/code&gt;. This will tell systemd to bring the wg0 interface up once a network connection is established.&lt;/p&gt;
&lt;p&gt;I only do this on the remote machine, because I don&amp;rsquo;t want my local machine to be forever spinning up it&amp;rsquo;s WireGuard connection; however I always want the remote machine listening for my packets. That said, there&amp;rsquo;s probably no reason to avoid this; I just haven&amp;rsquo;t done it yet.&lt;/p&gt;
&lt;h2 id="local-config"&gt;Local Config
&lt;/h2&gt;&lt;p&gt;Here&amp;rsquo;s the really cool bit. Since your remote machine is now set up to perform IPv4 forwaring and ProxyARP, the only thing you need to change on the local side is a single number. Or rather, a couple numbers.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In your &lt;code&gt;/etc/WireGuard/wg0.conf&lt;/code&gt; file, just expand the network range of your interface to include the entire remote LAN:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; [Interface]
 ...
 Address = 10.20.40.2/16

 [Peer]
 ...
 AllowedIPs = 10.20.0.0/16
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now reload your WireGuard config, either by rebooting, or running &lt;code&gt;sudo wg-quick down wg0 &amp;amp;&amp;amp; sudo wg-quick up wg0&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That&amp;rsquo;s all! When you make the above changes, wg-quick will modify your routing table so that &lt;strong&gt;any IP within 10.20.x.y&lt;/strong&gt; will be sent over the wg0 interface. The remote host will dutifully forward the packet out into the rest of the network, and ProxyARP will take care of the rest:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ ping -c1 10.20.10.31
PING 10.20.10.31 (10.20.10.31) 56(84) bytes of data.
64 bytes from 10.20.10.31: icmp_seq=1 ttl=63 time=91.8 ms
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="troubleshooting"&gt;Troubleshooting
&lt;/h2&gt;&lt;p&gt;Okay so by now there&amp;rsquo;s a really good chance that you&amp;rsquo;ve bumped into trouble. I&amp;rsquo;ve started on a basic &lt;a class="link" href="https://www.ericlight.com/post/wg2.html" &gt;WireGuard troubleshooting guide&lt;/a&gt;, but it only covers the issues that I bumped into. If you&amp;rsquo;re still stuck after reading through that, ask a question on the WireGuard Mailing List, or reach out via IRC (#WireGuard on Freenode) - this is all on &lt;a class="link" href="https://www.wireguard.com/#contact-the-team" target="_blank" rel="noopener"
 &gt;the WireGuard website&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="wrap-up"&gt;Wrap-up
&lt;/h2&gt;&lt;p&gt;That should be all! When you reboot the remote server (I specify reboot, because you want to test that your solution can survive an outage at the remote site), you should be able to ping other things in the remote LAN without any additional interaction. I still manually run &lt;code&gt;wg-quick up wg0&lt;/code&gt; on my local laptop, because I don&amp;rsquo;t want to be connected remotely &lt;em&gt;all&lt;/em&gt; the time.&lt;/p&gt;
&lt;h2 id="thanks"&gt;Thanks
&lt;/h2&gt;&lt;p&gt;Huge gratitude to &lt;a class="link" href="https://www.zx2c4.com/" target="_blank" rel="noopener"
 &gt;Jason Donenfeld&lt;/a&gt; (aka zx2c4) for spending his time not only reading this post, but also for sending me some fantastic feedback! I&amp;rsquo;d made some bungles in my original post on this topic, and he vastly helped my understanding.&lt;/p&gt;
&lt;p&gt;If you do end up using WireGuard, &lt;em&gt;go forth and &lt;a class="link" href="https://www.wireguard.com/#donations" target="_blank" rel="noopener"
 &gt;donate&lt;/a&gt;&lt;/em&gt;! Seriously, &lt;strong&gt;at very least&lt;/strong&gt;, send Jason the cost of a local cup of coffee or a beer for his efforts.&lt;/p&gt;
&lt;p&gt;Also, huge gratitude to another Jason (&lt;a class="link" href="https://keybase.io/rendition" target="_blank" rel="noopener"
 &gt;@rendition&lt;/a&gt;) who has helped me develop from a junior network admin into a &amp;hellip; &amp;lsquo;moderate&amp;rsquo; network admin. I&amp;rsquo;ve learned more in the last year than I ever thought possible. He&amp;rsquo;s taught me nearly everything I know about managed networking, reviewed this post for me, and is actually the guy who introduced me to WireGuard originally!&lt;/p&gt;</description></item><item><title>WireGuard - Part One (Installation)</title><link>https://www.ericlight.com/post/wg0.html</link><pubDate>Sat, 03 Jun 2017 00:00:00 +1200</pubDate><guid>https://www.ericlight.com/post/wg0.html</guid><description>&lt;p&gt;&lt;a class="link" href="https://wireguard.com/" target="_blank" rel="noopener"
 &gt;WireGuard&lt;/a&gt; is the most excellent VPN stack around. It&amp;rsquo;s &lt;em&gt;really&lt;/em&gt; fast, the concept of Cryptokey Routing is awesome, and I love the speed and simplicity benefits that come from opionionated cryptography. The protocol is so simple - expressed in a mere 4k lines of code - that it&amp;rsquo;s auditable by anyone.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;But.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;With my initial naive approach, I found myself using HTTPS, over ports forwarded over SSH tunnels, connected over WireGuard. Although it was straightforward to get WireGuard working between two endpoints, I ended up in nested-crypto hell.&lt;/p&gt;
&lt;p&gt;So, this brief series is about making WireGuard work as a VPN onto a different site. We&amp;rsquo;ll start by making it work between two endpoints, and &lt;a class="link" href="https://www.ericlight.com/post/wg1.html" &gt;we&amp;rsquo;ll go forward from there&lt;/a&gt;. My end goal is to have access to all the resources on a remote site, just by running &lt;code&gt;wg-quick up wg0&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The endpoints I&amp;rsquo;m going to set up are at:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Remote machine:&lt;/strong&gt; wg0: 10.20.40.1 (behind public IP 163.172.161.0)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Local machine:&lt;/strong&gt; wg0: 10.20.40.2&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="nat-setup"&gt;NAT Setup
&lt;/h2&gt;&lt;p&gt;Chances are, your remote endpoint is behind a firewall of some sort. Pick a high port, and configure your firewall to forward UDP packets on that port through to your remote WireGuard endpoint. You don&amp;rsquo;t need to do this on your local side, because reply traffic from the remote side will generally be handled by the stateful session part of your firewall.&lt;/p&gt;
&lt;p&gt;Many routers and firewalls offer port address translation (also known as PAT) as part of port forwarding or NAT. This is when a packet hits the firewall on (say) port 57432, and the firewall puts it on the LAN to port 22, for example. You don&amp;rsquo;t want this. I think it&amp;rsquo;s possible with WireGuard, but it adds complexity without benefit.&lt;/p&gt;
&lt;h2 id="config---remote-site"&gt;Config - Remote Site
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a class="link" href="https://www.wireguard.com/install/" target="_blank" rel="noopener"
 &gt;Install WireGuard&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Generate your keys. The following will create a public key and a stub config in /etc/WireGuard/:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; cd /etc/WireGuard
 umask 077
 printf &amp;quot;[Interface]\nPrivateKey = &amp;quot; &amp;gt; wg0.conf
 wg genkey | tee -a wg0.conf | wg pubkey &amp;gt; publickey
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Edit your config to match:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; [Interface]
 PrivateKey = WhAt3v3R= (this is the private key generated on this machine)
 ListenPort = 12345 (this is the UDP port you've forwarded from your firewall)
 Address = 10.20.40.1/24 (this will be the IP given to the wg0 interface)

 [Peer]
 PublicKey = (leave this blank for now; you'll paste in your local public key here soon)
 AllowedIPs = 10.20.40.0/24 (this is the range of WireGuard IP addresses that this Peer's key can be used from)
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;That should be all you need to configure on the remote side for now. Save your wg0.conf file, and bring the interface up:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; wg-quick up wg0
 ping -c1 10.20.40.1
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You should see a bunch of actions performed by wg-quick, and a reply packet from your ping. Now onto the local side.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="config---local-machine"&gt;Config - Local Machine
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Install WireGuard and generate your keys, as per the first two steps above.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Edit your configuration again:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; [Interface]
 PrivateKey = WhAt3v3R+PaRt-tw0= (this is the private key generated on this machine)
 ListenPort = 12345 (this is the UDP port again; I don't think they have to be the same)
 Address = 10.20.40.2/24 (note - different IP address, but in the same range)

 [Peer]
 PublicKey = ?????????? (copy the public key from the REMOTE server here)
 Endpoint = 163.172.161.0:12345 (enter the PUBLIC IP address of the remote site, plus the forwarded port)
 AllowedIPs = 10.20.40.0/24 (specifying that packets using this key must come from within 10.20.40.x)
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now that you&amp;rsquo;ve got a local public key, take a second to paste it into the Peer public key section on the remote server.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Once you&amp;rsquo;re finished you should be able to bring the interface up and ping it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; wg-quick up wg0
 ping -c1 10.20.40.2
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&amp;hellip; and you should even be able to ping the remote server as well:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; ping -c1 10.20.40.1
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="gotten-stuck"&gt;Gotten Stuck?
&lt;/h2&gt;&lt;p&gt;At this stage, there are actually a few ways that this can go wrong, even though we haven&amp;rsquo;t done much. Here&amp;rsquo;s a quick summary of everything we&amp;rsquo;ve done:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Installed WireGuard at both ends&lt;/li&gt;
&lt;li&gt;Set up your NAT rule on the remote side&lt;/li&gt;
&lt;li&gt;Created a private and public key on each side&lt;/li&gt;
&lt;li&gt;Put each public key in the opposite side&amp;rsquo;s [Peer] config&lt;/li&gt;
&lt;li&gt;Put a suitable IP address on each side&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you&amp;rsquo;ve nailed each of those and you&amp;rsquo;re still having trouble, you can have a quick look at the brief Troubleshooting guide I&amp;rsquo;ve put together as &lt;a class="link" href="https://www.ericlight.com/post/wg2.html" &gt;Part Three&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="onto-part-two"&gt;Onto Part Two
&lt;/h2&gt;&lt;p&gt;That should be all you need to get WireGuard working between two machines on two different sites. So far we haven&amp;rsquo;t done anything either interesting or uncommon - this is all the basic stuff you&amp;rsquo;ll find on the &lt;a class="link" href="https://www.wireguard.com/quickstart/" target="_blank" rel="noopener"
 &gt;WireGuard Quick Start&lt;/a&gt; page, although expressed slightly differently. &lt;a class="link" href="https://www.ericlight.com/post/wg1.html" &gt;The next article&lt;/a&gt; will be a bit more about intra-site routing.&lt;/p&gt;
&lt;h2 id="thanks"&gt;Thanks
&lt;/h2&gt;&lt;p&gt;Huge gratitude to &lt;a class="link" href="https://www.zx2c4.com/" target="_blank" rel="noopener"
 &gt;Jason Donenfeld&lt;/a&gt; (aka zx2c4) for spending his time not only reading this post, but also for sending me some fantastic feedback! I&amp;rsquo;d made some bungles in my original post on this topic, and he vastly helped my understanding.&lt;/p&gt;
&lt;p&gt;If you do end up using WireGuard, &lt;em&gt;go forth and &lt;a class="link" href="https://www.wireguard.com/#donations" target="_blank" rel="noopener"
 &gt;donate&lt;/a&gt;&lt;/em&gt;! Seriously, &lt;strong&gt;at very least&lt;/strong&gt;, send Jason the cost of a local cup of coffee or a beer for his efforts.&lt;/p&gt;
&lt;p&gt;Also, huge gratitude to another Jason (&lt;a class="link" href="https://keybase.io/rendition" target="_blank" rel="noopener"
 &gt;@rendition&lt;/a&gt;) who has helped me develop from a junior network admin into a &amp;hellip; &amp;lsquo;moderate&amp;rsquo; network admin. I&amp;rsquo;ve learned more in the last year than I ever thought possible. He&amp;rsquo;s taught me nearly everything I know about managed networking, reviewed this post for me, and is actually the guy who introduced me to WireGuard originally!&lt;/p&gt;</description></item><item><title>HP Procurve's warn-and-disable</title><link>https://www.ericlight.com/post/hp_stormcontrol.html</link><pubDate>Sun, 30 Apr 2017 00:00:00 +1200</pubDate><guid>https://www.ericlight.com/post/hp_stormcontrol.html</guid><description>&lt;p&gt;Since mid-2016, I&amp;rsquo;ve been working as a Network and Security Administrator. While I&amp;rsquo;d done a fair amount of networking previously, most of my experience had been with either unmanaged switches, or in a pre-built Cisco environment. Stepping into the world of managed networking was new for me, as was stepping into the world of HP Switches.&lt;/p&gt;
&lt;p&gt;We were having recurring issues with a certain business unit looping ports on a switch. We had loop-protect running, but it was only set to disable the port after 5 seconds, and only for 300 seconds. This wasn&amp;rsquo;t long enough (we&amp;rsquo;ve since set it to something more resilient).&lt;/p&gt;
&lt;p&gt;During our attempts to minimise the impact of a network loop, we enabled this setting on our HP Procurve switches:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fault-finder broadcast-storm action warn-and-disable
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This seems simple enough. The fault-finder module will look for broadcast storms, and when found, will throw a syslog, an SNMP trap, and will disable the offending switch port.&lt;/p&gt;
&lt;p&gt;Don&amp;rsquo;t be fooled. &lt;strong&gt;This will absolutely wreck your breakfast.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The fault-finder module is a &lt;em&gt;system-wide&lt;/em&gt; setting, which means it applies to uplink ports as well. When a broadcast storm happens, all your distribution switches will see the broadcasts coming from&amp;hellip; their uplink port. So of course, the switches disable their uplink to the rest of the network, neatly segregating themselves away from any services or central management.&lt;/p&gt;
&lt;p&gt;Suffice to say, the next time we had a network loop there was a lot of walking and console cable madness, while we visited each of the distribution switches and manually re-enabled the disabled ports.&lt;/p&gt;
&lt;p&gt;Lesson learned, loop-protect it is. (Until we get STP up campus-wide, of course)&lt;/p&gt;</description></item></channel></rss>