Enabling the interface when connecting a specific MAC address

Hello,
I apologize for bad English.
When I leave the house carrying my phone, which is connected via WIFI, it is necessary that the Internet on the router is turned off, and when I return and my phone is reconnected to the WIFI network, the Internet appears again on the router. How to implement this?

Schedule a script to run every 5 minutes that pings your phone and disables the Internet if it can’t ping it.

:if ([/ping 8.8.8.8 count=1] = 0) do={
   /interface ethernet set [find name=ether1] disabled=yes
} else={
   /interface ethernet set [find name=ether1] disabled=no
}

Substitute the static IP of your phone where I have 8.8.8.8 and also replace ether1 with the interface of your Internet (WAN).


EDIT: Actually I just realized many phones do not respond to pings. But i’ll leave this here as it may work for someone else in a similar situation.

I wouldn’ do it with pinging an IP address (which you could even use netwatch for).
Let’s check registration-table:

/int wir reg pr co wh mac-address:00:05:0e:00:00:01

Returns 1 when device is registered, returns 0 when not.

Keep in mind that a phone might occasionally disconnect from the w/l to save energy./cap
-Chris