How to setup access timer in iptables?

Discussion in 'Tomato Firmware' started by Sean Rhodes, Jan 27, 2013.

  1. Sean Rhodes

    Sean Rhodes Networkin' Nut Member

    Hi Guys,
    hopefully I'm in the right thread here, but does anyone have a good iptable bash script that monitors a particular NIC and just allows internet access for 4 hours?

    allow access to nic 1, 2, 3 etc
    start 4 hour counter
    at time 4 hours disable nic 1,2,3 etc
    wait 12 hours
    allow access to nic 1,2,3 etc

    I can create start and stop times OK in the access restrictions, or block a nic/ip completely but by bash skills are not too good and there is nothing in the user access restriction gui that gives that level of flexibility.

    iptables -A INPUT -m mac --mac-source xx:xx:xx:xx:xx:xx -j DROP
    iptables -A INPUT -m mac --mac-source yy:yy:yy:yy:yy:yy -j DROP
    iptables -A INPUT -m mac --mac-source zz:zz:zz:zz:zz:zz -j DROP
    would block the 3 nics and changing to accept would allow them, but I'm not sure how to setup the timer

    btw, I'm running Tomato Firmware v1.28.0501 MIPSR2Toastman-RT-N K26 USB VPN-NOCAT on an e4200 cisco router.

    Thanks in advance
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice