Re: Limiting bandwidth for one user ? (By IP or MAC)

[email protected]
Newsgroups gmane.comp.security.ipcop.user
Message-ID <[email protected]>
On 25/11/15 13:12, Renaud (Ron) OLGIATI wrote:
> Is there a way with IPCop 2 ?
Depends what you want to do.

I block the kids after x amount of download

Create a chain

/sbin/iptables -N sam_accounting


/sbin/iptables -I FW_OUTGOING 1 -m mac --mac-source 30:10:b3:06:47:e4 -j 
sam_accounting -m comment --comment="Sam's Laptop"
/sbin/iptables -I FW_OUTGOING 1 -m mac --mac-source 74:5c:9f:f1:35:36 -j 
sam_accounting -m comment --comment="Sam's Phone"

Then you can look at the accounting in cron every 5 mins.

#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Check to see people have exceed their data download limit and
# add a drop to iptables also zeroize the accounting
#*/5 * * * * /root/iptables_accounting.sh
#---------------------------------------------------------------------------

quota=5242880

#+
#Remove blocking
#-
time=$(date +%k%M)
if [ $time -ge 1000 ] && [ $time -lt 1004 ]
then
   /sbin/iptables -F sam_accounting
   /sbin/iptables -A sam_accounting -j RETURN -m comment 
--comment="Added at `date`"
   /sbin/iptables -F jasmine_accounting
   /sbin/iptables -A jasmine_accounting -j RETURN -m comment 
--comment="Added at `date`"
fi

#+
#Test Sam
#-
if [ `iptables -nvxL sam_accounting --line|grep DROP|wc -l` -eq 0 ]
then
   if [ `iptables -nvxL sam_accounting|grep RETURN|awk '{print $2}'` -gt 
${quota} ]
   then
     iptables -I sam_accounting 1 -j DROP -m comment --comment="Quota 
exceeded. Added at `date`"
   fi
fi

and you could setup 'tc' if you wanted something better.

-- 
'ooroo

Stinga...(:)-)
---------------------------------------------------
Email: [email protected]  o
You need only two tools.        o /////
A hammer and duct tape. If it    /@   `\  /) ~
doesn't move and it should use  >  (O)  X<  ~  Fish!!
the hammer. If it moves and      `\___/'  \) ~
shouldn't, use the tape.           \\\
---------------------------------------------------


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140
_______________________________________________
IPCop-user mailing list
[email protected]
Manage your subscription or unsubscribe
https://lists.sourceforge.net/lists/listinfo/ipcop-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.