Community discussions

MikroTik App
 
wilburt
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 86
Joined: Tue Aug 24, 2010 3:07 am

Firewall Filter by Time

Tue Oct 26, 2010 6:45 am

Hi,

I am trying to restrict the times which people can access my hotspot. I was looking a dropping DHCP client request packets on certain times of the day.

For example drop dhcp requests after 9pm

I have seen the option available in the firewall section but can't get it to work.

What is the time format suppose to be?

Thanks
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26378
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: Firewall Filter by Time

Tue Oct 26, 2010 8:38 am

Just use Winbox, it's much easier to understand then. It's in 24h format:

Image
 
wilburt
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 86
Joined: Tue Aug 24, 2010 3:07 am

Re: Firewall Filter by Time

Tue Oct 26, 2010 10:18 am

Thanks for the reply.

I have tried to setup a filter rule with hs-input with protocol udp and action = drop but my devices on the hotspot are still getting thier ip addresses via dhcp.

What filter setting would i need to set to prevent clients receiveing an ip address from the dhcp server on the hotspot?

thanks
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Firewall Filter by Time

Tue Oct 26, 2010 3:08 pm

The DHCP server listens on a raw socket. That happens before the firewall, and you cannot filter DHCP in the firewall.

You need to write two scheduled scripts that turn the DHCP server on and off. The wiki has plenty of examples for scheduled scripts.
 
wilburt
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 86
Joined: Tue Aug 24, 2010 3:07 am

Re: Firewall Filter by Time

Wed Oct 27, 2010 3:43 am

Thanks for the pointer.

I have created a script and a schedule, but it doesn't look like the schedule is working? It runs as the counter increments but nothing happens on the script side (the counter doesn't increment)

Here is my schedule and scripts

0 name="hs-dhcp-enable" owner="admin"
policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive
last-started=jan/02/1970 10:34:08 run-count=3
source=ip dhcp-server enable dhcp1

0 ;;; To enable the dhcp server for the hs
name="hs-dhcp-enable-sch" start-date=jan/01/1970 start-time=09:48:00
interval=1d on-event=hs-dhcp-enable owner="admin" run-count=1
next-run=oct/28 09:48:00
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Firewall Filter by Time

Wed Oct 27, 2010 3:55 am

That script is invalid and wouldn't execute on the CLI, either
/ip dhcp-server enable [/ip dhcp-server find name=dhcp1]
and of course the same the with a disable command for the counterpart.
 
wilburt
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 86
Joined: Tue Aug 24, 2010 3:07 am

Re: Firewall Filter by Time

Wed Oct 27, 2010 4:32 am

It turns out i need to check the read policy in my schedule (something i didn't originally do)

Thanks for the replies an assistance.

For future newbies setting up a schedule... make sure you enable the read policy :D

Who is online

Users browsing this forum: No registered users and 69 guests