radius協議使用的是UDP傳輸協議,UDP協議相對於TCP更快速,無連接的不可靠。
radius協議的包格式:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Code | Identifier | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Authenticator |
| |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Attributes ...
+-+-+-+-+-+-+-+-+-+-+-+-+-
code:radius報文類型,有效類型值如下:
1 access-request
2 access-accept
3 access-reject
4 accounting-request
5 accounting-response
11 access-challenge
如下不常用,一般不會遇到
12 status-server
13 status-client
255 reserved
identifier:匹配請求的迴應
length:報文有效長度,20-4096,多餘的視爲補充,不足的丟棄整個報文。
authenticator:16字節
用於Radius Client 和Server之間消息認證的有效性,和密碼隱藏算法。
訪問請求認證字
在Access-Request包中認證字的值是16字節隨機數,認證字的值要不能被預測,並且在一個共享密鑰的生命期內唯一;
訪問迴應認證字
Access-Accept Access-Reject 和Access-Challenge包中的認證字稱爲訪問迴應認證字,訪問迴應認證字的值定義爲MD5(Code+ID+Length+RequestAuth+Attributes+Secret);
計費請求Accounting-Request認證字
在計費請求包中的認證字域稱爲計費請求認證字,它是一個16字節的MD5校驗和,計費請求認證字的值定義爲MD5(Code + Identifier + Length + 16 zero octets + request attributes +shared secret);
計費迴應Accounting-Response認證字
在計費迴應報文中的認證字域稱爲計費迴應認證字,它的值定義爲MD5(Accounting-Response Code + Identifier + Length + the RequestAuthenticator field from the Accounting-Request packet being replied to +the response attributes + shared secret);
http://blog.csdn.net/zhaori/article/details/554004