Skip to content

mongrelx/perl-traffic-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

perl-traffic-control

Perl QoS and traffic shaping.

  • RRD logging & graphing
  • Webmin module
  • Curses interface
  • Captive portal
  • Scales up to 2000 user, but easy to shape traffic on small scale too
  • I'm currently using it to ensure my bandwidth in family shared lined as kids consume lot's of bandwidth
  • Either per device or per user bw
  • blacklist
  • timed events

This was in production usage between 2000-2012 and it performed quite nicely

Requirements

  • linux kernel with htc support
  • mysql > 4.0.0
  • http-server
  • iptables
  • perl > 5.0
  • Curses::Application
  • DBI
  • DBH::mysql

Optional

  • radius
  • Authen::Radius
  • iptraf

Installation on debian 8

  • apt-get install git
  • apt-get install libdbi-perl librrdtool-oo-perl
  • apt-get install libdbd-mysql libdbd-mysql-perl libmysqlclient18
  • apt-get install libconvert-ber-perl mysql-server freeradius-mysql libauthen-radius-perl
  • apt-get install libcurses-perl libjson-perl libsnmp-perl libsnmp-session-perl libexporter-autoclean-perl
  • cpan -i Curses::Application
  • cd /opt/
  • git clone https://github.com/mongrelx/perl-traffic-control.git

Installation on debian 9

  • apt-get install git
  • apt-get install libdbi-perl librrdtool-oo-perl
  • apt-get install libdbd-mysql libdbd-mysql-perl
  • apt-get install libconvert-ber-perl mysql-server freeradius-mysql libauthen-radius-perl
  • apt-get install libcurses-perl libjson-perl libsnmp-perl libsnmp-session-perl libexporter-autoclean-perl
  • cpan -i Curses::Application
  • cd /opt/
  • git clone https://github.com/mongrelx/perl-traffic-control.git

Configuration

Database

  • mysqladmin create ptc -p
  • mysqladmin create ptc_auth -p
  • mysql -p
    mysql>GRANT ALL PRIVILEGES ON ptc.* TO 'ptc_user'@'%' IDENTIFIED BY 'ptc_pass'; mysql>GRANT ALL PRIVILEGES ON ptc_auth.* TO 'ptc_user'@'%' IDENTIFIED BY 'ptc_pass';
  • (DEBIAN 8) mysql -p ptc_auth < /etc/freeradius/sql/mysql/schema.sql
  • (DEBIAN 9) mysql -p ptc_auth < /etc/freeradius/3.0/mods-config/sql/main/mysql/schema.sql

Web-server

Interfaces

Radius

    debian 8

  • edit sql.conf to match db_user,db_pass,db_name
  • include sql.conf from freeradius.conf
  • add to /etc/freeradius/users
    DEFAULT Autz-Type :=PTC_USER
    Fall-Through = Yes
  • add to /etc/freeradius/sites-enable/default
    under Authorization section

    Autz-Type PTC_USER { sql }

    debian 9

  • edit /etc/freeradius/3.0/mods-available/sql to match db_user,db_pass,db_name
  • enable mod sql
  • add to /etc/freeradius/3.0/users
    DEFAULT Autz-Type :=PTC_USER
    Fall-Through = Yes
  • add to /etc/freeradius/sites-enabled/default
    under Authorization section

    Autz-Type PTC_USER { sql } edit dictionary to have clientid string attribute

edit /opt/perl-traffic-control/etc/AAA/home.AAA.conf to match your network

/opt/perl-traffic-control/bin/iptable-basic > /etc/iptables.up.rules iptables-restore < /etc/iptables.up.rules

Usage

if nat is used on output , you'll need to enable ifb device to control traffic from in to out

About

Perl QoS and traffic shaping

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages