Community discussions

MikroTik App
 
BrainTrance
just joined
Topic Author
Posts: 21
Joined: Sat Jan 15, 2022 12:09 am

Send Magic packet to Mikrotik router remotely via VPN

Sat Jan 15, 2022 1:14 am

I'm trying to send a WoL packet to Mikrotik router over WAN. Mikrotik router is configured to forward the received packet to a PC and wake it up.
Testing this on LAN works, but not over WAN.
I enabled VPN access on Mikrotik and configured a VPN connection on my cellphone. VPN connection is successfully established using as Server Address the private IP that Mikrotik has from Modem's DHCP. So, locally, everything's fine.
How can I do the same thing over WAN?
Do I have to connect from my cellphone to the VPN address provided by Mikrotik and enter the Mikrotik's VPN credentials so I would virtually be in the same LAN with the router?
Eventually what is the role of the VPN address *********.sn.mynetname.netprovided by Mikrotik?
In the PPP --> Profiles there is a default-encryption entry that has a local IP of 192.168.89.1. In what network does this IP apply?
 
Sob
Forum Guru
Forum Guru
Posts: 9119
Joined: Mon Apr 20, 2009 9:11 pm

Re: Send Magic packet to Mikrotik router remotely via VPN

Tue Jan 18, 2022 3:26 am

The *********.sn.mynetname.net is hostname used by built-in DDNS service. If your router has dynamic public address, this gives you hostname that always points to this address, and you can connect even when it changes. If you don't have public address, it won't help you and you won't be able to directly connect to your router from internet.

As for WoL, I remember that I tried it from internet with port forwarding, but I don't remember how it went. But you can connect to router (that's it you have public address) and use WoL from there:
/tool wol interface=<LAN> mac=xx:xx:xx:xx:xx:xx
Or save it as script and you won't have to remember MAC address.
 
martinclaro
Frequent Visitor
Frequent Visitor
Posts: 95
Joined: Sat Sep 28, 2013 6:08 am
Location: Buenos Aires, Argentina
Contact:

Re: Send Magic packet to Mikrotik router remotely via VPN

Tue Jan 18, 2022 4:09 am

There is a trick to make WoL work trough NAT. You have to add a static arp entry under IP > ARP (/ip arp) for the host you want to wake-up.
/ip firewall nat
add action=dst-nat chain=dstnat comment="DNAT: WOL Host XXXX" dst-port=<wan-port> protocol=udp to-addresses=<lan-host-ipaddr> to-ports=9
/ip arp
add address=<lan-host-ipaddr> interface=<lan-bridge-or-interface> mac-address=<lan-host-macaddr>
 
BrainTrance
just joined
Topic Author
Posts: 21
Joined: Sat Jan 15, 2022 12:09 am

Re: Send Magic packet to Mikrotik router remotely via VPN

Tue Jan 18, 2022 5:27 am

There is a trick to make WoL work through NAT.
Ok I will try that. But I also need to undertand.
The route of the Magic Packet is something like this?:
Magic Packet from WAN --> Modem/router --> Modem/router sends it to all connected devices because it's a broadcast packet --> So it reaches Mikrotik also --> Mikrotik's NAT translate the address and send it to the device which has to wake up?
Do I really need port forward configuration on my modem considering that Magic Packet can't be routed?
If I apply port forward on Mikrotik also, will NAT(not yet configured) still block the packet because it doesn't know the actual destination address?
 
User avatar
nichky
Forum Guru
Forum Guru
Posts: 1275
Joined: Tue Jun 23, 2015 2:35 pm

Re: Send Magic packet to Mikrotik router remotely via VPN

Tue Jan 18, 2022 5:54 am

that / tool wol works well till i unplug/plug the cable.Once i do that it stops working.
 
martinclaro
Frequent Visitor
Frequent Visitor
Posts: 95
Joined: Sat Sep 28, 2013 6:08 am
Location: Buenos Aires, Argentina
Contact:

Re: Send Magic packet to Mikrotik router remotely via VPN

Tue Jan 18, 2022 3:25 pm

Ok I will try that. But I also need to undertand.
The route of the Magic Packet is something like this?:
Magic Packet from WAN --> Modem/router --> Modem/router sends it to all connected devices because it's a broadcast packet --> So it reaches Mikrotik also --> Mikrotik's NAT translate the address and send it to the device which has to wake up?
Do I really need port forward configuration on my modem considering that Magic Packet can't be routed?
If I apply port forward on Mikrotik also, will NAT(not yet configured) still block the packet because it doesn't know the actual destination address?
Maybe a misunderstanding... in your case, the magic packet won't be broadcast (it can be broadcast in your side only). As it won't be broadcast, in order to pass trough your NAT, it should be send to an specific udp port on WAN address, and NAT will send it to a specific IP (and MAC based on what you added into IP ARP static list)

Who is online

Users browsing this forum: jaclaz, jvanhambelgium and 27 guests