wireguard.lists.zx2c4.com archive mirror
 help / color / mirror / Atom feed
* Wireguard-go on FreeBSD - Not working until the interface (wg0) is set into promiscuous mode
@ 2019-02-06 22:26 Nate Williams
  2019-02-17  2:24 ` Jason A. Donenfeld
  0 siblings, 1 reply; 4+ messages in thread
From: Nate Williams @ 2019-02-06 22:26 UTC (permalink / raw)
  To: wireguard


[-- Attachment #1.1: Type: text/plain, Size: 2695 bytes --]

Setup:

Client - Raspberry PI, running Wireguard native
Server - FreeBSD box, running Wireguard-go

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.

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).

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.

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.

Server Configuration file:
---- cut here -----
[Interface]
ListenPort = 1194
PrivateKey = ...

[Peer]
PublicKey = ...
PresharedKey = ...
AllowedIPs = 10.8.0.2/32
PersistentKeepalive = 120
---- cut here -----
Pretty straight-foward (no Endpoint since the client provides it)

On the RPI, it uses wireless, so wlan0, and the wg0 interface.
---- cut here -----
[Interface]
PrivateKey = ...

[Peer]
Endpoint = server.yogotech.com:1194
PublicKey = ...
PresharedKey = ...
AllowedIPs = 10.8.0.1/32
PersistentKeepalive = 120
---- cut here -----
Again, no ListenPort since it has to connect to the server and the port doesn't matter.

If I sniff on the physical on the FreeBSD box, I can see packets from the PI
# tcpdump -ni em0 port 1194
14:53:41.454233 IP 172.30.77.45.40788 > 172.30.77.1.1194: UDP, length 148
...
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.

However, if I do the following
# tcpdump -ni wg0

As soon as this is done, wireguard starts working.
The kernel message that is created when this occurs is:
wg0: promiscuous mode enabled
wg0: promiscuous mode disabled

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.

Note, if I don't refresh the link on the server, the client can reboot/restart the connection at will without issue.

I'm trying a simple post-configuration script to fix the issue with
#!/bin/sh
/usr/sbin/tcpdump -ni wg0 > /dev/null 2>&1 &
pid=$!
sleep 5
kill $pid

As I don't know anything else that sticks the interface into promiscous mode.  However, this is *REALLY* ugly.

Ideas?


Nate



[-- Attachment #1.2: Type: text/html, Size: 9418 bytes --]

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Wireguard-go on FreeBSD - Not working until the interface (wg0) is set into promiscuous mode
  2019-02-06 22:26 Wireguard-go on FreeBSD - Not working until the interface (wg0) is set into promiscuous mode Nate Williams
@ 2019-02-17  2:24 ` Jason A. Donenfeld
  2019-02-17  5:56   ` Nate Williams
  2019-02-17  5:57   ` Nate Williams
  0 siblings, 2 replies; 4+ messages in thread
From: Jason A. Donenfeld @ 2019-02-17  2:24 UTC (permalink / raw)
  To: Nate Williams; +Cc: wireguard

That's odd. Does this fix it for you?

https://git.zx2c4.com/WireGuard/commit/?id=7c833642dfa342218602ab18e7091e86408d2982
_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Wireguard-go on FreeBSD - Not working until the interface (wg0) is set into promiscuous mode
  2019-02-17  2:24 ` Jason A. Donenfeld
@ 2019-02-17  5:56   ` Nate Williams
  2019-02-17  5:57   ` Nate Williams
  1 sibling, 0 replies; 4+ messages in thread
From: Nate Williams @ 2019-02-17  5:56 UTC (permalink / raw)
  To: Jason A. Donenfeld, Nate Williams; +Cc: wireguard


[-- Attachment #1.1: Type: text/plain, Size: 478 bytes --]

I'll test it in the next couple of days and get back to you.


Nate
________________________________
From: Jason A. Donenfeld <Jason@zx2c4.com>
Sent: Saturday, February 16, 2019 7:24 PM
To: Nate Williams
Cc: wireguard@lists.zx2c4.com
Subject: Re: Wireguard-go on FreeBSD - Not working until the interface (wg0) is set into promiscuous mode

That's odd. Does this fix it for you?

https://git.zx2c4.com/WireGuard/commit/?id=7c833642dfa342218602ab18e7091e86408d2982

[-- Attachment #1.2: Type: text/html, Size: 1616 bytes --]

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Wireguard-go on FreeBSD - Not working until the interface (wg0) is set into promiscuous mode
  2019-02-17  2:24 ` Jason A. Donenfeld
  2019-02-17  5:56   ` Nate Williams
@ 2019-02-17  5:57   ` Nate Williams
  1 sibling, 0 replies; 4+ messages in thread
From: Nate Williams @ 2019-02-17  5:57 UTC (permalink / raw)
  To: Jason A. Donenfeld, Nate Williams; +Cc: wireguard


[-- Attachment #1.1: Type: text/plain, Size: 485 bytes --]

I'm not using wg-quick, so it's unlikely that this will fix things.


Nate
________________________________
From: Jason A. Donenfeld <Jason@zx2c4.com>
Sent: Saturday, February 16, 2019 7:24 PM
To: Nate Williams
Cc: wireguard@lists.zx2c4.com
Subject: Re: Wireguard-go on FreeBSD - Not working until the interface (wg0) is set into promiscuous mode

That's odd. Does this fix it for you?

https://git.zx2c4.com/WireGuard/commit/?id=7c833642dfa342218602ab18e7091e86408d2982

[-- Attachment #1.2: Type: text/html, Size: 1623 bytes --]

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-18 23:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-06 22:26 Wireguard-go on FreeBSD - Not working until the interface (wg0) is set into promiscuous mode Nate Williams
2019-02-17  2:24 ` Jason A. Donenfeld
2019-02-17  5:56   ` Nate Williams
2019-02-17  5:57   ` Nate Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).