Hello everyone, I’m not sure if I’m in the correct topic, but I have a big problem. I’ve configured my WireGuard server on a FRITZ!Box and everything works fine with OpenWrt and WireGuard clients on mobile devices. However, when I use the WireGuard client on MikroTik, the traffic doesn’t navigate properly. The persistent keep alive is set to 25, but the traffic is only in bytes. From the FRITZ!Box side, it recognizes that the site-to-site is available, but the traffic doesn’t reach the destination server IPs from the client. Besides the configuration, I’m unsure what else needs to be imported.
This config:
[Interface]
PrivateKey = *****
Address = 192.168.1.1/24
DNS = *****
DNS = fritz.box
[Peer]
PublicKey = *****
PresharedKey = *****
AllowedIPs = 10.3.0.0/16
Endpoint = *****:port
PersistentKeepalive = 25
Thank for response
anav
May 6, 2024, 4:06pm
2
We need to see the MT config and also understand how the users on the MT if any are being directed out the tunnel and why?
Requirements!! + Config, then we can assist on the proper config.
ROUTER WIREGUARD SERVER FRIZBOX
[Interface]
PrivateKey = yLLoDlrjI8fLdv8KxoSvP9tbla8KY2Sqglua+bshJUE=
ListenPort = 59162
Address = 10.3.1.1/16
DNS = 10.3.1.1,192.168.1.1
DNS = fritz.box
[Peer]
PublicKey = 1/po8VJryRbMhluUbH8IU725lKsToVohwrma4uFDYio=
PresharedKey = p42Nll35CCCX8ZczDWDY9qXNLEEEimXKKPxdBnEtJKs=
AllowedIPs = 192.168.1.0/24
PersistentKeepalive = 25
MIKROTIK CLIENT
[Interface]
PrivateKey = uOySzvXS53ibzAyv1oGQs87nXlPLWp0XgCPbB0tHA1Y=
Address = 192.168.1.1/24
DNS = 10.3.1.1
DNS = 1.1.1.1
[Peer]
PublicKey = Q9WfsUSiBTNucaZmkJ7j436srzZXTEc3oN7/4VGLyAQ=
PresharedKey = p42Nll35CCCX8ZczDWDY9qXNLEEEimXKKPxdBnEtJKs=
AllowedIPs = 0.0.0.0/0
Endpoint = ******:port
PersistentKeepalive = 25
I don’t have any settings in the MikroTik firewall on my side. Can you help me better because I’m a bit inexperienced, and my friend and I are trying?
thanks for response
anav
May 6, 2024, 5:53pm
4
The problem is not MT centric its more like you dont understand how to setup WG period.
ROUTER WIREGUARD SERVER FRIZBOX
[Interface]
PrivateKey = yLLoDlrjI8fLdv8KxoSvP9tbla8KY2Sqglua+bshJUE=
ListenPort = 59162
Address = 10.3.1.1**/24**
[Peer]
PublicKey = 1/po8VJryRbMhluUbH8IU725lKsToVohwrma4uFDYio=
PresharedKey = p42Nll35CCCX8ZczDWDY9qXNLEEEimXKKPxdBnEtJKs=
AllowedIPs = 10.3.1.2/32,192.168.1.0/24
keep alive not required on server settings for peer.
MIKROTIK CLIENT
[Interface]
PrivateKey = uOySzvXS53ibzAyv1oGQs87nXlPLWp0XgCPbB0tHA1Y=
Address = 10.3.1.2/24
DNS = 10.3.1.1
[Peer]
PublicKey = Q9WfsUSiBTNucaZmkJ7j436srzZXTEc3oN7/4VGLyAQ=
PresharedKey = p42Nll35CCCX8ZczDWDY9qXNLEEEimXKKPxdBnEtJKs=
AllowedIPs = 0.0.0.0/0
Endpoint = u8bi1w0j8k3x2061.myfritz.net:59162
PersistentKeepalive = 25
Hello dear, the problem is not on the server side of the WireGuard server Fritzbox, as it works on OpenWRT. The problem is only on the client side of MikroTik; the connection is established on MikroTik but it does not assign IPs. The problem is not on the server side; the modem configures itself automatically and generates by itself. And the Fritzbox server works.
The problem is only on the MikroTik client side; what can be done about it?
Thanks for response
anav
May 6, 2024, 10:01pm
6
Without seeing the complete config, hard to say
/export file=anynameyouwish (minus router serial number, any public WANIP informaiton, keys )
But can I send you only MikroTik side?
mt.conf client wireguard mikrotik
2024-05-07 18:45:10 by RouterOS 7.14.3
software id = BZ8Y-AS5M
model = RB941-2nD
serial number = 661606130320
/interface bridge
add admin-mac=6C:3B:6B:66:21:E7 auto-mac=no comment=defconf name=bridge
/interface wireless
set [ find default-name=wlan1 ] band=2ghz-b/g/n channel-width=20/40mhz-XX
disabled=no distance=indoors frequency=auto installation=indoor mode=
ap-bridge ssid=MikroTik-6621EA wireless-protocol=802.11
/interface wireguard
add listen-port=51820 mtu=1420 name=wireguard1
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=default-dhcp ranges=192.168.88.10-192.168.88.254
/ip dhcp-server
add address-pool=default-dhcp interface=bridge name=defconf
/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=wlan1
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1 list=WAN
/interface wireguard peers
add allowed-address=0.0.0.0/0 endpoint-address=4561w0j8k3x2061.myfritz.net
endpoint-port=59162 interface=wireguard1 persistent-keepalive=25s
preshared-key="p42NllXXXXXX8ZczDWDY9qXNLEEEimXKKPxdBnEtJKs=" public-key=
"Q9WfsUSiBTNucaZmkJ7j436srzZXTEc3oN7/4VGLyAQ="
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge network=
192.168.88.0
add address=192.168.1.5 interface=wireguard1 network=192.168.1.0
/ip dhcp-client
add comment=defconf interface=ether1
/ip dhcp-server network
add address=192.168.88.0/24 comment=defconf dns-server=192.168.88.1 gateway=
192.168.88.1
/ip dns
set allow-remote-requests=yes servers=10.3.1.1,1.1.1.1
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan
/ip 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 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
/ip firewall nat
add action=masquerade chain=srcnat
/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
set time-zone-name=Europe/Rome
/system note
set show-at-login=no
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
#error exporting "/tool/sms"
anav
May 7, 2024, 5:01pm
10
(1) Pre-shared key is not required, and is not normally used, so for troubleshooting purposes remove for now.
/interface wireguard peers
add allowed-address=0.0.0.0/0 endpoint-address=x2061.myfritz.net
endpoint-port=59162 interface=wireguard1 persistent-keepalive=25s
preshared-key=“=” public-key=
“=”
(2) IF you dont identify the subnet users on the fritz and give them a route on the MT, then you need to sourcenat them out the MT
Also your sourcenat is missing the normal WAN interface.
/ip firewall nat
add action=masquerade chain=srcnat out-interface-list=WAN
add action=masquerade chain=srcnat out-interface=wireguard1
++++++++++++++++
Before can advise further can you confirm the entire subnet needs to be pushed out wireguard tunnel to fritz??
I’ve set up the firewalls as you instructed, but I still can’t reach the Frizbox IP when I ping it. I even removed the shared key, leaving it public, but nothing changes. When I ping 10.3.1.1, it shows a timeout error from the mentioned device, which is the Mikrotik client.
P. S. Is it important to assign an IP to WireGuard, or is it okay without?
anav
May 7, 2024, 7:06pm
12
Yes, this is necessary.
add address=192.168.1.5 interface=wireguard1 network=192.168.1.0
The issue is the question I posed which you didnt answer.
What is going out wireguard to the fritz, one user, all users etc…
Also can you confirm you have remote users hitting the fritz and needing then access to the MT router??
anav
May 7, 2024, 7:59pm
14
Post your latest config with changes included please.
I've done the setup wizard Frizbox for only one device, which is a router. The server sees it on Frizbox, the bytes TX and RX pass through Frizbox, and it shows as online from the photo, but it's on the client side that it doesn't enter connection. I also removed the pre shared key but the situation does not change
this is config:
2024-05-07 23:27:34 by RouterOS 7.14.3
software id = BZ8Y-AS5M
model = RB941-2nD
serial number = 661606130320
/interface bridge
add admin-mac=6C:3B:6B:66:21:E7 auto-mac=no comment=defconf name=bridge
/interface wireless
set [ find default-name=wlan1 ] band=2ghz-b/g/n channel-width=20/40mhz-XX
disabled=no distance=indoors frequency=auto installation=indoor mode=
ap-bridge ssid=MikroTik-6621EA wireless-protocol=802.11
/interface wireguard
add listen-port=51820 mtu=1420 name=wireguard1
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=default-dhcp ranges=192.168.88.10-192.168.88.254
/ip dhcp-server
add address-pool=default-dhcp interface=bridge name=defconf
/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=wlan1
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1 list=WAN
/interface wireguard peers
add allowed-address=0.0.0.0/0 endpoint-address=example.myfritz.net
endpoint-port=59162 interface=wireguard1 persistent-keepalive=25s
preshared-key="p42NllXXXXX8ZczDWDY9qXNLEEEimXKKPxdBnEtJKs=" public-key=
"Q9WfsUSiBTNucaZmkJ7j436srzZXTEc3oN7/4VGLyAQ="
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge network=
192.168.88.0
add address=192.168.1.5 interface=wireguard1 network=192.168.1.0
/ip dhcp-client
add comment=defconf interface=ether1
/ip dhcp-server network
add address=192.168.88.0/24 comment=defconf dns-server=192.168.88.1 gateway=
192.168.88.1
/ip dns
set allow-remote-requests=yes servers=10.3.1.1,1.1.1.1
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan
/ip firewall nat
add action=masquerade chain=srcnat out-interface-list=WAN
add action=masquerade chain=srcnat out-interface=wireguard1
/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
set time-zone-name=Europe/Rome
/system note
set show-at-login=no
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
#error exporting "/tool/sms"
anav
May 7, 2024, 10:11pm
16
The IP address is incorrect
From:
add address=192.168.1.5 interface=wireguard1 network=192.168.1.0
TO:
add address=192.168.1.5**/24** interface=wireguard1 network=192.168.1.0
Remove this static DNS setting
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan
The most important question has no been answered yet.
Do you want the entire subnet on the MT to go out FRITZ for internet?
If not then is it only some LANIPs ???
What should be the acction if the wireguard goes down, no internet for those folks???
The IP address is incorrect
From:
add address=192.168.1.5 interface=wireguard1 network=192.168.1.0
TO:
add address=192.168.1.5**/24** interface=wireguard1 network=192.168.1.0
Remove this static DNS setting
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan
The most important question has no been answered yet.
Do you want the entire subnet on the MT to go out FRITZ for internet?
If not then is it only some LANIPs ???
What should be the acction if the wireguard goes down, no internet for those folks???
I would like the internet on the microtik side to work and that wireguard communicates with the IPs of the frizbox class network.
The IP address is incorrect
From:
add address=192.168.1.5 interface=wireguard1 network=192.168.1.0
TO:
add address=192.168.1.5**/24** interface=wireguard1 network=192.168.1.0
Remove this static DNS setting
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan
The most important question has no been answered yet.
Do you want the entire subnet on the MT to go out FRITZ for internet?
If not then is it only some LANIPs ???
What should be the acction if the wireguard goes down, no internet for those folks???
Thank you solved problem… Thanks Thanks Thanks friends solved
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan
add address=192.168.1.5**/24** interface=wireguard1 network=192.168.1.0
Older answer
I’m interested in passing LAN traffic and not internet traffic, and both should be able to access their own LAN but using their own internet without using the other’s internet
Thanks for responde.
anav
May 8, 2024, 11:19am
20
What are the subnets on the fritz that the users on your local MT devices need to visit??
They need to be accounted for on both allowed IPs and IP routes. Since you have 0.0.0.0/0 set as allowed IPs, which covers both the case of internet and subnets, you dont really need to adjust allowed IPs. Since your routing for internet remains local, users will not go out internet of Fritz but could later if you decided.
So all you need is to add IP routes for the remote subnets
/ip route
add dst-address=Subnet1-Fritz gateway=wireguard1 routing-table=main
add dst-address=Subnet2-Fritz gateway=wireguard1 routing-table=main
etc.
Typically the allowed IPs, for lan traffic only ( no intention of internet at remote site) would be
allowed-addresses=192.168.1.0/24,Subnet1-Fritz,Subnet2-Fritz etc…