Community discussions

MikroTik App
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Does anyone know why my Wireguard is not working?

Sun Jun 04, 2023 7:33 pm

So I changed my MT Password a few weeks ago. However due to winbox remembering my password for me, everytime I want to access my MT router I just open winbox and click log in. I forgot the password and then tried to copy it from the winbox window, which removed it and now I completely lost access to the MT.

So I had to factory reset my MT to get back in to it. The latest backup I had was from October 2022. Among some of the config I lost (Main two things was I set up VLANs and Wireguard VPNs) was my wireguard configuration. We had about 15 people working on VPNs to the wireguard server on the Mikrotik.

For some reason I can't get it to work. Previously my problem was that I had ports 2000-65000 UDP translated to my FreePBX phone server. So I set the Wireguard port to 369. Now however, even when I set it to 369, I can't get anything to work over wireguard. I have wireguard on my PC but if I try to ping it (192.168.32.1) it doesn't receive anything back.

If anyone can see any obvious problems with my configuration let me know... thank you

Note to everyone here to write down your MT password somewhere...

Oh another thing that messed up is that I am pretty sure I was using PPPoE and its not working now despite me putting in the correct ISP settings. And the Public IP my ISP had given me (which was static for the past year) has now changed (although I am using dynamic acquisition for WAN now, I might have been using PPPoE before the reset which might affect the IP my ISP gives me?). I am going to contact the ISP once they are open.

I have attached a picture of the Wireguard configuration on my PC too incase you were wondering
# jun/04/2023 17:20:26 by RouterOS 7.4
# software id = JCY8-AFLA
#
# model = RB2011iL
# serial number = E7DD0F73B4C5
/interface bridge
add admin-mac=DC:2C:6E:4C:59:6F auto-mac=no comment=defconf name=bridge
/interface ethernet
set [ find default-name=ether7 ] name=ether7-access
/interface pppoe-client
add add-default-route=yes interface=ether1 name=pppoe-out2 use-peer-dns=yes \
    user=eir@eir.ie
/interface wireguard
add disabled=yes listen-port=369 mtu=1420 name=Mikrotik-Wireguard
add listen-port=369 mtu=1420 name=wireguard_attempt2
/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=dhcp ranges=192.168.88.10-192.168.88.254
/ip dhcp-server
add address-pool=dhcp interface=bridge name=defconf
/port
set 0 name=serial0
/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-access
add bridge=bridge comment=defconf interface=ether8
add bridge=bridge comment=defconf interface=ether9
add bridge=bridge comment=defconf interface=ether10
/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
add interface=pppoe-out2 list=WAN
/interface wireguard peers
add allowed-address=192.168.32.13/32 comment=LM_WORK interface=\
    Mikrotik-Wireguard public-key=\
    "1v2dly75+mHinTIfBCHuPI4BES4fj7Y2j67SLtYBwEQ="
add allowed-address=192.168.32.14/32 comment=PL_DEGAUSSING interface=\
    Mikrotik-Wireguard public-key=\
    "Ef1ggbDHRWhgBiBfP2NVctEmU9eiJ9VNWd3LV3/aUm4="
add allowed-address=192.168.32.20/32 comment="Adrian" interface=\
    Mikrotik-Wireguard public-key=\
    "3g/WlyXOOJWfZIUOsYTLZ+UG7W7vaMIv33qFxcW/Djg="
add allowed-address=192.168.88.101/32 comment=lorcan_attempt2 interface=\
    wireguard_attempt2 public-key=\
    "KHS82YlXuIa4vNHau/0M5pwwZ3kQMyOuHt1jyI56X3g="
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge network=\
    192.168.88.0
add address=192.168.32.1/24 interface=wireguard_attempt2 network=192.168.32.0
/ip dhcp-client
add interface=ether1
/ip dhcp-server lease
add address=192.168.88.216 client-id=1:0:1f:c1:1c:c4:20 mac-address=\
    00:1F:C1:1C:C4:20 server=defconf
add address=192.168.88.215 client-id=1:0:1f:c1:1c:c4:1b mac-address=\
    00:1F:C1:1C:C4:1B server=defconf
add address=192.168.88.200 client-id=1:0:1f:c1:1c:c4:8c mac-address=\
    00:1F:C1:1C:C4:8C server=defconf
add address=192.168.88.165 client-id=1:0:1f:c1:1c:c4:8e mac-address=\
    00:1F:C1:1C:C4:8E server=defconf
add address=192.168.88.202 client-id=1:0:1f:c1:1c:c4:1e mac-address=\
    00:1F:C1:1C:C4:1E server=defconf
add address=192.168.88.204 client-id=1:0:1f:c1:1c:c4:92 mac-address=\
    00:1F:C1:1C:C4:92 server=defconf
add address=192.168.88.214 client-id=1:0:1f:c1:1c:c4:1c mac-address=\
    00:1F:C1:1C:C4:1C server=defconf
add address=192.168.88.212 client-id=1:0:1f:c1:1c:c4:91 mac-address=\
    00:1F:C1:1C:C4:91 server=defconf
add address=192.168.88.203 client-id=1:0:1f:c1:1c:c4:89 mac-address=\
    00:1F:C1:1C:C4:89 server=defconf
add address=192.168.88.206 client-id=1:0:1f:c1:1c:c4:8d mac-address=\
    00:1F:C1:1C:C4:8D server=defconf
add address=192.168.88.205 client-id=1:0:1f:c1:1c:c4:8f mac-address=\
    00:1F:C1:1C:C4:8F server=defconf
add address=192.168.88.207 client-id=1:0:1f:c1:1c:c4:90 mac-address=\
    00:1F:C1:1C:C4:90 server=defconf
add address=192.168.88.198 client-id=1:0:1f:c1:1c:c4:23 mac-address=\
    00:1F:C1:1C:C4:23 server=defconf
add address=192.168.88.218 client-id=1:0:1f:c1:1c:c9:80 mac-address=\
    00:1F:C1:1C:C9:80 server=defconf
add address=192.168.88.213 client-id=1:0:1f:c1:1c:c4:8b mac-address=\
    00:1F:C1:1C:C4:8B server=defconf
add address=192.168.88.154 client-id=1:0:1f:c1:1c:c4:8a mac-address=\
    00:1F:C1:1C:C4:8A server=defconf
add address=192.168.88.199 client-id=1:0:1f:c1:1c:c4:1f mac-address=\
    00:1F:C1:1C:C4:1F server=defconf
add address=192.168.88.163 client-id=1:34:f6:2d:89:e4:82 mac-address=\
    34:F6:2D:89:E4:82 server=defconf
add address=192.168.88.211 client-id=1:0:1f:c1:1c:c9:7b mac-address=\
    00:1F:C1:1C:C9:7B server=defconf
add address=192.168.88.38 client-id=1:0:11:32:b8:2c:31 mac-address=\
    00:11:32:B8:2C:31 server=defconf
add address=192.168.88.196 client-id=1:90:9:d0:0:9:11 mac-address=\
    90:09:D0:00:09:11 server=defconf
add address=192.168.88.27 mac-address=6C:2B:59:E6:FB:01 server=defconf
add address=192.168.88.194 client-id=1:0:11:32:ae:a2:7f mac-address=\
    00:11:32:AE:A2:7F server=defconf
add address=192.168.88.30 client-id=1:0:12:41:b4:7c:7 mac-address=\
    00:12:41:B4:7C:07 server=defconf
/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
/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=accept chain=input dst-port=13231 in-interface-list=WAN protocol=\
    udp
add action=accept chain=input comment="allow LAN traffic" in-interface-list=\
    LAN
add action=drop chain=input comment="drop all else"
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=accept chain=forward in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward dst-address=192.168.88.194 in-interface=\
    Mikrotik-Wireguard
add action=accept chain=forward comment="allow port forwarding" \
    connection-nat-state=dstnat
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
    ipsec-policy=out,none out-interface-list=WAN
add action=masquerade chain=srcnat dst-address=192.168.88.0/24 src-address=\
    192.168.88.0/24
add action=dst-nat chain=dstnat comment="FreePBX Media UDP" dst-address=\
    MY.PUBLIC.IP.ADDRESS dst-port=2000-65001 protocol=udp to-addresses=192.168.88.27 \
    to-ports=2000-65001
add action=dst-nat chain=dstnat comment="FreePBX LetsEncrypt" dst-address=\
    MY.PUBLIC.IP.ADDRESS dst-port=80 protocol=tcp to-addresses=192.168.88.194 \
    to-ports=80
add action=dst-nat chain=dstnat comment="FreePBX Tunnel TCP" dst-address=\
    MY.PUBLIC.IP.ADDRESS dst-port=5090 protocol=tcp to-addresses=192.168.88.27 \
    to-ports=5090
add action=dst-nat chain=dstnat comment="FreePBX SIP TCP" dst-address=\
    MY.PUBLIC.IP.ADDRESS dst-port=5060 protocol=tcp to-addresses=192.168.88.27 \
    to-ports=5060
add action=dst-nat chain=dstnat comment="FreePBX SIP TLS" dst-address=\
    MY.PUBLIC.IP.ADDRESS dst-port=5061 protocol=tcp to-addresses=192.168.88.27 \
    to-ports=5061
add action=dst-nat chain=dstnat comment="NAS access" dst-address=MY.PUBLIC.IP.ADDRESS \
    dst-port=5500-5501 protocol=tcp to-addresses=192.168.88.194 to-ports=\
    5500-5501
add action=dst-nat chain=dstnat comment=PRIVATE INFO dst-address=MY.PUBLIC.IP.ADDRESS \
    dst-port=8008 protocol=tcp to-addresses=192.168.88.30 to-ports=8008
/ip firewall service-port
set sip 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" 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/Dublin
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
You do not have the required permissions to view the files attached to this post.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 18958
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Does anyone know why my Wireguard is not working?

Sun Jun 04, 2023 8:47 pm

There is no point to fixing wireguard if you have no internet?? How would you test??

(1) Attempt 2 wireguard not working because although you changed the IP address to the IP address formerly used by wireguard-Mikrotik currently disabled,
you forget to change the peer IP..... You have by mistake a bridge address there...............

add allowed-address=192.168.88.101/32 comment=lorcan_attempt2 interface=\
wireguard_attempt2 public-key=\
"KHS82YlXuIa4vNHau/0M5pwwZ3kQMyOuHt1jyI56X3g="


Should be 192.168.32.101/32

(2) Your client is missing the persistent-keep-alive set to lets say 35s
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Re: Does anyone know why my Wireguard is not working?

Mon Jun 05, 2023 1:04 am

I have Internet but it's via "Dynamic acquisition " not PPPoE. Honestly I can't remember for sure what I had prior to factory resetting. I think it MIGHT have been PPPoE and I had a static public ip from my ISP via PPPoE. Can't remember if I had dynamic or pppoe previously tho. I will contact ISP.

I will give your changes a try once I'm home.
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Re: Does anyone know why my Wireguard is not working?

Mon Jun 05, 2023 1:50 am

There is no point to fixing wireguard if you have no internet?? How would you test??

(1) Attempt 2 wireguard not working because although you changed the IP address to the IP address formerly used by wireguard-Mikrotik currently disabled,
you forget to change the peer IP..... You have by mistake a bridge address there...............

add allowed-address=192.168.88.101/32 comment=lorcan_attempt2 interface=\
wireguard_attempt2 public-key=\
"KHS82YlXuIa4vNHau/0M5pwwZ3kQMyOuHt1jyI56X3g="


Should be 192.168.32.101/32

(2) Your client is missing the persistent-keep-alive set to lets say 35s
Hi Anav,

I changed 192.168.88.101/32 to 192.168.32.101/32.

Its still not working for some reason.

I have attached a pic of the WAN settings, its 'Automatic' as opposed to 'dynamic' that I said earlier

Note: My internet is working, I am accessing the workplace via chrome remote desktop thats how I am doing the configuration. So the internet is definitely working. Just I think it might need to be PPPoE for me to get the static IP from ISP
You do not have the required permissions to view the files attached to this post.
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Re: Does anyone know why my Wireguard is not working?

Mon Jun 05, 2023 1:54 am

There is no point to fixing wireguard if you have no internet?? How would you test??

(1) Attempt 2 wireguard not working because although you changed the IP address to the IP address formerly used by wireguard-Mikrotik currently disabled,
you forget to change the peer IP..... You have by mistake a bridge address there...............

add allowed-address=192.168.88.101/32 comment=lorcan_attempt2 interface=\
wireguard_attempt2 public-key=\
"KHS82YlXuIa4vNHau/0M5pwwZ3kQMyOuHt1jyI56X3g="


Should be 192.168.32.101/32

(2) Your client is missing the persistent-keep-alive set to lets say 35s
Here are the wireguard settings when I have it active. I am typing 'ping 192.168.32.1' into command prompt, which is why you can see some data is being sent.

Is it normal that 'wireguard_attempt2' is in red in IP->Adresses?
You do not have the required permissions to view the files attached to this post.
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Re: Does anyone know why my Wireguard is not working?  [SOLVED]

Mon Jun 05, 2023 2:13 am

Found the problem

Needed to change add action=accept chain=input dst-port=13231 in-interface-list=WAN protocol=\
udp

to 'dst-port=369'

Thanks for the help. Hopefully I can fix the PPPoE stuff with the ISP..
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 18958
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Does anyone know why my Wireguard is not working?

Mon Jun 05, 2023 2:39 am

Good catch.......

Who is online

Users browsing this forum: tangent and 32 guests