Community discussions

MikroTik App
 
b1gst0ne
just joined
Topic Author
Posts: 1
Joined: Mon Jan 29, 2018 11:31 am

Enabling the interface when connecting a specific MAC address

Mon Jan 29, 2018 12:14 pm

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?
 
User avatar
horhay
newbie
Posts: 29
Joined: Sat Jun 20, 2015 7:19 pm
Location: Ontario, Canada
Contact:

Re: Enabling the interface when connecting a specific MAC address

Thu Feb 08, 2018 1:36 am

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.
 
User avatar
cdiedrich
Forum Veteran
Forum Veteran
Posts: 997
Joined: Thu Feb 13, 2014 2:03 pm
Location: Basel, Switzerland // Bremen, Germany
Contact:

Re: Enabling the interface when connecting a specific MAC address

Thu Feb 08, 2018 10:34 am

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

Who is online

Users browsing this forum: No registered users and 13 guests