WireGuard Peers Can't Communicate – Both on Same Interface (172.16.0.x/24)

Hi everyone,

I’m currently testing a WireGuard setup and encountered a connectivity issue between two peers. Here’s the setup:

  • WireGuard Interface IP: 172.16.0.1/24
  • Peer A IP: `172.16.0.2/32
  • Peer B IP: `172.16.0.4/32
  • Both peers are configured on the same WireGuard interface.

The tunnel comes up fine, and each peer can reach the Router (172.16.0.1), but they cannot ping each other (172.16.0.2 <-> 172.16.0.4).

Questions:

  1. Is it necessary to add explicit firewall rules to allow traffic between peers?
  2. Should the peer IPs use /24 instead of /32 in the config?

I’d really appreciate your insights!

Thanks in advance.

here is my config.

/interface bridge
add admin-mac= auto-mac=no comment=defconf name=bridge
/interface wireguard
add listen-port=47888 mtu=1420 name="WG5"

/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN

/ip pool
add name=dhcp_pool1 ranges=10.10.10.100-10.10.10.200

/ip dhcp-server
add address-pool=dhcp_pool1 interface=bridge lease-time=2h name=dhcp1
/port
set 0 name=serial0
/system logging action
set 0 memory-lines=5000
set 1 disk-lines-per-file=5000
/disk settings
set auto-media-interface=bridge auto-media-sharing=yes auto-smb-sharing=yes
/interface bridge port
add bridge=bridge comment=defconf interface=ether2
add bridge=bridge comment=defconf interface=ether3
add bridge=bridge comment=defconf interface=ether4
add bridge=bridge comment=defconf interface=ether5
add bridge=bridge comment=defconf interface=ether6
add bridge=bridge comment=defconf interface=ether7
add bridge=bridge comment=defconf interface=ether8
add bridge=bridge comment=defconf interface=sfp1
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface detect-internet
set detect-interface-list=WAN internet-interface-list=all lan-interface-list=\
    all wan-interface-list=all
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1 list=WAN

/interface wireguard peers

add allowed-address=172.16.0.2/32 interface="WG5"     public-key=8ZQrIDt9mAysCBWnXmeR0cao4QcMSKPkkHviJ7di5gM=
add allowed-address=172.16.0.4/32 interface="WG5"     public-key=iectDG6ufBzyPhYmzErbkYuCSTPXQ07Sd0MN8dFs/hg=
/ip address
add address=10.10.10.1/24 comment=LAN interface=bridge network=10.10.10.0
add address=172.16.0.1/24  interface="WG5" \
    network=172.16.0.0

/ip dhcp-server network
add address=10.0.0.0/24 comment=defconf dns-server=10.10.10.1 gateway=\
    10.10.10.1
add address=10.10.10.0/24 dns-server=10.10.10.1 gateway=10.10.10.1

/ip dns
set allow-remote-requests=yes servers=1.1.1.1,8.8.8.8
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan type=A

/ip firewall filter
add action=accept chain=input comment="allow WireGuard" dst-port=\
    xx888    protocol=udp
add action=accept chain=input comment=\
    "defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
    invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment=\
    "defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=drop chain=input comment="defconf: drop all not coming from LAN" \
    in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" \
    ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" \
    ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" \
    connection-state=established,related hw-offload=yes
add action=accept chain=forward comment=\
    "defconf: accept established,related, untracked" connection-state=\
    established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" \
    connection-state=invalid
add action=drop chain=forward comment=\
    "defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat \
    connection-state=new in-interface-list=WAN
add chain=forward
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
    ipsec-policy=out,none out-interface-list=WAN
/ip firewall service-port
set sip disabled=yes
/ip route
add disabled=no dst-address=0.0.0.0/0 gateway=192.168.15.1 routing-table=main \
    suppress-hw-offload=no
/ip service
set ftp disabled=yes
set ssh disabled=yes
set telnet disabled=yes
set www disabled=yes
set api disabled=yes
set api-ssl disabled=yes

/ipv6 firewall address-list
add address=::/128 comment="defconf: unspecified address" list=bad_ipv6
add address=::1/128 comment="defconf: lo" list=bad_ipv6
add address=fec0::/10 comment="defconf: site-local" list=bad_ipv6
add address=::ffff:0.0.0.0/96 comment="defconf: ipv4-mapped" list=bad_ipv6
add address=::/96 comment="defconf: ipv4 compat" list=bad_ipv6
add address=100::/64 comment="defconf: discard only " list=bad_ipv6
add address=2001:db8::/32 comment="defconf: documentation" list=bad_ipv6
add address=2001:10::/28 comment="defconf: ORCHID" list=bad_ipv6
add address=3ffe::/16 comment="defconf: 6bone" list=bad_ipv6

/ipv6 firewall filter
add action=accept chain=input comment=\
    "defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
    invalid
add action=accept chain=input comment="defconf: accept ICMPv6" protocol=\
    icmpv6
add action=accept chain=input comment="defconf: accept UDP traceroute" \
    dst-port=33434-33534 protocol=udp
add action=accept chain=input comment=\
    "defconf: accept DHCPv6-Client prefix delegation." dst-port=546 protocol=\
    udp src-address=fe80::/10
add action=accept chain=input comment="defconf: accept IKE" dst-port=500,4500 \
    protocol=udp
add action=accept chain=input comment="defconf: accept ipsec AH" protocol=\
    ipsec-ah
add action=accept chain=input comment="defconf: accept ipsec ESP" protocol=\
    ipsec-esp
add action=accept chain=input comment=\
    "defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=input comment=\
    "defconf: drop everything else not coming from LAN" in-interface-list=\
    !LAN
add action=accept chain=forward comment=\
    "defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" \
    connection-state=invalid
add action=drop chain=forward comment=\
    "defconf: drop packets with bad src ipv6" src-address-list=bad_ipv6
add action=drop chain=forward comment=\
    "defconf: drop packets with bad dst ipv6" dst-address-list=bad_ipv6
add action=drop chain=forward comment="defconf: rfc4890 drop hop-limit=1" \
    hop-limit=equal:1 protocol=icmpv6
add action=accept chain=forward comment="defconf: accept ICMPv6" protocol=\
    icmpv6
add action=accept chain=forward comment="defconf: accept HIP" protocol=139
add action=accept chain=forward comment="defconf: accept IKE" dst-port=\
    500,4500 protocol=udp
add action=accept chain=forward comment="defconf: accept ipsec AH" protocol=\
    ipsec-ah
add action=accept chain=forward comment="defconf: accept ipsec ESP" protocol=\
    ipsec-esp
add action=accept chain=forward comment=\
    "defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=forward comment=\
    "defconf: drop everything else not coming from LAN" in-interface-list=\
    !LAN
/system clock
/system routerboard settings
set enter-setup-on=delete-key
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN

What do the peers have in their AllowedIPs? Do these devices have firewalls? If they run Windows, the default firewall setting won’t allow inbound traffic from non-local subnet.

Here is the configuration of one of the peers. The other one is the same, except it has the IP address 172.16.0.2/32.

[Interface]
PrivateKey = 
Address = 172.16.0.4/32
DNS = 1.1.1.1
MTU = 1420

[Peer]
PublicKey = 
AllowedIPs = 0.0.0.0/0
Endpoint = x.x.x.x:47888
PersistentKeepalive = 15

Try this:

  • On Peer A, make sure:
AllowedIPs = 172.16.0.1/32, 172.16.0.4/32
  • On Peer B, make sure:
AllowedIPs = 172.16.0.1/32, 172.16.0.2/32

This way, each peer knows it should send traffic to the other peer through the WireGuard tunnel.

The AllowedIPs on peers are fine, 0.0.0.0/0 includes all IPs.

I don’t see any configuration issues, so it’s most likely the firewall on both or one of the peers. If you tell us what those peers run (Windows?), maybe we can help you further.

As a test, disable that fasttrack rule and see if it works then.
(reboot or clear connections table)

If it does, you know where to look at.

1 Like