FreeRadius3 + Dhcp (Linux)
cd /usr/ports/net/freeradius3/ && make install clean
Покажется окно конфигурирования доступных фичам, в котором ставим галку на пункте MYSQL. Если окно не покажется, то тогда прерываем и:
make config
Создаем конфиг dhcp:
ee /usr/local/etc/raddb/sites-enabled/dhcp
server dhcp { listen { type = dhcp ipaddr = 0.0.0.0 port = 67 broadcast = yes } dhcp DHCP-Discover { update reply { DHCP-Message-Type = DHCP-Offer } update reply { DHCP-Domain-Name-Server = 0.0.0.0 DHCP-IP-Address-Lease-Time = 7200 DHCP-DHCP-Server-Identifier = 10.0.1.1 } sql.authorize ok } dhcp DHCP-Request { update reply { DHCP-Message-Type = DHCP-Ack } update reply { DHCP-Domain-Name-Server = 0.0.0.0 DHCP-IP-Address-Lease-Time = 7200 DHCP-DHCP-Server-Identifier = 10.0.1.1 } sql.authorize nodeny.post-auth ok } dhcp { reject } }
Здесь 10.0.1.1 - это ip интерфейса, на котором нам нужно dhcp.
Создаем конфиг sql:
ee /usr/local/etc/raddb/mods-enabled/sql
server dhcp { sql { database = "mysql" driver = "rlm_sql_mysql" server = "localhost" port = 3306 login = "nodeny" password = "hardpass" radius_db = "nodeny" delete_stale_sessions = yes sqltrace = no sqltracefile = ${logdir}/sqltrace.sql num_sql_socks = 5 connect_failure_retry_delay = 60 lifetime = 0 max_queries = 0 authorize_check_query = "call radcheck('%{User-Name}')" authorize_reply_query = "call radreply('%{User-Name}')" postauth_query = "call radupdate('%{User-Name}','%{reply:Framed-IP-Address}',\ 'user=%{Calling-Station-Id};nas=%{NAS-IP-Address}')" accounting_update_query = "call radupdate('%{User-Name}','%{Framed-IP-Address}',\ 'user=%{Calling-Station-Id};nas=%{NAS-IP-Address}')" }