====== Биллинговая система FreeNIBS ====== ===== Установка необходимых компонентов ===== [server:~] # pkg_add /usr/ports/packages/All/mysql-server.tbz [server:~] # /usr/local/etc/rc.d/mysql-server forcestart [server:~] # pkg_add /usr/ports/packages/All/gmake-3.81_1.tbz ===== Компиляция и инсталляция FreeNIBS ===== [server:~] # cd /usr/local/src/ [server:/usr/local/src] # tar -xf freeradius-1.0.1.tar.gz [server:/usr/local/src] # tar -xf freenibs-0.0.3-bf3_freeradius-1.0.1.tar.bz2 [server:/usr/local/src] # cp -R freenibs-0.0.3-bf3_freeradius-1.0.1/* freeradius-1.0.1/ [server:/usr/local/src] # cd freeradius-1.0.1 [server:local/src/freeradius-1.0.1] # grep nibs * [server:local/src/freeradius-1.0.1] # rcsdiff src/modules/stable 16d15 < rlm_krb5 29d27 < rlm_x99_token [server:local/src/freeradius-1.0.1] # rcsdiff src/include/radiusd.h 280c280 < extern int auth_port; --- > //extern int auth_port; [server:local/src/freeradius-1.0.1] # ./configure --prefix=/usr/local/freenibs [server:local/src/freeradius-1.0.1] # make && make install ===== Создание базы данных FreeNIBS и добавление первого пакета и пользователя ===== [server:local/src/freeradius-1.0.1] # rcsdiff src/modules/rlm_nibs/drivers/rlm_nibs_mysql/nibs_mysql.sql < \u freenibs; --- > \u freenibs [server:local/src/freeradius-1.0.1] # mysql < src/modules/rlm_nibs/drivers/rlm_nibs_mysql/nibs_mysql.sql [server:local/src/freeradius-1.0.1] # mysql freenibs mysql> insert into packets (num,packet) values (1,'pppoe_users'); Query OK, 1 row affected (0.00 sec) mysql> insert into users (user, password, crypt_method, gid) values ('user1','pfreenibs1',0,1); Query OK, 1 row affected (0.00 sec) mysql> quit ===== Настройка FreeNIBS ===== [server:freenibs/etc/raddb] # diff nibs.conf nibs.conf,orig 69c69 < n_p = "%{NAS-Port:-0}" --- > [server:freenibs/etc/raddb] # sed -i.old -e 's/%{NAS-Port}/\${n_p}/g' nibs.conf ===== Запуск FreeNIBS ===== [server:~] # /usr/local/freenibs/sbin/radiusd -xxyz [server:~] # /usr/local/freenibs/bin/radtest user1 pfreenibs1 127.0.0.1 0 testing123 ===== Установка web интерфейса FreeNIBS ===== [server:~] # pkg_add /usr/ports/packages/All/php5-mysql.tbz [server:/usr/local/src] # tar -xjf freenibs-0.0.3-bf3_freeradius-0.9.3.tar.bz2 [server:/usr/local/src] # mkdir /var/www [server:/usr/local/src] # cp -R freenibs-0.0.3-bf3_freeradius-0.9.3/src/modules/rlm_nibs/utils/web/* /var/www/ [server:~] # cat /var/www/admin/include/defines.php ... define("USE_CARDS","0"); ... [server:~] # cat /var/www/stat/include/defines.php ... define("USE_CARDS","0"); ... [server:~] # rcsdiff /var/www/admin/menu/edit_user_menu.php 7c7 < echo --- > echo ""; [server:~] # cp /usr/local/src/freenibs-0.0.3-bf3_freeradius-0.9.3/src/modules/rlm_nibs/doc/INSTALL /usr/local/etc/apache/nibs.conf [server:~] # cat /usr/local/etc/apache/nibs.conf #--------------------------------------------------------- #admin #--------------------------------------------------------- php_admin_flag engine On php_admin_flag safe_mode Off php_admin_flag register_globals On ServerName admin.corpX.un DocumentRoot /var/www/admin AllowOverride all Options FollowSymlinks Includes Order allow,deny Allow from all #--------------------------------------------------------- #stat #--------------------------------------------------------- php_admin_flag engine On php_admin_flag safe_mode Off php_admin_flag register_globals On ServerName stat.corpX.un DocumentRoot /var/www/stat AllowOverride all Options FollowSymlinks Includes Order allow,deny Allow from all [server:~] # cat /usr/local/etc/apache/httpd.conf ... NameVirtualHost *:80 include /usr/local/etc/apache/nibs.conf [server:~] # apachectl configtest [server:~] # /usr/local/etc/rc.d/apache restart [server:~] # cat /etc/namedb/master/corpX.un ... admin IN A 192.168.X.10 stat IN A 192.168.X.10 ... Настройка учета. За что считать деньги За трафик Какой трафик учитывать Суммарный Отредактировать прайс