华为Radius认证、计费报文入门
Radius报文中,code=1是认证请求报文,code=2和code=3分别是认证通过和认证失败报文,这三种报文只在用户上线时产生。在用户上网的漫长过程中,是依靠code=4报文来维系计费和用户在线信息。下文结合S3526和huawei-3com自带的radius属性简要介绍一下code=4和与之相关的code=5报文。
关于radius里面code=4和code=5的报文:
code=4:计费请求,由客户端发出(一般是配置了radius的交换机或5200)
code=5:计费回应。由radius服务器发出(cams发)
开始计费和结束计费是由code=4里面的属性Acct-Status-Type(40)来决定的。
1、Start (计费开始)
2、Stop (计费结束)
3、Interium-Update(计费更新)
4、Reset-Charge
7、Accounting-On(3GPP中有定义,我们cams支持,设备现在不支持)
8、Accounting-Off (3GPP中有定义,我们cams支持,设备现在不支持)
9-14、Reserved for Tunnel Accounting
15、Reserved for Failed
其中Reset-Charge (Value=4)报文类型是针对华为扩展Radius 定义的。
我们主要看1、2、3三个属性,后面的属性暂时看不到。
以下是在cams中一个完整的上线、计费、更新、下线信息的分析: (10。153。29。200是S3526。中间的更新报文是从其他地方截取的,部分时间和流量参数不准确)
% 2004-04-28 11:28:38 ; [L_DEBUG (4)] ; LAN ; huawei ; 1 ; 03f44e0b-4542-464c-96aa-c15b39928ada ; (null) ; RT[0]: Receive message from 10.153.29.200:
CODE = 1.
ID = 0.
ATTRIBUTES:
User-Name(1) = "huawei".
CHAP-Password(3) = "_?-?d?????_?D".
CHAP-Challenge(60) = "?_k_?h????e??G?".
NAS-IP-Address(4) = 177806792. (十进制,转换成二进制就是10.153.29.200)
NAS-Identifier(32) = "Quidway".
NAS-Port(5) = 28673.
NAS-Port-Id(87) = "slot=0;subslot=0;port=7;vlanid=1".
NAS-Port-Type(61) = 15.
Service-Type(6) = 2.
Framed-Protocol(7) = 1.
Calling-Station-Id(31) = "000c-f1a2-ddce".
Framed-IP-Address( = 2852053299. (十进制,换成二进制是认证未通过前pc的地址:169.254.225.51,认证通过后,pc通过dhcp获得新的地址,见下文)
hw_Connect_ID(26) = 72.
hw_Product_ID(255) = "S3526".
hw_IP_Host_Addr(60) = "169.254.225.51 00:0c:f1:a2:dd:ce".
hw_Nas_Startup_Timetamp(59) = 1082022357.
% 2004-04-28 11:28:38 ; [L_DEBUG (4)] ; LAN ; huawei ; 2 ; 03f44e0b-4542-464c-96aa-c15b39928ada ; 24 ; Send message attribut list:
Code = 2
ID = 0
ATTRIBUTES:
Service_Type(6) = 2
State(24) = 24
Termination-Action(29) = 0
Session-Timeout(27) = 86400
hw-Connect-Id(26) = 72 //认证通过
% 2004-04-28 11:28:38 ; [L_DEBUG (4)] ; LAN ; huawei ; 4 ; 36d754e8-3156-427c-8385-726e3cec5dc3 ; (null) ; RT[1]: Receive message from 10.153.29.200:
CODE = 4.
ID = 0.
ATTRIBUTES:
User-Name(1) = "huawei".
NAS-Identifier(32) = "Quidway".
NAS-Port(5) = 28673.
NAS-Port-Id(87) = "slot=0;subslot=0;port=7;vlanid=1".
NAS-Port-Type(61) = 15.
Calling-Station-Id(31) = "000c-f1a2-ddce".
Acct-Status-Type(40) = 1.
Acct-Authentic(45) = 1.
Acct-Session-Id(44) = "1040328122523".
Framed-IP-Address( = 2852053299.(还未更新)
NAS-IP-Address(4) = 177806792.
Event-Timestamp(55) = 1083155129.
hw_Connect_ID(26) = 72.
hw_Input_Peak_Rate(1) = 0.
hw_Input_Average_Rate(2) = 0.
hw_Output_Peak_Rate(4) = 0.
hw_Output_Average_Rate(5) = 0.
hw_Priority(22) = 0.
hw_IP_Host_Addr(60) = "169.254.225.51 00:0c:f1:a2:dd:ce".
% 2004-04-28 11:28:38 ; [L_DEBUG (4)] ; LAN ; huawei ; 5 ; 36d754e8-3156-427c-8385-726e3cec5dc3 ; 24 ; Send message attribut list:
Code = 5
ID = 0
ATTRIBUTES:
hw-Connect-Id(26) = 72 //开始计费
% 2004-04-28 12:09:59 ; [L_DEBUG (4)] ; LAN ; huawei ; 4 ; b90d16c2-534d-48f6-9fa6-64683e9e1bff ; (null) ; RT[1]: Receive message from 10.153.29.200:
CODE = 4.
ID = 4.
ATTRIBUTES:
User-Name(1) = "huawei".
NAS-Identifier(32) = "Quidway".
NAS-Port(5) = 28673.
NAS-Port-Id(87) = "slot=0;subslot=0;port=7;vlanid=1".
NAS-Port-Type(61) = 15.
Calling-Station-Id(31) = "000c-f1a2-ddce".
Acct-Status-Type(40) = 3.
Acct-Authentic(45) = 1.
Acct-Session-Id(44) = "1040328124124".
Framed-IP-Address( = 177806593. (pc的ip地址更新为10.153.29.1)
NAS-IP-Address(4) = 177806792.
Event-Timestamp(55) = 1083157610.
Acct-Session-Time(46) = 1502.
Acct-Delay-Time(41) = 1.
Acct-Input-Octets(42) = 1289458275.
Acct-Input-Packets(47) = 3211985.
Acct-Output-Octets(43) = 1704920353.
Acct-Output-Packets(4 = 6898795.
Acct-Input-Gigawords(52) = 0.
Acct-Output-Gigawords(53) = 0.
hw_Connect_ID(26) = 72.
hw_Input_Peak_Rate(1) = 0.
hw_Input_Average_Rate(2) = 0.
hw_Output_Peak_Rate(4) = 0.
hw_Output_Average_Rate(5) = 0.
hw_Priority(22) = 0.
hw_IP_Host_Addr(60) = "10.153.29.1 00:0c:f1:a2:dd:ce".
% 2004-04-28 12:09:59 ; [L_DEBUG (4)] ; LAN ; huawei ; 5 ; b90d16c2-534d-48f6-9fa6-64683e9e1bff ; 25 ; Send message attribut list:
Code = 5
ID = 4
ATTRIBUTES:
Session-Timeout(27) = 84898
hw-Connect-Id(26) = 72 //计费更新
% 2004-04-28 12:29:00 ; [L_DEBUG (4)] ; LAN ; huawei ; 4 ; 18c19784-bd78-4bb4-b8a2-1416070da8f3 ; (null) ; RT[1]: Receive message from 10.153.29.200:
CODE = 4.
ID = 6.
ATTRIBUTES:
User-Name(1) = "huawei".
NAS-Identifier(32) = "Quidway".
NAS-Port(5) = 28673.
NAS-Port-Id(87) = "slot=0;subslot=0;port=7;vlanid=1".
NAS-Port-Type(61) = 15.
Calling-Station-Id(31) = "000c-f1a2-ddce".
Acct-Status-Type(40) = 2.
Acct-Authentic(45) = 1.
Acct-Session-Id(44) = "1040328122523".
Framed-IP-Address( = 177806593.
NAS-IP-Address(4) = 177806792.
Event-Timestamp(55) = 1083155150.
Acct-Session-Time(46) = 2112.
Acct-Delay-Time(41) = 0.
Acct-Input-Octets(42) = 1288900009.
Acct-Input-Packets(47) = 3204430.
Acct-Output-Octets(43) = 1697272686.
Acct-Output-Packets(4 = 6874089.
Acct-Input-Gigawords(52) = 0.
Acct-Output-Gigawords(53) = 0.
Acct-Terminate-Cause(49) = 1.
hw_Connect_ID(26) = 72.
hw_Input_Peak_Rate(1) = 0.
hw_Input_Average_Rate(2) = 0.
hw_Output_Peak_Rate(4) = 0.
hw_Output_Average_Rate(5) = 0.
hw_Priority(22) = 0.
hw_IP_Host_Addr(60) = "169.254.225.51 00:0c:f1:a2:dd:ce".
% 2004-04-28 12:29:00 ; [L_DEBUG (4)] ; LAN ; huawei ; 5 ; 18c19784-bd78-4bb4-b8a2-1416070da8f3 ; 24 ; Send message attribut list:
Code = 5
ID = 6
ATTRIBUTES:
hw-Connect-Id(26) = 72 //用户下线,计费结束。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论