<< Previous Contents Index Next >>

4.2. Traffic types: protocols and type of service

4.2.1. Defining protocols: the protocols statement

If the protocols keyword is used on a charge, the charges will be split into individual protocols. Only declared protocols will be counted, and no protocols are declared by default. (Traffic not matching a declared protocol will be output without a protocol indicator.)

Protocols are declared using the protocol statement:

name is the protocol name to declare. prot is the IP protocol, e.g. tcp, udp, icmp or a protocol number. If prot is tcp or udp, port may be specified. Note that udp ports are also applied to the UDP-Lite protocol (protocol 136) described in RFC 3828.

The final, optional field determines directionality of TCP and UDP flows; in protocols match if the source port matches the specified port number on inbound traffic, or if the destination packet matches on outbound traffic; e.g.

A TCP connection from a remote host to 192.168.6.1 on port 80 will appear as being charged to charge code inbound for the inbound packets, and web-in as the protocol. The outbound packets in the same flow will be charged as outbound, but the protocol will still indicate web-in.

4.2.2. Type of service: the phb statement

"PHB" stands for Per Hop Behaviour, and is discussed in RFC 2474, Definition of the Differentiated Services Field (DS Field) in the IPv4 and IPv6 Headers. Differentiated Services, or diffserv, uses the 6-bit IP type-of-service field to assign traffic management tags.

The phb statement assigns names to each of the possible 64 tags, and takes the form:

The bitmask is expressed as a six character field representing a six bit bit binary value, with 0 representing a clear bit, 1 a set bit, or x for bits that may be either set or clear. Bits are represented with the low order bit (bit 0) on the left and the high order bit (bit 5) on the right.

PHBs can be simply reported, or used for traffic rating, e.g. to allow traffic that has been prioritised within the network to be charged at a different rate. E.g.


<< Previous Contents Index Next >>