radius 测试

发布时间 2023-08-03 14:48:13作者: codestacklinuxer

目前使用radclient来测试模拟计费报文

模拟计费请求

start报文

radclient 127.0.0.1 auto testing123 -f acct_start.txt

acct_start.txt
User-Name = 'user3@example.org'
Calling-Station-Id = "00-1C-B3-AA-AA-AA"
Packet-Type=4
Packet-Dst-Port=1813
NAS-Port = 17826193
NAS-IP-Address = 192.0.2.10
Framed-IP-Address = 198.51.100.59
NAS-Identifier = 'nas.example.org'
Acct-Status-Type = Start
Acct-Delay-Time = 1
Acct-Input-Octets = 0
Acct-Output-Octets = 0
Acct-Session-Id = '00000003'
Acct-Unique-Session-Id = '00000003'
Acct-Authentic = RADIUS
NAS-Port-Type = Ethernet
NAS-Port-Id = 'port 001'
Service-Type = Framed-User
Framed-Protocol = PPP
Acct-Link-Count = 0

计费更新以及停止报文

acct_update.txt

User-Name = 'user4@example.org'
Packet-Type=4
Packet-Dst-Port=1813
NAS-Port = 17826193
NAS-IP-Address = 192.0.2.10
Framed-IP-Address = 198.51.100.59
Called-Station-Id = "00-02-6F-AA-AA-AA:Myeth"
Calling-Station-Id = "00-1C-B3-AA-AA-AA"
NAS-Identifier = 'nas.example.org'
Acct-Status-Type = Interim-Update
Acct-Delay-Time = 1
Acct-Input-Octets = 10
Acct-Output-Octets = 10
Acct-Session-Id = '00000004'
Acct-Unique-Session-Id = '00000004'
Acct-Authentic = RADIUS
Acct-Session-Time = 30
Acct-Input-Packets = 10
Acct-Output-Packets = 10
Acct-Input-Gigawords = 1
Acct-Output-Gigawords = 1
Event-Timestamp = 'Feb  1 2015 08:28:28 WIB'
NAS-Port-Type = Ethernet
NAS-Port-Id = 'port 001'
Service-Type = Framed-User
Framed-Protocol = PPP
Acct-Link-Count = 0

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

 

模拟coa请求

coa_auth.txt 请求包内容

//radclient 127.0.0.1:3799 coa testing123  -f coa_auth.txt -x
User-Name=C4-07-2F-85-15-9F
NAS-IP-Address=127.0.0.1
Calling-Station-Id=C4-07-2F-85-15-9F
Benu-ACL-Policy=auth_sla
Benu-QoS-Policy=32M_Full