$ sudo cat /usr/local/etc/wireguard/wg0.conf[Interface]PrivateKey = LOCALPRIVKEYAddress = 172.160.x.2/24ListenPort = xx822[Peer]PublicKey = PEERSPUBKEYEndpoint = 185.x.x.x:21822AllowedIPs = 10.160.x.x/24,172.160.x.x/24PersistentKeepalive = 60
Jul 24 16:56:33 router kernel: tun0: link state changed to UPJul 24 16:56:33 router kernel: tun0: changing name to 'wg0'Jul 24 16:56:33 router kernel: wg0: link state changed to DOWNJul 24 16:56:33 router opnsense[58788]: /usr/local/etc/rc.routing_configure: ROUTING: entering configure using defaultsJul 24 16:56:33 router opnsense[58788]: /usr/local/etc/rc.routing_configure: ROUTING: IPv4 default gateway set to opt2Jul 24 16:56:33 router opnsense[58788]: /usr/local/etc/rc.routing_configure: ROUTING: setting IPv4 default route to 185.x.x.xJul 24 16:56:33 router opnsense[58788]: /usr/local/etc/rc.routing_configure: ROUTING: keeping current default gateway '185.x.x.xJul 24 16:56:34 router opnsense[58788]: plugins_configure monitor (1)Jul 24 16:56:34 router opnsense[58788]: plugins_configure monitor (execute task : dpinger_configure_do(1))Jul 24 16:56:34 router opnsense[58788]: /usr/local/etc/rc.routing_configure: The WAN_PROVIDER_PPPOE monitor address is empty, skipping.Jul 24 16:56:34 router opnsense[58788]: /usr/local/etc/rc.routing_configure: The WAN_PROVIDER_DHCP_DHCP monitor address is empty, skipping.Jul 24 16:56:35 router kernel: pflog0: promiscuous mode disabledJul 24 16:56:35 router kernel: pflog0: promiscuous mode enabled
Jul 24 16:56:33 router kernel: tun0: link state changed to UPJul 24 16:56:33 router kernel: tun0: changing name to 'wg0'Jul 24 16:56:33 router kernel: wg0: link state changed to DOWN
[Interface]PrivateKey = PRIVKEYAddress = 172.10.xx.x/24ListenPort = xx822[Peer]PublicKey = PEERPUBKEYEndpoint = 172.10.xx.x:xx822AllowedIPs = 172.10.xx.0/24,10.10.xx.x/24PersistentKeepalive = 60
$ sudo ls -l /usr/local/etc/wireguard/total 8-rw------- 1 root wheel 305 Jul 25 18:51 wg0.conf
--help: flags=8002<BROADCAST,MULTICAST> metric 0 mtu 1420 options=80000<LINKSTATE> groups: tun nd6 options=103<PERFORMNUD,ACCEPT_RTADV,NO_DAD> Opened by PID 44943
interface: wg1 public key: PUBKEY private key: (hidden) listening port: xx822peer: PEERPUBKEY endpoint: 185.35.xx.xx:xx822 allowed ips: 10.10.xx.xx/24, 10.x.x.0/24, 10.x.x.0/24 transfer: 0 B received, 31.80 KiB sent persistent keepalive: every 1 minute
wg1 PEERPUBKEY 0
# sudo ifconfig -g tunovpns1--help
$ sudo wg show$ sudo wg-quick up /usr/local/etc/wireguard/wg0.conf[#] ifconfig wg create name wg0[!] Missing WireGuard kernel support (ifconfig: SIOCIFCREATE2: Invalid argument). Falling back to slow userspace implementation.[#] wireguard-go wg0┌──────────────────────────────────────────────────────┐│ ││ Running wireguard-go is not required because this ││ kernel has first class support for WireGuard. For ││ information on installing the kernel module, ││ please visit: ││ https://www.wireguard.com/install/ ││ │└──────────────────────────────────────────────────────┘[#] wg setconf wg0 /dev/stdin[#] ifconfig wg0 inet 172.xx.xx.1/24 alias[#] ifconfig wg0 mtu 1340[#] ifconfig wg0 up[#] route -q -n add -inet 10.xx.xxx.0/24 -interface wg0[#] rm -f /var/run/wireguard/wg0.sock$ sudo ifconfig -g tunovpns1$ sudo ifconfig wg create name wg0ifconfig: SIOCIFCREATE2: Invalid argument
$ sudo /usr/local/etc/rc.d/wireguard restartwg-quick: `wg0' is not a WireGuard interface[#] ifconfig wg create name wg0[!] Missing WireGuard kernel support (ifconfig: SIOCIFCREATE2: Invalid argument). Falling back to slow userspace implementation.[#] wireguard-go wg0┌──────────────────────────────────────────────────────┐│ ││ Running wireguard-go is not required because this ││ kernel has first class support for WireGuard. For ││ information on installing the kernel module, ││ please visit: ││ https://www.wireguard.com/install/ ││ │└──────────────────────────────────────────────────────┘[#] wg setconf wg0 /dev/stdin[#] ifconfig wg0 inet 172.xx.xx.1/24 alias[#] ifconfig wg0 mtu 1340[#] ifconfig wg0 up[#] route -q -n add -inet 10.xx.xxx.0/24 -interface wg0[#] rm -f /var/run/wireguard/wg0.sock
$ sudo /usr/local/etc/rc.d/wireguard stopwg-quick: `wg0' is not a WireGuard interface
$ sudo /usr/local/etc/rc.d/wireguard start[#] ifconfig wg create name wg0[!] Missing WireGuard kernel support (ifconfig: SIOCIFCREATE2: Invalid argument). Falling back to slow userspace implementation.[#] wireguard-go wg0┌──────────────────────────────────────────────────────┐│ ││ Running wireguard-go is not required because this ││ kernel has first class support for WireGuard. For ││ information on installing the kernel module, ││ please visit: ││ https://www.wireguard.com/install/ ││ │└──────────────────────────────────────────────────────┘[#] wg setconf wg0 /dev/stdin[#] ifconfig wg0 inet 172.10.xx.x/24 alias[#] ifconfig wg0 mtu 1340[#] ifconfig wg0 up[#] route -q -n add -inet 10.xx.xx.x/24 -interface wg0[#] rm -f /var/run/wireguard/wg0.sock
$ sudo wg show
$ cat /etc/rc.conf.d/wireguardwireguard_var_script="/usr/local/opnsense/scripts/OPNsense/Wireguard/setup.sh"wireguard_enable="YES"wireguard_interfaces="wg0"start_postcmd=opnsense_postcmdopnsense_postcmd(){ for interface in ${wireguard_interfaces}; do ifconfig ${interface} group wireguard done}
$ sudo cat /usr/local/etc/wireguard/wg0.conf[Interface]PrivateKey = REMOTEPUBKEYAddress = 172.xx.xx.x/32ListenPort = 21823
$ sudo wginterface: wg0 public key: REMOTEPUBKEY private key: (hidden) listening port: 21823
$ sudo cat /usr/local/etc/wireguard/wg0.conf[Interface]PrivateKey = REMOTEPUBKEYAddress = 172.xx.xx.x/32ListenPort = 21823[Peer]PublicKey = LOCALPUBKEYEndpoint = my.ddns.me:21823AllowedIPs = 172.xx.xx.x/24,10.xx.xxx.0/24PersistentKeepalive = 60
$ sudo wg
$ sudo cat /usr/local/etc/wireguard/wg0.conf[Interface]PrivateKey = REMOTEPUBKEYAddress = 172.xx.xx.x/32ListenPort = 21823[Peer]PublicKey = LOCALPUBKEYEndpoint = my.ddns.me:21823AllowedIPs = 172.xx.xx.0/24PersistentKeepalive = 60
$ sudo wginterface: wg0 public key: REMOTEPUBKEY private key: (hidden) listening port: 21823peer: LOCALPUBKEY endpoint: 185.144.YY.YY:21823 allowed ips: 172.xx.xx.0/24 transfer: 0 B received, 6.94 KiB sent persistent keepalive: every 1 minute
$ sudo cat /usr/local/etc/wireguard/wg0.conf[Interface]PrivateKey = REMOTEPUBKEY2Address = 172.xx.27.x/32ListenPort = 21822[Peer]PublicKey = LOCALPUBKEYEndpoint = my.ddns.me:21822AllowedIPs = 172.x.x27.x/24PersistentKeepalive = 60
$ sudo wginterface: wg0 public key: REMOTEPUBKEY2 private key: (hidden) listening port: 21822peer: LOCALPUBKEY endpoint: 185.xxx.xx.xx:21822 allowed ips: 172.xx.27.0/24 transfer: 0 B received, 5.06 KiB sent persistent keepalive: every 1 minute