Diameter (Protocol) - Wikipedia
Diameter (Protocol) - Wikipedia
Diameter is an authentication, authorization, and accounting (AAA) protocol for computer networks. It evolved from the earlier RADIUS
protocol. It belongs to the application layer protocols in the Internet protocol suite.
Diameter Applications extend the base protocol by adding new commands and/or attributes, such as those for use with the Extensible
Authentication Protocol (EAP).
The name is a play on words, derived from the RADIUS protocol, which is the predecessor (a diameter is twice the radius). Diameter is
not directly backward compatible but provides an upgrade path for RADIUS. The main features provided by Diameter but lacking in
RADIUS are:
Capability negotiation
Application layer acknowledgements; Diameter defines failover methods and state machines (RFC 3539)
Also: Like RADIUS, it is intended to work in both local and roaming AAA situations. It uses TCP or SCTP, unlike RADIUS which uses UDP.
Unlike RADIUS it includes no encryption but can be protected by transport-level security (IPSEC or TLS). The base size of the AV
identifier is 32 bit unlike RADIUS which uses 8 bit as the base AV identifier size. Like RADIUS, it supports stateless as well as stateful
modes. Like RADIUS, it supports application-layer acknowledgment and defines failover. Diameter is used for many different interfaces
defined by the 3GPP standards, with each interface typically defining new commands and attributes.
Applications
A Diameter Application is not a software application but is a protocol based on the Diameter base protocol defined in RFC 6733
(obsoletes RFC 3588) and RFC 7075. Each application is defined by an application identifier and can add new command codes and/or
new mandatory AVPs (Attribute-Value Pair). Adding a new optional AVP does not require a new application.
Diameter Network Access Server Application (NASREQ, RFC 7155)(Obsoletes: RFC 4005)
History
The Diameter protocol was initially developed by Pat R. Calhoun, Glen Zorn, and Ping Pan in 1998 to provide a framework for
authentication, authorization, and accounting (AAA) that could overcome the limitations of RADIUS. RADIUS had issues with reliability,
scalability, security, and flexibility. RADIUS cannot deal effectively with remote access, IP mobility, and policy control. The Diameter
protocol defines a policy protocol used by clients to perform Policy, AAA, and resource control. This allows a single server to handle
policies for many services.[1]
Like RADIUS, Diameter provides AAA functionality, but uses TCP and SCTP instead of UDP, therefore delegating detection and handling
of communication problems to those protocols. The Diameter protocol is enhanced further by the development of the 3rd Generation
Partnership Project (3GPP) IP Multimedia Subsystem (IMS). The S6a, S6b, Gx, Gy, Sy, Rx, Cx, Dh, Dx, Rf, Ro, Sh and Zh interfaces are
supported by Diameter applications.[2] Through the use of extensions, the protocol was designed to be extensible to support proxies,
brokers, strong security, mobile IP, network-access servers (NASREQ), accounting and resource management.
Protocol description
The Diameter base protocol is defined by RFC 6733 (Obsoletes: RFC 3588 and RFC 5719) and defines the minimum requirements for an
AAA protocol. Diameter Applications can extend the base protocol by adding new commands, attributes, or both. Diameter security is
provided by IPsec or TLS. The IANA has assigned TCP and SCTP port number 3868 to Diameter, as stated in section 11.4 of RFC 6733.
Packet format
The packet consists of a Diameter header and a variable number of Attribute–Value Pairs, or AVPs, for encapsulating information
relevant to the Diameter message.
Diameter Header
Bit
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
offset
32 R P E T command code
64 application ID
96 hop-by-hop ID
128 end-to-end ID
160 AVPs
... ...
Version
This field indicates the version of the Diameter Base Protocol. As of 2014, the only value supported is 1.[3]
Message length
The Message Length field indicates the length of the Diameter message in bytes, including the header fields and the padded AVPs.
Command flags
The "R" (Request) bit – If set, the message is a request. If cleared, the message is an answer.
The "P" (Proxiable) bit – If set, the message MAY be proxied, relayed or redirected. If cleared, the message MUST be locally processed.
The "E" (Error) bit – If set, the message contains a protocol error, and the message will not conform to the CCF described for this
command. Messages with the "E" bit set are commonly referred to as error messages. This bit MUST NOT be set in request messages.
The "T" (Potentially re-transmitted message) bit – This flag is set after a link failover procedure, to aid the removal of duplicate requests.
It is set when resending requests not yet acknowledged as an indication of a possible duplicate due to a link failure.
Commands
Each command Request/Answer pair is assigned a command code. Whether it is the request or answer is identified via the 'R' bit in the
Command Flags field of the header.
The values 0-255 are reserved for RADIUS backward compatibility. The values 256-16777213 are for permanent, standard commands
allocated by IANA. The values 16777214 and 16777215 (hex 0xFFFFFE and 0xFFFFFF) are reserved for experimental and testing
purposes.
A Command Code is used to determine the action that is to be taken for a particular message. Some common Diameter commands
defined in the protocol (base and applications) are:
Command-Name Abbr. Code Application
Credit-Control-Request CCR 272 Diameter Credit-Control Application - RFC 8506 (Obsoletes RFC 4006)
Credit-Control-Answer CCA 272 Diameter Credit-Control Application - RFC 8506 (Obsoletes RFC 4006)
Application-ID
Application-ID is used to identify for which Diameter application the message is applicable. The application can be an authentication
application, an accounting application, or a vendor-specific application.
Diameter agents conforming to a certain Diameter extension publicize its support by including a specific value of in the Auth-
Application-Id Attribute of the Capabilities-Exchange-Request (CER) and Capabilities-Exchange-Answer (CEA) command.
The value of the Application-ID field in the header is the same as any relevant Application-Id AVPs contained in the message. For
instance, the value of the Application-ID and of the Auth-Application-Id Attribute in the Credit-Control-Request (CCR) and Credit-Control-
Answer (CCA) Command for the Diameter Credit-Control Application is 4.[4]
Hop-by-Hop Identifier
The Hop-by-Hop Identifier is an unsigned 32-bit integer field (in network byte order) that is used to match the requests with their
answers as the same value in the request is used in the response.
The Diameter protocol requires that relaying and proxying agents maintain transaction state, which is used for failover purposes.
Transaction state implies that upon forwarding a request, its Hop-by-Hop Identifier is saved; the field is replaced with a locally unique
identifier, which is restored to its original value when the corresponding answer is received. The request's state is released upon receipt
of the answer. Received answers that do not match a known Hop-by-Hop Identifier are ignored by the Diameter agent.
In case of redirecting agents, the Hop-by-Hop Identifier is maintained in the header as the Diameter agent responds with an answer
message.
End-to-End Identifier
The End-to-End Identifier is an unsigned 32-bit integer field (in network byte order) that is used to detect duplicate messages along with
the combination of the Origin-Host AVP.
When creating a request, the End-to-End Identifier is set to a locally unique value. The End-to-End Identifier is not modified by Diameter
agents of any kind, and the same value in the corresponding request is used in the answer.
AVP Header
Bit
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
offset
0 AVP code
32 V M P AVP length
64 vendor ID (optional)
96 data
... ...
For simplicity, AVP Flag "V" bit Means Vendor Specific; "M" bit means Mandatory; "P" bit means Protected.
The "V" bit, known as the Vendor-Specific bit, indicates whether the optional Vendor-ID field is present in the AVP header. When set the
AVP Code belongs to the specific vendor code address space.
The "M" bit, known as the Mandatory bit, indicates whether support of the AVP is required. If an AVP with the "M" bit set is received by a
Diameter client, server, proxy, or translation agent and either the AVP or its value is unrecognized, the message must be rejected.
Diameter Relay and redirect agents must not reject messages with unrecognized AVPs.
The "P" bit indicates the need for encryption for end-to-end security.
Attribute-Name Code Data Type
Acct-Interim-Interval 85 Unsigned32
Acct-Multi-Session-Id 50 UTF8String
Accounting-Session-Id 44 OctetString
Class 25 OctetString
Event-Timestamp 55 Time
Proxy-State 33 OctetString
Session-Timeout 27 Unsigned32
User-Name 1 UTF8String
State machines
The RFC 3588 defines a core state machine for maintaining connections between peers and processing messages. This is part of the
basic protocol functionality and all stacks should support it and as such abstract from the connectivity related operations.
Additionally, application specific state machines can be introduced either later or at a higher abstraction layer. The RFC 3588 defines an
authorization and an accounting state machine.
Message flows
The communication between two diameter peers starts with the establishment of a transport connection (TCP or SCTP). The initiator
then sends a Capabilities-Exchange-Request (CER) to the other peer, which responds with a Capabilities-Exchange-Answer (CEA). For
RFC3588 compliant peers TLS (Transport Layer Security) may optionally be negotiated. For RFC6733 compliant peers TLS negotiation
may optionally happen before the CER/CEA.
If no messages have been exchanged for some time either side may send a Device-Watchdog-Request (DWR) and the other peer must
respond with Device-Watchdog-Answer.
Either side may terminate the communication by sending a Disconnect-Peer-Request (DPR) which the other peer must respond to with
Disconnect-Peer-Answer. After that the transport connection can be disconnected.
RFCs
The Diameter protocol is currently defined in the following IETF RFCs: Obsolete RFCs are indicated with strikethrough text.
Date Obsoleted
# Title
published by
September
RFC 3588 Diameter Base Protocol. RFC 6733
2003
RFC 4005 Diameter Network Access Server Application. August 2005 RFC 7155
RFC 4072 Diameter Extensible Authentication Protocol (EAP) Application. August 2005
November
RFC 4740 Diameter Session Initiation Protocol (SIP) Application. M.
2006
RFC 5431 Diameter ITU-T Rw Policy Enforcement Interface Application. March 2009
Diameter Mobile IPv6: Support for Network Access Server to Diameter February
RFC 5447
Server Interaction. 2009
RFC 5624 Quality of Service Parameters for Usage with Diameter. August 2009
RFC 5719 Updated IANA Considerations for Diameter Command Code Allocations. January 2010 RFC 6733
See also
References
1. Pat R. Calhoun, Glen Zorn, and Ping Pan (February 2001). "DIAMETER Framework Document" (http://tools.ietf.org/html/draft-calhoun-diameter-fra
mework-09) . Ietf Datatracker. IETF. Retrieved 30 April 2009.
2. Naman Mehta (20 March 2009). "Introduction to Diameter Protocol - What is Diameter Protocol?" (https://web.archive.org/web/20110704234203/
http://blogs.oracle.com/naman/entry/introduction_to_diameter_protocol) . Sun Microsystems. Archived from the original (https://blogs.oracle.c
om/naman/entry/introduction_to_diameter_protocol) on 4 July 2011. Retrieved 30 April 2009.
3. Arkko, J.; Loughney, J. (2012). Fajardo, V; Zorn, G (eds.). "RFC 6733 - Diameter Base Protocol" (http://tools.ietf.org/html/rfc6733) . Proposed
Standard. Standards Track. doi:10.17487/RFC6733 (https://doi.org/10.17487%2FRFC6733) . ISSN 2070-1721 (https://www.worldcat.org/issn/20
70-1721) . Retrieved 12 October 2014.
4. Hakala, H.; Mattila, L.; Stura, M.; Loughney, J. (2005). "RFC 4006 - Diameter Credit-Control Application" (https://tools.ietf.org/html/rfc4006) .
Proposed Standard. Standards Track. doi:10.17487/RFC4006 (https://doi.org/10.17487%2FRFC4006) .
External links
Reference page listing vendors of Diameter Gateways, Diameter Signaling Controllers and Diameter Stacks (https://web.archive.org/
web/20180108053207/http://www.diametergateway.com/)