Sample Header Ad - 728x90

Wireguard "wg0: Packet has unallowed src IP"

3 votes
1 answer
6224 views
Using the https://github.com/angristan/wireguard-install project I configured a server. Which produced the following server config file at /etc/wireguard/wg0.conf:
[Interface]
Address = 10.66.66.1/24,fd42:42:42::1/64
ListenPort = 51202
PrivateKey = ***************
PostUp = iptables -A FORWARD -i ens3 -o wg0 -j ACCEPT; iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
PostDown = iptables -D FORWARD -i ens3 -o wg0 -j ACCEPT; iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o ens3 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o ens3 -j MASQUERADE

### Client chris
[Peer]
PublicKey = ***************
PresharedKey = ****************
AllowedIPs = 10.66.66.2/32,fd42:42:42::2/128,209.250.230.114/32
And the following client file:
[Interface]
PrivateKey = ******************
Address = 10.66.66.2/32,fd42:42:42::2/128
DNS = 94.140.14.14,94.140.15.15

[Peer]
PublicKey = 8ZF6U0mHKvMtVw2A4jha4mZR+a0GP5W85unV05zJIyw=
PresharedKey = **************************
Endpoint = 192.248.162.216:51202
AllowedIPs = 0.0.0.0/0,::/0
This is the file I have in the client. Running wg-quick up server on the client results in:
root@vultr:~# wg-quick up server
[#] ip link add server type wireguard
[#] wg setconf server /dev/fd/63
[#] ip -4 address add 10.66.66.2/32 dev server
[#] ip -6 address add fd42:42:42::2/128 dev server
[#] ip link set mtu 1420 up dev server
[#] resolvconf -a tun.server -m 0 -x
[#] wg set server fwmark 51820
[#] ip -6 route add ::/0 dev server table 51820
[#] ip -6 rule add not fwmark 51820 table 51820
[#] ip -6 rule add table main suppress_prefixlength 0
[#] ip6tables-restore -n
[#] ip -4 route add 0.0.0.0/0 dev server table 51820
[#] ip -4 rule add not fwmark 51820 table 51820
After which I loose network connectivity with the client (I mean my prior SSH connection). On the server I see the following debug logs:
Feb 14 18:14:21 car kernel: wireguard: wg0: Packet has unallowed src IP (209.250.230.114) from peer 1 (209.250.230.114:56584)
Feb 14 18:14:22 car kernel: wireguard: wg0: Sending keepalive packet to peer 1 (209.250.230.114:56584)
Feb 14 18:14:23 car kernel: wireguard: wg0: Packet has unallowed src IP (209.250.230.114) from peer 1 (209.250.230.114:56584)
Feb 14 18:14:26 car kernel: wireguard: wg0: Packet has unallowed src IP (209.250.230.114) from peer 1 (209.250.230.114:56584)
Feb 14 18:14:33 car kernel: wireguard: wg0: Sending keepalive packet to peer 1 (209.250.230.114:56584)
Surely AllowedIPs = 0.0.0.0/0,::/0 allows any ip? Why am I getting the error about the IP not being allowed? --- I tried adding the client ip (209.250.230.114) to the AllowedIps under [Peer] in the server config at /etc/wireguard/wg0.conf + restarting the wireguard systemd service - slight change in behavior now - seems to keep recreating the keypair + sending the handshake:
Feb 14 18:27:15 car kernel: wireguard: wg0: Sending handshake response to peer 2 (209.250.230.114:46777)
Feb 14 18:27:15 car kernel: wireguard: wg0: Keypair 40 destroyed for peer 2
Feb 14 18:27:15 car kernel: wireguard: wg0: Keypair 41 created for peer 2
Feb 14 18:27:20 car kernel: wireguard: wg0: Receiving handshake initiation from peer 2 (209.250.230.114:46777)
Feb 14 18:27:20 car kernel: wireguard: wg0: Sending handshake response to peer 2 (209.250.230.114:46777)
Feb 14 18:27:20 car kernel: wireguard: wg0: Keypair 41 destroyed for peer 2
Feb 14 18:27:20 car kernel: wireguard: wg0: Keypair 42 created for peer 2
Feb 14 18:27:25 car kernel: wireguard: wg0: Receiving handshake initiation from peer 2 (209.250.230.114:46777)
Feb 14 18:27:25 car kernel: wireguard: wg0: Sending handshake response to peer 2 (209.250.230.114:46777)
Feb 14 18:27:25 car kernel: wireguard: wg0: Keypair 42 destroyed for peer 2
Feb 14 18:27:25 car kernel: wireguard: wg0: Keypair 43 created for peer 2
---- Here is some packet logs output from tshark -i any on the client after running wg-quick up.... Please note the IPs are now different from earlier in my question (tried to set this up from scratch again - hence new ips).
80 30.827763166 87.246.7.226  192.248.154.136 TCP 76 [TCP Retransmission] 57034  25 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 SACK_PERM=1 TSval=342868104 TSecr=0 WS=128
   81 30.827859690 192.248.154.136  87.246.7.226 TCP 56 25  57034 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
   82 33.439281276 192.248.154.136  192.248.152.91 UDP 192 59054  58338 Len=148
   83 36.811164287 192.248.154.136  108.61.73.244 NTP 92 NTP Version 4, client
   84 38.146118476 87.246.7.243  192.248.154.136 TCP 76 6076  25 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 SACK_PERM=1 TSval=211747651 TSecr=0 WS=1024
   85 38.146182173 192.248.154.136  87.246.7.243 TCP 56 25  6076 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
   86 38.559280480 192.248.154.136  192.248.152.91 UDP 192 59054  58338 Len=148
   87 38.852121979 87.246.7.226  192.248.154.136 TCP 76 [TCP Retransmission] 57034  25 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 SACK_PERM=1 TSval=342876128 TSecr=0 WS=128
   88 38.852220458 192.248.154.136  87.246.7.226 TCP 56 25  57034 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
   89 39.146306580 87.246.7.243  192.248.154.136 TCP 76 [TCP Retransmission] 6076  25 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 SACK_PERM=1 TSval=211748652 TSecr=0 WS=1024
   90 39.146388276 192.248.154.136  87.246.7.243 TCP 56 25  6076 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
   91 41.150763667 87.246.7.243  192.248.154.136 TCP 76 [TCP Retransmission] 6076  25 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 SACK_PERM=1 TSval=211750656 TSecr=0 WS=1024
   92 41.150880444 192.248.154.136  87.246.7.243 TCP 56 25  6076 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
   93 41.630158997 212.70.149.54  192.248.154.136 TCP 76 46658  25 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 SACK_PERM=1 TSval=42893859 TSecr=0 WS=1024
   94 41.630236617 192.248.154.136  212.70.149.54 TCP 56 25  46658 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
   95 41.811177910 192.248.154.136  108.61.73.243 NTP 92 NTP Version 4, client
   96 42.630885040 212.70.149.54  192.248.154.136 TCP 76 [TCP Retransmission] 46658  25 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 SACK_PERM=1 TSval=42894860 TSecr=0 WS=1024
   97 42.630953128 192.248.154.136  212.70.149.54 TCP 56 25  46658 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
   98 43.353963530 fe:00:03:35:d7:65               ARP 44 Who has 192.248.154.136? Tell 104.238.168.72
   99 43.354021247 56:00:03:35:d7:65               ARP 44 192.248.154.136 is at 56:00:03:35:d7:65
  100 43.679313102 192.248.154.136  192.248.152.91 UDP 192 59054  58338 Len=148
  101 44.634917692 212.70.149.54  192.248.154.136 TCP 76 [TCP Retransmission] 46658  25 [SYN] Seq=0 Win=29200 Len
Asked by Chris Stryczynski (6603 rep)
Feb 14, 2021, 06:17 PM
Last activity: Aug 2, 2025, 07:09 AM