Diameter Protocol
Diameter Protocol
Topics To be Covered
1. What is Diameter Protocol?
2. Diameter Protocol in Network Model
3. Diameter Message Header and Its Elements
4. AVP Message Structure and Its Elements
5. Diameter Agents
6. Diameter Peer Discovery
7. Routing Mechanism
8. Diameter Address Format
9. Diameter Credit Control Application and its Architecture
10.Supported Diameter Messages In our Product
11.Credit Control Request Message Format
12.Credit Control Answer Message Format
13.Diameter Result Codes
What is Diameter Protocol?
The Diameter protocol was initially developed by the IETF (Internet Engineering Task Force) to provide an Authentication,
Authorization, and Accounting (AAA) framework for applications such as remote network access or IP mobility. The Diameter
protocol has several advantages over previous AAA protocols like RADIUS in that it offers improvements in the areas of reliability,
security, scalability, and flexibility.
Diameter Default port is 3868 for TCP/SCTP.
Diameter Protocol In Network Model
Diameter Message Header
Diameter is Message based protocol. There are two types of messages: Request
Messages and Answer Messages.
Header Elements
Diameter AVPs are the basic unit inside the Diameter message that carries the
Data(Authentication Data , Security Data , Data pertaining to Application etc). There
must be at least one AVP inside Diameter message.
AVP Structure Elements
AVP Code - The AVP Code, combined with the Vendor-Id field, identifies the attribute uniquely. AVP numbers more than
256 are used for Diameter, less than 256 used for RADIUS.
AVP Flags - For simplicity, "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.
AVP Lengths - Three octets, and indicates the number of octets in this AVP including the AVP Code, AVP Length, AVP Flags,
Vendor-ID field (if present) and the AVP data.
Vendor-ID - The AVP Header contains one optional field. The Vendor-ID field is present if the 'V' bit is set in the AVP Flags
field.
Data - Information specific to the Attribute. The format and length of the Data field is determined by the AVP Code and AVP
Length fields
Diameter Agents
There are different diameter agents we are using across the application , few are listed below:
1) Diameter Relay
It is used to route the message to other diameter node with the help of routing information
received in message such as Destination-Realm, Destination -Host. Relay can accept the request
with multiple networks.
Relay must not change message format and avps except the routing avps. Relay must advertise its
Application Identifier (0xffffffff).
2)Diameter Proxy
Diameter Proxy does all that relay does. Moreover proxy can change message and avp format if
required to apply some policies.
A Diameter Proxy MUST be called as DIAMETER X Proxy, where X is the application whose
messages are being proxy-ed by by the node.
3)Diameter Redirect
Diameter Relay is useful in the scenario where diameter routing information is stored at
centralized location. Every node can get the route information from Redirect agent and then
forward the message. Redirect Agent does not forward message to any node. It just replies to the
request received with the routing information.[Message Processing at Redirect Agent]
Redirect must advertise its Application Identifier (0xffffffff)
4)Translator
Translator changes RADIUS message to Diameter and vice-versa for backward compatibility.
Diameter Peer Discovery
As the name suggests it is the process by which a node finds another node to whom it is going to communicate, dynamically.
1) aaa://host.example.com
on default port (3868), default transport(SCTP) and default protocol(diameter)
2)aaa://host.example.com:6666;transport=tcp;protocol=diameter
Port=6666, Transport=tcp , Protocol=diameter
3)aaa://host.example.com:1813;transport=udp;protocol=radius
Diameter Credit Control Application
The Diameter Credit-Control Application (reference to RFC 4006) provides a general solution to real-time cost and credit-control.
Figure 1 illustrates the typical credit-control architecture, which consists of a Service Element with an embedded Diameter
credit-control client, a Diameter credit-control server, and an AAA server. A Business Support System is usually deployed; it
includes at least the billing functionality.
When an end user requests services, the request is typically forwarded to a service element in the user’s home domain. In
some cases it might be possible that the service element in the visited domain can offer services to the end user; however,
a commercial agreement must exist between the visited domain and the home domain. Network access is an example of a
service offered in the visited domain where the NAS, through an AAA infrastructure, authenticates and authorizes the user
with the user’s home network.
Supported Diameter Messages in our product
The Credit Control protocol uses the framework defined in the Diameter base protocol (RFC 3588, reference). Below table shows the
messages currently supported.
1. Device Watchdog Request (DWR)- message is sent to a peer when no traffic has been exchanged between two peers. Indicated by the
Command-Code 280 and the Command Flags' 'R' bit set.
2. Device Watchdog Answer (DWA) - message is the response to a Device Watchdog Request message. Indicated by the Command-Code
280 and the Command Flags' 'R' bit cleared.
3. Capabilities Exchange Request (CER)-When two Diameter peers establish a transport connection, they MUST exchange Capabilities
Exchange Request (CER) messages. This message allows the discovery of a peer’s identity and its capabilities. Indicated by the
Command- Code 257 and the Command Flags' 'R' bit set.
4. Capabilities Exchange Answer (CEA)- message is the response to a Capabilities Exchange Request message. Indicated by the Command-
Code 257 and the Command Flags' 'R' bit cleared.
5. Credit Control Request(CCR)-The Credit-Control-Request message (CCR) is indicated by the command-code field being set to 272 and
the 'R' bit being set in the Command Flags field. It is used between the Diameter credit-control client and the credit-control server to
request credit authorization for a given service.
6. Credit Control Answer(CCA)- is indicated by the command-code field being set to 272 and the 'R' bit being cleared in the Command
Flags field. It is used between the credit-control server and the Diameter credit-control client to acknowledge a Credit-Control-Request
command.
Credit Control Request Message Format
<CC-Request> ::= < Diameter Header: 272, REQ, PXY >
< Session-Id >
{ Auth-Application-Id }
{ Origin-Host }
{ Origin-Realm }
{ Destination-Realm }
{ CC-Request-Type }
{ CC-Request-Number }
[ Destination-Host ]
[ Framed-IP-Address ]
[ Subscription-Id ]
• Session-ID- the format of the Session-Id is "pid; ip; time", where:
i. PID is a 32-bit integer type indicating the unique PID for a specific session.
ii. IP is a 32-bit unsigned integer type indicating the framed IP of the subscriber for which the session is created. IP is in decimal
format.
iii. TIME is a 32-bit unsigned integer type indicating the time when session is created. Time is in number of seconds starting from
January 1, 1970.
• Auth-Application-Id is set to the application ID of the protocol.
• Origin-Host is set to the host id (its IP).
• Origin-Realm is set to originating defined realm.
• Destination-Host is set to destination host id(its IP).
• Destination-Realm is set to destination realm. The destination host is not mandatory.
• CC-Request-Type is set to "Initial" on session creation ,”Update” on requested quota and "Termination" on session termination.
• CC-Request-Number is a unique number within a session-id.
• Framed-IP-Address is the IP address of the subscriber
• Subscription-Id is set to the subscriber-ID(for example, IMSI/MSISDN)
Credit Control Answer Message Format
<Credit-Control-Answer> ::= < Diameter Header: 272, PXY >
< Session-Id >
{ Result-Code }
{ Origin-Host }
{ Origin-Realm }
{ Auth-Application-Id }
{ CC-Request-Type }
{ CC-Request-Number }
[ User-Name ]
[ CC-Session-Failover ]