freeradius 自带了非常好的客户端程序 radtest, radclient 用来模拟和调试设备和通信过程。radtest多用于认证,radclient更为强大一些,认证,计费,coa都可以模拟,还可以自定义协议包非常强大。

命令帮助

这里大家自己看下就好了,非常容易理解。测试的时候用的都比较简单一些。


radclient -h

Usage: radclient [options] server[:port] <command> [<secret>]

  <command>              One of auth, acct, status, coa, disconnect or auto.

  -4                     Use IPv4 address of server

  -6                     Use IPv6 address of server.

  -c <count>             Send each packet 'count' times.

  -d <raddb>             Set user dictionary directory (defaults to /usr/local/etc/raddb).

  -D <dictdir>           Set main dictionary directory (defaults to /usr/local/share/freeradius).

  -f <file>[:<file>]     Read packets from file, not stdin.

                         If a second file is provided, it will be used to verify responses

  -F                     Print the file name, packet number and reply code.

  -h                     Print usage help information.

  -i <id>                Set request id to 'id'.  Values may be 0..255

  -n <num>               Send N requests/s

  -p <num>               Send 'num' packets from a file in parallel.

  -q                     Do not print anything out.

  -r <retries>           If timeout, retry sending the packet 'retries' times.

  -s                     Print out summary information of auth results.

  -S <file>              read secret from file, not command line.

  -t <timeout>           Wait 'timeout' seconds before retrying (may be a floating point number).

  -v                     Show program version information.

  -x                     Debugging mode.

  -P <proto>             Use proto (tcp or udp) for transport.

模拟认证请求


$ echo "User-Name=ff:ff:ff:ff:ff,User-Password=benu123" |radclient 127.0.0.1:1812 auth testing123 -x

Sent Access-Request Id 71 from 0.0.0.0:47403 to 127.0.0.1:1812 length 54

    User-Name = "ff:ff:ff:ff:ff"

    User-Password = "benu123"

    Cleartext-Password = "benu123"

Received Access-Accept Id 71 from 127.0.0.1:1812 to 0.0.0.0:0 length 158

    User-Name = "ff:ff:ff:ff:ff"

    Benu-Redirection-URL = "http://10.10.4.9:8080/WebAuthLogin1?portal_ip=10.10.4.2&client_id=ff:ff:ff:ff:ff&wbaredirect=http://www.google.com"

echo 的内容是请求内容,127.0.0.0:1812是radius认证端口, auth 是请求类型 , testing123 是cleint和radius的密钥, -x 表明查看详细过程。

模拟coa请求

coa_auth.txt 请求包内容


User-Name=C4-07-2F-85-15-9F

NAS-IP-Address=172.16.15.188

Calling-Station-Id=C4-07-2F-85-15-9F

Benu-ACL-Policy=auth_sla

Benu-QoS-Policy=32M_Full

测试以及结果



# radclient 172.16.15.188:3799 coa test -f coa_auth.txt -x

Sent CoA-Request Id 121 from 0.0.0.0:59699 to 172.16.15.188:3799 length 96

        User-Name = "C4-07-2F-85-15-9F"

        NAS-IP-Address = 172.16.15.188

        Calling-Station-Id = "C4-07-2F-85-15-9F"

        Benu-ACL-Policy = "auth_sla"

        Benu-QoS-Policy = "32M_Full"

Received CoA-ACK Id 121 from 172.16.15.188:3799 to 0.0.0.0:0 length 26

        Event-Timestamp = "Jan  8 2016 10:05:47 CST"

模拟计费请求

主要包含了计费开始,计费更新,计费停止几个报文。

请求命令

radclient 127.0.0.1 auto testing123 -f acct_start.txt

如果想看到详细的过程 命令结尾增加一个 -x 参数即可。

acct_start.txt


Packet-Type=4

Packet-Dst-Port=1813

Acct-Session-Id = "4D2BB8AC-00000099"

Acct-Status-Type = Start

Acct-Authentic = RADIUS

User-Name = "ff:ff:ff:ff:ff"

NAS-Port = 0

Called-Station-Id = "00-02-6F-AA-AA-AA:My Wireless"

Calling-Station-Id = "00-1C-B3-AA-AA-AA"

NAS-Port-Type = Wireless-802.11

Connect-Info = "CONNECT 48Mbps 802.11b"

Benu-ACL-Policy = "AM"

Benu-QoS-Policy = "DC"

Benu-Acct-Reason-Code = "40"

Benu-Private-Ip-Address = "127.0.0.1"

Benu-Napt-Public-Port-Range = "50"

acct_update.txt


Packet-Type=4

Packet-Dst-Port=1813

Acct-Session-Id = "4D2BB8AC-00000099"

Acct-Status-Type = Interim-Update

Acct-Authentic = RADIUS

User-Name = "ff:ff:ff:ff:ff"

NAS-Port = 0

Called-Station-Id = "00-02-6F-AA-AA-AA:My Wireless"

Calling-Station-Id = "00-1C-B3-AA-AA-AA"

NAS-Port-Type = Wireless-802.11

Connect-Info = "CONNECT 48Mbps 802.11b"

Acct-Session-Time = 11

Acct-Input-Packets = 15

Acct-Output-Packets = 3

Acct-Input-Octets = 1407

Acct-Output-Octets = 467

acct_stop.txt


Packet-Type=4

Packet-Dst-Port=1813

Acct-Session-Id = "4D2BB8AC-00000099"

Acct-Status-Type = Stop

Acct-Authentic = RADIUS

User-Name = "ff:ff:ff:ff:ff"

NAS-Port = 0

Called-Station-Id = "00-02-6F-AA-AA-AA:My Wireless"

Calling-Station-Id = "00-1C-B3-AA-AA-AA"

NAS-Port-Type = Wireless-802.11

Connect-Info = "CONNECT 48Mbps 802.11b"

Acct-Session-Time = 30

Acct-Input-Packets = 25

Acct-Output-Packets = 7

Acct-Input-Octets = 3407

Acct-Output-Octets = 867

Acct-Terminate-Cause = User-Request

测试


[root@orangleliu raddb]# radclient 127.0.0.1 auto testing123 -f acct_start.txt

Sent Accounting-Request Id 74 from 0.0.0.0:45094 to 127.0.0.1:1813 length 205

Received Accounting-Response Id 74 from 127.0.0.1:1813 to 0.0.0.0:0 length 20

[root@orangleliu raddb]# radclient 127.0.0.1 auto testing123 -f acct_update.txt

Sent Accounting-Request Id 231 from 0.0.0.0:28329 to 127.0.0.1:1813 length 183

Received Accounting-Response Id 231 from 127.0.0.1:1813 to 0.0.0.0:0 length 20

[root@orangleliu raddb]# radclient 127.0.0.1 auto testing123 -f acct_stop.txt

Sent Accounting-Request Id 209 from 0.0.0.0:62388 to 127.0.0.1:1813 length 189

Received Accounting-Response Id 209 from 127.0.0.1:1813 to 0.0.0.0:0 length 20

【freeradius】使用radclient调试radius协议的更多相关文章

  1. 【转】 浅谈Radius协议

    浅谈Radius协议 2013-12-03 16:06 5791人阅读 评论(0) 收藏 举报  分类: Radius协议分析(6)  从事Radius协议开发有段时间了,小弟不怕才疏学浅,卖弄一下, ...

  2. 转:浅谈Radius协议 -来自CSDN:http://blog.csdn.net/wangpengqi/article/details/17097221

    浅谈Radius协议 2013-12-03 16:06 5791人阅读 评论(0) 收藏 举报  分类: Radius协议分析(6)  从事Radius协议开发有段时间了,小弟不怕才疏学浅,卖弄一下, ...

  3. 无线局域网中RADIUS协议原理与实现

    转载自:http://blog.csdn.net/jinhill/article/details/5901042 摘要  RADIUS协议是一个被广泛应用于网络认证.授权和计费的协议.本文在介绍了RA ...

  4. 【协议】AAA Radius协议的常用报文分析

    写在前面的话 RADIUS:Remote Authentication Dial In User Service,远程用户拨号认证系统由RFC2865,RFC2866定义,是应用最广泛的AAA协议. ...

  5. Radius协议-学习

    目录 RFC Radius 协议 Radius-学习 RADIUS协议的主要特征 客户端/服务器模式 安全的消息交互机制 良好的扩展性 AAA介绍 C/S结构 RADIUS在协议栈中的位置 RADIU ...

  6. CentOS6.5下搭建LAMP+FreeRadius+Daloradius Web管理和TP-LINK路由器、H3C交换机连接,实现,上网认证和记账功能

    什么是RADIUS服务: RADIUS:(Remote Authentication Dial In User Service)中文名为远程用户拨号认证服务,简称RADIUS,是目前应用最广泛的AAA ...

  7. wifi认证Portal开发系列(一):Radius与FreeRadius简介

    RADIUS 维基百科上的介绍: Remote Authentication Dial-In User Service (RADIUS) is a networking protocol that p ...

  8. vlc源码分析(七) 调试学习HLS协议

    HTTP Live Streaming(HLS)是苹果公司提出来的流媒体传输协议.与RTP协议不同的是,HLS可以穿透某些允许HTTP协议通过的防火墙. 一.HLS播放模式 (1) 点播模式(Vide ...

  9. Radius 认证协议介绍-兼rfc导读

    老规矩, 先看维基: 远端用户拨入验证服务(RADIUS, Remote Authentication Dial In User Service)是一个AAA协议,意思就是同时兼顾验证(authent ...

随机推荐

  1. PGM:贝叶斯网表示之朴素贝叶斯模型naive Bayes

    http://blog.csdn.net/pipisorry/article/details/52469064 独立性质的利用 条件参数化和条件独立性假设被结合在一起,目的是对高维概率分布产生非常紧凑 ...

  2. Apache Beam—透视Google统一流式计算的野心

    Google是最早实践大数据的公司,目前大数据繁荣的生态很大一部分都要归功于Google最早的几篇论文,这几篇论文早就了以Hadoop为开端的整个开源大数据生态,但是很可惜的是Google内部的这些系 ...

  3. FFmpeg的HEVC解码器源代码简单分析:CTU解码(CTU Decode)部分-PU

    ===================================================== HEVC源代码分析文章列表: [解码 -libavcodec HEVC 解码器] FFmpe ...

  4. SQL基本函数

    字符型函数 函数名称 描述 LOWER 将特定的字符串转化为小写,只影响字母字符串. UPPER 将整个字符串转换成大写,只影响字母字符串. INITCAP 将字符串中每一个单词的第一个字母转换为大写 ...

  5. Android 深入理解Loader机制 让APP轻装上阵

    本文简书同步发布,谢谢关注. http://blog.csdn.net/sk719887916/article/details/51540610 Android开发者都经历过APP UI开发不当 会造 ...

  6. Linux之read命令使用

    read命令: read 命令从标准输入中读取一行,并把输入行的每个字段的值指定给 shell 变量 1)read后面的变量var可以只有一个,也可以有多个,这时如果输入多个数据,则第一个数据给第一个 ...

  7. [maven学习笔记]第一节,认识maven,搭建maven开发环境,写第一个HelloWorld

    本文地址:http://blog.csdn.net/sushengmiyan/article/details/40142771 maven官网:http://maven.apache.org/ 学习视 ...

  8. Linux上程序调试的基石(2)--GDB

    3. GDB的实现 GDB是GNU发布的一个强大的程序调试工具,用以调试C/C++程序.可以使程序员在程序运行的时候观察程序在内存/寄存器中的使用情况.它的实现也是基于ptrace系统调用来完成的.  ...

  9. C语言--static修饰函数

    在C语言中,static的字面意思很容易把我们导入歧途,其实它的作用有三条. 介绍它的第一条也是最重要的一条:隐藏. 当我们同时编译多个文件时,所有未加static前缀的全局变量和函数都具有全局可见性 ...

  10. Java进阶(三十五)java int与integer的区别

    Java进阶(三十五)java int与Integer的区别 前言 int与Integer的区别从大的方面来说就是基本数据类型与其包装类的区别: int 是基本类型,直接存数值,而Integer是对象 ...