<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Setup:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Client - Raspberry PI, running Wireguard native</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Server - FreeBSD box, running Wireguard-go</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif">
<br>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif">
Note, all of the computers involved in the test are running inside my local LAN, so there are no (active) firewalls involved at the moment, so any/all traffic is allowed between hosts.</div>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I setup a proof of concept using a FreeBSD VM, and monitored the entire process, and it worked fine (sort of, but that's a topic for another email).</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
When I switched to a physical box (same OS version, etc..), things didn't work so well.  But, occassionally, it would start working for reasons that weren't obvious, when I finally figured out what was going on.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
On the FreeBSD box (server), I have the em0 interface which is the local ethernet.  It also has the wg0 interface, which was created by wireguard-go.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Server Configuration file:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif">
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
---- cut here -----</div>
<span style="font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important"></span>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
<span>[Interface]<br>
</span>
<div>ListenPort = 1194<br>
</div>
<div>PrivateKey = ...</div>
<div><br>
</div>
<div>[Peer]<br>
</div>
<div>PublicKey = ...</div>
<div>PresharedKey = ...</div>
<div>AllowedIPs = 10.8.0.2/32</div>
<div>PersistentKeepalive = 120</div>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255)">
---- cut here -----</div>
<span style="font-family: Calibri, Helvetica, sans-serif; background-color: rgb(255, 255, 255); display: inline !important"></span>Pretty straight-foward (no Endpoint since the client provides it)</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif">
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif">
<br>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif">
On the RPI, it uses wireless, so wlan0, and the wg0 interface.</div>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif">
---- cut here -----</div>
[Interface]<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div>PrivateKey = ...</div>
<div><br>
</div>
<div>[Peer]<br>
</div>
<div>Endpoint = server.yogotech.com:1194<br>
</div>
<div>PublicKey = ...<br>
</div>
<div>PresharedKey = ... </div>
<div>AllowedIPs = 10.8.0.1/32</div>
<div>PersistentKeepalive = 120<br>
</div>
<span></span>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif">
---- cut here -----</div>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Again, no ListenPort since it has to connect to the server and the port doesn't matter.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
If I sniff on the physical on the FreeBSD box, I can see packets from the PI</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
# tcpdump -ni em0 port 1194</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span>14:53:41.454233 IP 172.30.77.45.40788 > 172.30.77.1.1194: UDP, length 148<br>
</span><span></span>...</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Unfortunately, there is no connectivity.  The FreeBSD box doesn't do anything with the packets.  It will stay that way all day without actually making a connection.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
However, if I do the following</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
# tcpdump -ni wg0</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
As soon as this is done, wireguard starts working.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The kernel message that is created when this occurs is:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span>wg0: promiscuous mode enabled<br>
</span>
<div>wg0: promiscuous mode disabled<br>
</div>
<span></span>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
This is very repeatable.  The link will stay active until the link is refreshed (stopped/restarted) at the server end, at which point it will not reconnect UNTIL I put the wg0 interface in promiscous mode (my guess) using tcpdump.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Note, if I don't refresh the link on the server, the client can reboot/restart the connection at will without issue.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I'm trying a simple post-configuration script to fix the issue with</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span>#!/bin/sh</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span>/usr/sbin/tcpdump -ni wg0 > /dev/null 2>&1 &<br>
</span>
<div>pid=$!<br>
</div>
<div>sleep 5<br>
</div>
<div>kill $pid<br>
</div>
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
As I don't know anything else that sticks the interface into promiscous mode.  However, this is *REALLY* ugly.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Ideas?</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Nate</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
</body>
</html>