mikrotik ros + FreeRadius+daloradius CoA和PoD断开

来源:互联网 发布:p2717h 知乎 编辑:程序博客网 时间:2024/04/25 14:21

我们看到freeradius Disconnect Messages写到:

Example Disconnect-Request
FreeRADIUS server (radiusd) supports sending Disconnect-Request via the update coa and update disconnect Unlang statements. You can also send disconnect packets to a Disconnect enabled NAS with radclient as follows:

翻译原文》》》 示例Disconnect-Request
FreeRADIUS服务器(radiusd)支持通过更新coa发送Disconnect-Request,并更新断开Unlang语句。 您也可以使用radclient将断开数据包发送到已断开连接的NAS,如下所示:


# echo "Acct-Session-Id=D91FE8E51802097" > packet.txt# echo "User-Name=somebody" >> packet.txt# echo "NAS-IP-Address=10.0.0.1" >> packet.txt# cat packet.txt | radclient -x 10.0.0.1:3799 disconnect ''secret''Sending Disconnect-Request of id 214 to 10.0.0.1 port 3799      Acct-Session-Id = "D91FE8E51802097"      User-Name = "somebody"      NAS-IP-Address = 10.0.0.1rad_recv: Disconnect-ACK packet from host 10.0.0.1 port 3799, id=214, length=20

Note: The actual attributes which need to be sent in the Disconnect-Request and the port you send the packet to may vary depending on your brand of NAS and it's configuration. Though the RFC states the destination UDP port should be 3799 for Disconnect-Requests , Cisco brand equipment uses the non standard UDP port 1700 by default for POD.

For Mikrotik try:

翻译原文》》》注意:需要在Disconnect-Request中发送的实际属性和发送数据包的端口可能因NAS的品牌及其配置而异。 尽管RFC声明目标UDP端口对于断开请求应为3799,但Cisco品牌设备默认使用非标准UDP端口1700作为POD。

对于Mikrotik尝试:

# cat packet.txt | radclient -r 1 10.0.0.1:1700 disconnect ''secret''

文档地址 (Freeradius)http://wiki.freeradius.org/protocol/Disconnect-Messages


我又去mikrotik论坛查找了一下关于 CoA 和PoD

文档地址 (mikrotik)http://wiki.freeradius.org/protocol/Disconnect-Messages

文档说不支持PoD
注意:RouterOS不支持POD(断开分组)另一个RADIUS访问请求数据包执行类似的功能作为Disconnect Messages
这时我TM就B了,人家是咋玩的? 看那段代码肯是没问题的,为啥我用就不行呢!

ros  log里提示    hotspot, error, info, debug   Radius disconnect with no ip provided--和这个--Radius  with no ip provided

最后我发现在daloradius有一段
echo "User-Name='777'," | radclient -c '1' -n '3' -r '3' -t '3' -x '192.168.2.39:3799' 'disconnect' 'testing123' 2>&1
但是不好使啊 !根本踢不掉用户。然后我们怎么办呢?我又想起一个改代码的注意 哈哈 

echo User-Name=777,Framed-IP-Address="40.0.0.254" | radclient -d /opt/freeradius-server-2.1.10/raddb -x -F 192.168.2.39:3799 coa testing123
ver-2.1.10/raddb -x -F 192.168.2.39:3799 coa testing123
Sending CoA-Request of id 148 to 192.168.2.39 port 3799
User-Name = "777"
Framed-IP-Address = 40.0.0.254
rad_recv: CoA-ACK packet from host 192.168.2.39 port 3799, id=148, length=36
-:1 44
NAS-Identifier = "MikroTik"
NAS-IP-Address = 192.168.2.39

这个的也不好用 
在接这个改

echo User-Name=777,Framed-IP-Address="40.0.0.254" | radclient -d /opt/freeradius-server-2.1.10/raddb -x -F 192.168.2.39:3799 disconnect testing123

哈哈 成功了

User-Name=777, 这时用户账号

Framed-IP-Address="40.0.0.254"这个是用户获取的ip地址

我把coa 改disconnect这个才成功了  
 

echo User-Name=777,Framed-IP-Address="40.0.0.254" | radclient -x -F 192.168.2.39:3799 disconnect testing123

这个也是好用的  
命令好使了还的修改daloradius 的 rep-online.php
在241行添加  :Framed-IP-Address=$ip
<a class='toolTip' href='config-maint-disconnect-user.php?username=$username&nasaddr=$nasip&customattributes=Acct-Session-Id=$acctsessionid,Framed-IP-Address=$ip'>"


上图测试 演示视频+daloradius
链接:http://pan.baidu.com/s/1c2tcHTQ 密码:6wiy


0 0
原创粉丝点击