netfilter logo 2Question: How can I restrict/allow access to certain service on timely basis with iptables? For example restrict access to SSH between 7:00 pm – 8:00 am on weekdays?

Answer: You are welcome to use iptables patch-o-matic extension (pom or p-o-m) that allows you to match a packet based on its arrival or departure (for locally generated packets) timestamp. The syntax is the following:

iptables RULE -m time --timestart TIME --timestop TIME --days DAYS -j ACTION


--timestart TIME: Time start value (format is 00:00-23:59)
--timestop TIME: Time stop value (the same format)
--days DAYS: a list of days to apply, from (format: Mon, Tue, Wed, Thu, Fri, Sat, Sun).

To add the rule stated in the question use the following command:

iptables -A INPUT -p tcp -d --dport 22 -m time --timestart 19:00 --timestop 8:00 -days Mon,Tue,Wed,Thu,Fri -j DROP

Hope it helps!




  1. January 28, 2011  1:24 am by mold testing new hampshire Reply

    Hi, current blog subscriber here. Love your blog posts. I found it via a friend's Facebook wall posting.

  2. May 4, 2011  7:21 pm by Warners bras Reply

    I beloved as much as you will obtain performed proper here. The sketch is tasteful, your authored subject matter stylish. nevertheless, you command get bought an nervousness over that you would like be delivering the following. sick indubitably come more until now again since exactly the same just about a lot regularly inside of case you protect this hike.

  3. May 17, 2011  5:15 am by Pasquale Buttray Reply

    Helpful summary, saved your website for hopes to read more information!

  4. May 29, 2013  7:32 am by download idm Reply

    Or you can hype a dismount the superior Fitting Uninstaller to liquidate Internet Download Manager thoroughly.
    In case your personal computer lets the Autoplay
    function, there'll be the Autoplay screen and then select “Open folder to view files". With so many providers, features, tools and functions to choose from its a bit of a task to decide what is correct for you and your business.

Leave a reply


Your email address will not be published.