I use a different subnet for the peers from their networks. So one network that I connect to uses the 192.168.146.0/24 subnet but all the peers use 192.168.220.0/24. This is the .conf file for my end of the wireguard connection. The device at 192.168.220.1 is a wireguard peer address at the other end. My end is 192.168.220.2 but I am allowed access to the 192.168.146.0/24 subnet where all of the remote devices are located. This avoids taking an address out of the 192.168.146.0/24 subnet for remote use which can cause conflicts if there are DHCP addresses being served up somewhere.
[Interface]
Address = 192.168.220.2/32 # my peer address
PostUp = wg set %i private-key /etc/wireguard/private.key
PostUp = ping -c1 192.168.220.1 # ping the server peer
[Peer]
PublicKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
Endpoint = ipaddress:13231
AllowedIPs = 192.168.220.0/24, 192.168.146.0/24 # I have access to both subnets with this
[Interface]
Address = 192.168.220.2/32 # my peer address
PostUp = wg set %i private-key /etc/wireguard/private.key
PostUp = ping -c1 192.168.220.1 # ping the server peer
[Peer]
PublicKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
Endpoint = ipaddress:13231
AllowedIPs = 192.168.220.0/24, 192.168.146.0/24 # I have access to both subnets with this
Statistics: Posted by knute — Sun Dec 29, 2024 9:08 pm