Trying out the example from wg(4) I ran into this:

# ifconfig wg1 192.168.5.1/24
ifconfig: SIOCAIFADDR: Address already in use

After some head scratching it turns out that it's not complaining about
anything set on the line immediately resulting in the error, but instead
it's really wgport (that was set previously) colliding with portmap on
port 111.

Would it make sense to at least use ports in the example that aren't
used by a common daemon?


Index: wg.4
===================================================================
RCS file: /cvs/src/share/man/man4/wg.4,v
retrieving revision 1.5
diff -u -p -r1.5 wg.4
--- wg.4        29 Sep 2020 19:37:08 -0000      1.5
+++ wg.4        24 Nov 2020 15:02:50 -0000
@@ -138,14 +138,14 @@ but demonstrates two interfaces on the s
 .Bd -literal
 #!/bin/sh
 
-ifconfig wg1 create wgport 111 wgkey `openssl rand -base64 32` rdomain 1
-ifconfig wg2 create wgport 222 wgkey `openssl rand -base64 32` rdomain 2
+ifconfig wg1 create wgport 7111 wgkey `openssl rand -base64 32` rdomain 1
+ifconfig wg2 create wgport 7222 wgkey `openssl rand -base64 32` rdomain 2
 
 PUB1="`ifconfig wg1 | grep 'wgpubkey' | cut -d ' ' -f 2`"
 PUB2="`ifconfig wg2 | grep 'wgpubkey' | cut -d ' ' -f 2`"
 
-ifconfig wg1 wgpeer $PUB2 wgendpoint 127.0.0.1 222 wgaip 192.168.5.2/32
-ifconfig wg2 wgpeer $PUB1 wgendpoint 127.0.0.1 111 wgaip 192.168.5.1/32
+ifconfig wg1 wgpeer $PUB2 wgendpoint 127.0.0.1 7222 wgaip 192.168.5.2/32
+ifconfig wg2 wgpeer $PUB1 wgendpoint 127.0.0.1 7111 wgaip 192.168.5.1/32
 ifconfig wg1 192.168.5.1/24
 ifconfig wg2 192.168.5.2/24
 .Ed

Reply via email to