peruserbw 1.0.2 Services: Per User Bandwidth pkg_edit.php?xml=per-user-bandwidth-distribution.xml&id=0 PerUserBW Enforce a fair use bandwidth policy
Services
pkg_edit.php?xml=per-user-bandwidth-distribution.xml&id=0
PerUserBW per_user_bandwidth_distribution.sh Incoming Bandwidth incoming_bandwidth Enter the bandwidth you would like to distribute fairly among the clients: input Incoming Bandwidth Type incoming_bandwidthtype select Outgoing Bandwidth outgoing_bandwidth Enter the bandwidth you would like to distribute fairly among the clients: input Outgoing Bandwidth Type outgoing_bandwidthtype select conf_mount_rw(); $wanif = get_real_wan_interface(); $fd = fopen("/usr/local/etc/rc.d/per_user_bandwidth_distribution.sh","w"); fwrite($fd, "# This file was automatically generated by the pfSense\n"); fwrite($fd, "# package manager system\n\n"); fwrite($fd, "/sbin/kldload ipfw\n"); fwrite($fd, "/sbin/kldload dummynet\n"); fwrite($fd, "/sbin/ipfw delete 10\n"); fwrite($fd, "/sbin/ipfw pipe 101 config mask src-ip 0x000000ff bw {$_POST['incoming_bandwidth']}{$_POST['incoming_bandwidthtype']}\n"); fwrite($fd, "/sbin/ipfw pipe 102 config mask dst-ip 0x000000ff bw {$_POST['outgoing_bandwidth']}{$_POST['outgoing_bandwidthtype']}\n"); fwrite($fd, "/sbin/ipfw add 10 pipe 102 ip from any to any out via {$wanif}\n"); fwrite($fd, "/sbin/ipfw add 10 pipe 101 ip from any to any in via {$wanif}\n"); fwrite($fd, "/sbin/ipfw add 10 allow all from any to any\n"); fclose($fd); mwexec("chmod a+rx /usr/local/etc/rc.d/per_user_bandwidth_distribution.sh"); mwexec_bg("/usr/local/etc/rc.d/per_user_bandwidth_distribution.sh"); $config['system']['dummynetshaper'] = true; write_config(); conf_mount_ro(); mwexec("/sbin/ipfw delete 10"); mwexec("/sbin/kldunload dummynet"); mwexec("/sbin/kldunload ipfw"); conf_mount_rw(); unlink_if_exists("/usr/local/etc/rc.d/per_user_bandwidth_distribution.sh"); unset($config['system']['dummynetshaper']); write_config(); conf_mount_ro();