netcerts.net
31Oct/110

Exploring HTTP and PKI

This blog article is an attempt to present the upper layers of OSI reference model from the perspective of network studies. The three upper layers of OSI reference model – Session, Presentation and Application are also sometimes combined into One as Application Layer in general but some protocols make use of each of this layer in-depth.  Also, these layers are mostly ignored when studying for the network certifications. Understanding of these layers is important as you design your network for the applications running at these layers. In this blog article I will be just writing briefly about the working of HTTP. Also at the end of this article there is a brief description of how public key infrastructure works.

HTTP:
HTTP is a text-based protocol and each line terminates with a Carriage Return – Line Feed (CRLF).

By design HTTP is stateless, but it can use cookies to maintain client state across TCP connections between clients and servers. HTTP 1.1 is the currently widely deployed  and it is backward compatible with the earlier HTTP 1.0

Some Common HTTP Methods

GET:        Is used to Retrieve the requested URI (Both headers and Body)
HEAD:     Is used to Retrieve only the Headers of the requested URI. (Headers Only)
POST:     Is used to send information to the server in html forms.
PUT:         Is used to upload a file to the server
DELETE:     Deletes a URI from a server

URI = Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource

Some of the Common HTTP Return Codes from the Server are listed at the end of this article.

HTTP Connection Persistence

When a Client asks information from the server, it opens a TCP connection to the server. The Client and Server agree on the TCP Connection with a TCP 3 Way Handshake and once the connection is established, the Server sends the requested content to the client on the same TCP Session.

So this is like a 3 step process

  1. Open a TCP Connection
  2. Complete the HTTP Transaction
  3. Close the TCP Connection

I. Open TCP Connection:
Client ———- SYN —————> Server
Client <———SYN/ACK———-Server
Client———– SYN—————> Server

II. Complete the HTMl Transaction
Client (Request) ————– HTTP GET 1.1——————————> Server
Client <————————-HTTP 200 OK—————— (Response) Server

III. Close the TCP Connection
Client —————- RST/FIN——————> Server

IV. Start over From Step-1
For each URL in the HTTP File  and repeat the process until all the content is downloaded

HTTP Persistence:
Webpages may have multiple URLs in the html file, each URL pointing to a different embedded object like images, videos etc.  Each different URL for the embedded files will create a different TCP Connection,  thus the number of TCP connections from each client to the server will increase drastically. To avoid these duplicate TCP Connections, HTTP 1.0 introduced the concept of Persistent Connections. By using Persistent Connections the extra overhead of creating multiple TCP connections is reduced.

Now With HTTP  Persistence The new Flow Looks simpler and only one TCP Connection is open between the Client and the Server to complete all HTTP transactions.

HTTP Persistence is achieved with the keep alive feature which is default ON in HTTP 1.1, but has to be negotiated in HTTP 1.0. The client and server agree of the Connection Keepalive to keep the TCP Connection active until the HTTP transactions are complete.

I. Open TCP Connection:
Client ———- SYN —————> Server
Client <———SYN/ACK———-Server
Client———– SYN—————> Server

II. Complete multiple HTMl Transactions using the Keepalive Features
Client (x.Request) ————– HTTP GET 1.1——————————> Server
Client <————————-HTTP 200 OK—————— (Response) Server

Client (y.Request) ————– HTTP GET 1.1——————————> Server
Client <————————-HTTP 200 OK—————— (Response) Server

Client (z.Request) ————– HTTP GET 1.1——————————> Server
Client <————————-HTTP 200 OK—————— (Response) Server

III. Close the TCP Connection
Client —————- RST/FIN——————> Server

HTTP Pipelining
HTTP 1.1 Supports  Pipelining the HTTP requests, but the implementation is optional and is not implemented by default.
With HTTP Pipelining, the Client can send multiple HTTP Requests for different URLs before getting a response from the Server.

  1. Open a TCP Connection
  2. Request multiple URLS, without waiting for Response from Server
  3. Server Response
  4. Close TCP Connection.

Maintaining Client Side State with HTTP Cookies
Since HTTP 1.1 is stateless, the use of cookies enables the client and server to maintain the state of the HTTP Session.

HTTP Cookies are always created by the Server. There are 2 types of cookies which the Servers can create
1. Session Cookies
2. Persistent Cookies

Session Cookies:
Web Browsers Store the cookies only for the life of the Session.
If the Session ends or Web Browser is closed – the Session cookie is deleted.
Session Cookies are useful for keeping track of user information as they browse from page to page on a website.

Persistent Cookies:
Web Browsers store the cookie on the hard disk for the amount of time indicated by the server in the cookie value.
The cookie is not removed even if session ends or web browser is closed.
the cookie only expires when the time to live of the cookie as specified by the server ends.

Cookies are Set by the Server using the “Set-Cookie:” in the header.
If the Cookie is set by the server but the expiration time is not given, then its a Session Cookie.
If the Cookie is set by the server with the expiration time then these are Persistent Cookies.

Example (Session Cookie):
Set-cookie: Session-ID=0123456789
When the client sends a request for a URI, the Server sets the Session Cookie  and responds with the “Set-Cookie:” header set to a unique value to identify the session. The client will then use this value in the subsequent HTTP transactions with the server.

Example (Persistent-Cookie):
Set-Cookie: name=somevalue; expires=DATE;
The server sets the expiry date of the cookie and client stores the cookie in the hard disk for the amount of time specified by the server.  The client uses this cookie in HTTP GET when contacting the server every time.

HTTP Authentication
HTTP 1.1 uses the MD5 Authentication, which is far more superior than the Base64 encoding used in HTTP 1.0
Any password encoded with Base64 can be easily decoded with many online tools available today over internet.

How MD5 works with HTTP 1.1
1. The server challenges the browser with a nonce value.
2. The browser uses this nonce, along with the supplied username and password , as input to a hash algorithm.
3. The browser encrypts login credentials by computing a message digest before sending them over the network.

Note:
1. A nonce is a one-time random number that HTTP 1.1 uses to prevent replay attacks.

2. To generate nonce values, servers normally use the current timestamp in conjunction with its private key (if it has a private key) and the “ETag:” HTTP headers in the client’s requests.

3. A hash function is a function that takes input values and performs a mathematical computation, resulting in a single (smaller) value that is impossible to determine the original values from. These functions are also called one-way hash functions because they are considered impossible to reverse. You can use Message Digest 5 (MD5) and Secure Hash Algorithm 1 (SHA-1) hash algorithms for your web applications to compute public keys from private keys. MD5 provides hashes 128 bits in length, and SHA-1 provides 168-bit hashes.

Moving on to the second part of this blog which gives some brief introduction on how the PKI works.

Public Key Infrastructure (PKI)
PKI deals with keeping the data between clients and servers confidential, maintain data integrity and address authentication when traversing over the public insecure networks like internet. PKI addresses data confidentiality, data integrity and authentication issues. For data confidentiality PKI uses cryptography. Cryptography addresses the issues of keeping data confidential when its traversing over the public networks. Cryptography comes in two forms
1. Secret Key Cryptography
2. Public Key Cryptography

Secret Key Cryptography
1. Both Client and Server each uses their own private  secret key, which they agree upon before any encryption happens ( that is they have to exchange it somehow to agree on)
2. Each uses their own secret key (private) to both encrypt and decrypt the data exchanged.
3. They Keys are either same or one of them is originated by applying some mathematical function to the other key, therefore  this is also called as Symmetric key cryptography and some of the common ones are DES, 3DES, where DES stands for Data Encryption Standard.

With Secret key Cryptography, two forms of ciphers can be used to encrypt the data
1. Stream Ciphers, which enable the network devices to encrypt individual bytes of data stream
2. Block Ciphers, enable network devices to encrypt blocks od data containing many bytes – DES/3DES.

The big challenge with Secret Key Cryptography is to exchange the private keys between client and server over public networks

Public Key Cryptography
One of the big advantages of public key cryptography is that you do not have to exchange the private key for secure communication ( a big challenge in secret key cryptography)

So in Public Key Cryptography, the server generates a pair of keys
1. Private key
2. Public key

The Server keeps the private key secure and keeps it secret and it also makes the public key available to everyone. With these pair of keys in place you can decrypt the information using a public key or a private key. that is information encrypted by private key can be decrypted using the public key and information encrypted using a public key can be decrypted using a private key.

These Private and Public keys are asymmetric which allows to derive the public key from the private key using a hash function, but not the other way, that is you cannot derive the private key using a hash function on the public key.  The common algorithms which run Public key Cryptography are – RSA (Rivest Shamir Adleman) and DSA (Digital Signature Algorithm).

Server A generates a private/public key pair
Server A sends the public key to client C
Client C encrypts a message using Server A’s public key and sends it over to Server A.
Now only Server A can decrypt the message because only it has the private secret key.

The public keys needs to be very large to be really secure since they are distributed to everyone over the pubic insecure networks. To process these large keys both client and server resources have a high utilization so it is not always practical to use this structure. therefor many deployments today use a combination of both Secret key and public key cryptography.

This is a sample of of things can work in an hybrid approach utilizing both secret key and public key approach.

1. Server- “S” generates a pair of private and public keys
2. “S” then sends the public key to client “C”
3. “C” then generates a random number  message and encrypts it using the public key of “S”, and it sends this to “S”.
4. “S” decrypts the message using its private key and uses this random number to generate a Symmetric key for data encryption and decryption.
5. Next all two-way communication between “S” and “C” takes place using this secret symmetric key, which is based on the random number generated by “C”.

Using Certificates
Certificates are used on the servers to guard the identity of the clients and prevent clients from being connected to any malicious server which poses  it self as the legitimate server.

A malicious server on the public insecure network can pose itself as a legitimate server for a resource and generate a its own private and public keys and then distribute the public key to the clients. The clients unaware of this malicious server and believing this to be a legitimate server can connect to it and become a target of confidential information theft.
To prevent this identity theft,  certificates are available to verify the authenticity of the public key owners.

The Certificate Authority (CA) generates a certificate to avoid a possibility of a malicious third party server posing as a real server and clients connecting to it.

1. When the Server generates the Private and Public keys pair, it also generates a Certificate Signing Request (CSR) which contains the public key and other information proving the identity of the originator.
2. The CSR is then sent to the CA manually or via web.
3. The CA verifies the CSR with Registration Authority (RA). If RA verifies and approves the request, then the CA will sign the CSR to vouch for the server that generated the CSR.
4. The CA will then issue a certificate for public use which includes an expiration time of the certificate.
5. The Certificate is then installed on the server.
6. When a client accesses the server, the server sends the certificate to the client, so client can verify the public key actually belongs to the server.

Below is the process which client “C” and server “S” use with the CA signed certificates to verify the authenticity of the legitimate server and to exchange the confidential information using symmetric keys

1. “C” downloads the CA-signed certificate from “S”
2. Then “C” runs the same hash function that the CA ran on the certificate contents during the signing process
3. “C” decrypts the CA’s signature using the CA’s public key and compares its hash to that of the CA, if the two hash values have to match.
4. If the two hash values matched, then “C” extracts the public key of “S” from the certificate
5. Now “C” generates a random number and encrypts it with the public key of “S” and sends it over to “S”. “C” also generates the symmetric key at this time.
6. “S” decrypts the random number sent by “C” using its own private key and it also generate a symmetric key.
7. Now that both “C” and “S” have a symmetric key generated, they exchange their confidential information over public insecure networks using the symmetric secret keys.

SSL – Secure Socket Layer

SSL is a PKI protocol that applications like HTTP, SMTP and FTP use for data integrity and data confidentiality. SSL uses Symmetric key encryption to encrypt packets and appends a Message Authentication Code (MAC) to the SSL packet header. MAC helps ensure the data integrity. From the OSI Reference model perspective SSL lives in the Session layer

SSL is further subdivided into two sub-layers
1. SSL handshake layer
2. SSL Record layer

SSL Handshake Layer
SSL Handshake negotiates session information between the client and the Server, the session information contains
1. Shared Secret: Is a random number used to create symmetric keys for encrypting data.
2. Session Identifier: Is used to identify an SSL session
3. Certificates:  Certificates installed by Servers and Clients
4. Cipher Suite:  Uses protocols TLS or SSL. Asymmetric algorithm is used for key exchange and symmetric algorithm is used for data encryption. Also a hash algorithm used for data integrity (MD5 or SHA-1).

SSL Change Cipher Spec Protocol:
This is used by clients and servers during the full handshake to indicate each other to use the negotiated keys for the current session or to resume an idle session.

SSL Record Protocol: Does the data encryption using the shared secret established in handshake process
SSL Alert Protocol: Signals problems with SSL session and terminates the SSL connection.

SSL handshake:
SSL handshake is a four step process to start a new connection and a 3 step process to resume an idle session.

Step-1. Client Sends a Hello to the Server to initiate a Session which contains the SSL version number, random number and supported cipher suites
Step-2. Server Responds with Hello and its server certificate. If the Server certificate does not contain a public key then the Server key Exchange can contain a temporary key for the client to encrypt the master secret.
Step-3. The client now computes the master secret key using its random number and the random number received from the server hello. the client then encrypts the master secret with the Server’s public key located in the certificate. If there is not public key in the certificate then client uses the temporary key from server for the encryption. Client sends this back to Server so both parties now have the master  key which they use to derive symmetric key for further data encryption used by the record protocol
Step-4. Both Client and Server now send to each other a Change cipher Spec message and a Finish message. the record protocol from now on performs data encryption using the symmetric keys.

Below are Some common HTTP Return codes from the Server which indicate the status of the client -Server HTTP transaction, like any code returned with 4xx indicates the client error and any starting with 5xx indicate the error on the server side.

Some Common HTTP Return Codes

1xx :     Informational
100:     Continue
101:    Switching Protocols

2xx:     Successful
200:    OK
201:    Created
202:    Accepted
203:    Non-Authoritative Information
204:    No Content
205:    Reset Content
206:    Partial Content

3xx:    Redirection
300:    Multiple Choices
301:    Moved Permanently
302:    Found
303:    See Other
304:    Not Modified
305:    Use Proxy

4xx:    Client Error
400:    Bad Request
401:    Unauthorized
402:    Payment Required
403:    Forbidden
404:    Not Found
405:    Method Not Allowed
406:    Not Acceptable
407:    Proxy Authentication Required
408:    Request Timeout
409:    Conflict
410:    Gone
411:    Length Required
412:    Precondition Failed
413:    Request Entity Too Large
414:    Request URI Too Long
415:    Unsupported Media Type
416:    Requested Range Not Satisfiable
417:    Expectation Failed

5xx:    Server Error
500:    Internal Server Error
501:    Not Implemented
502:    Bad gateway
503:     Service Unavailable
504:    Gateway Timeout
505:    HTTP Version Not Supported

15Jul/110

Configuring Cisco router as a DHCP client

A Cisco router interface can be configured to obtain an IP Address from DHCP server.

Router(config-if)# ip address dhcp

Once I was configuring a router via console which I had to replace with the current production router in the site over the weekend. It was a broadcast network; I had to connect the router to the LAN to pull the standard IOS image from the TFTP server. I didn’t want to get a static IP assigned to the interface – it takes time to get an unused static IP – so I configured one unused interface on the router to be a DHCP client and connected to the network to gain access to the TFTP server temporarily.

Well, the router got an IP address assigned; I could reach the TFTP server and was loading the image. While the image was loading, I started getting alerts stating that DHCP server is not reachable. What? It can’t be!! I just got an IP assigned from the server. Soon helpdesk started receiving complaints that users are not getting IP assigned by DHCP server. It seems like I was the last one to get an IP address from the server. No one is able to reach the server after.

I too couldn’t ping the server. When I did a traceroute it was not taking the default gateway instead it was dropping at the first-hop which seems to be an IP address that doesn’t belongs to any device. Wait a second….. Is it not the IP that the new router been assigned just now? Yes it is!! How could this happen?

When I checked the routing table on the new router, I could see a /32 entry for the DHCP server address in it.

 S*    0.0.0.0/0 [254/0] via 10.31.34.1

      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks

S        10.31.13.214/32 [254/0] via 10.31.34.1, FastEthernet0/0

C        10.31.34.0/23 is directly connected, FastEthernet0/0

L        10.31.34.182/32 is directly connected, FastEthernet0/0

When a Cisco router gets an IP address assigned to an interface by a DHCP server, it installs a static host route (/32) for the DHCP server (10.31.13.214) pointing it to the exiting interface. To make things worse, I already configured the router which had EIGRP and “redistribute static” statement in it. The new router formed an EIGRP neighborship with the existing site router and distributed the host route of the DHCP server to the entire network. This attracted all the traffic for DHCP server towards the new router black holing the DHCP server.

I can imagine why Cisco wanted to do this; they always wanted the router to prefer the interface via which the IP address was assigned to reach the server if you configure more than one interface on the same router to be a DHCP client.

 

Tagged as: , No Comments
4Jun/110

QoS Congestion Avoidance

Tail Drop

Tail Drop is when the packets are dropped when they arrive on a congested interface.Tail Drop is not just bad for voice packets but for data packets as well. It also impacts the efficiency of network bandwidth utilization. When the Output Queue is full and packets  arrive in on the Input Queue, then the packets which are arriving on the interface will be dropped. It does not matter if its a voice packet or a data packet, everything will be dropped by default when Tail Drop is in action. TCP has a mechanism where it can identify the packet loss and send those packets again.  TCP Senders will start sending packets, and they will increase the rate at which they send packets when there is no congestion and no packet loss. The increase is exponential over a time interval. When packets are being dropped, they sense that network is congested and then TCP Slow start kicks in, the sending rate is  suddenly dropped by a big margin until there is no more packet loss and again the sending rate picks up slowly after certain time interval where TCP does not see any packet loss.

When TCP Slow Start kicks in, all senders on the network back off and you can see a drop in the bandwidth, then slowly everyone starts sending packets at higher rate as they see no more packet loss, so all senders on the network start sending the packets again at higher rate and you see peaks in the network bandwidth.  At this time the interfaces can get congested again and packets can be dropped, which then makes all senders to drop their sending rate and wait for certain time interval where they see no more packet loss, this leads TCP Senders to again increase the sending rate. This goes on in cycles and this behavior  means a lot of bandwidth is just getting wasted. If you are monitoring the bandwidth with a graph, you will something like below graph in  the utilization charts. This behavior is also called as “Global TCP Synchronization” and it is responsible for a lot of network bandwidth wastage.

Tail Drop is the default congestion avoidance mechanism. More efficient congestion avoidance techniques can be configured on Cisco routers which are
1. RED – Random Early Detection
2. WRED – Weighted Random Early Detection

Congestion avoidance techniques basically monitor the network traffic and analyze the bandwidth loads, then they anticipate and avoid congestion at common network bottle-necks by dropping packets in advance.

Random Early Detection (RED)

With RED, the packets are discarded randomly before the Queue gets full, and increase the random drop rate when the queue is getting full. With RED implementation the problem of global TCP Synchronization can be effectively avoided.

RED Terminology

1.Minimum Threshold:
Is the point where the average queue hits or goes over this threshold value and random packet dropping starts.

2. Maximum Threshold:
Is the point where tail drop behavior comes into action.

3. Mark Probability Denominator:
Is the fraction of packets to be randomly dropped. That is how many packets to be dropped.

Weighted Random Early Detection (WRED)
WRED is Cisco implementation of RED. Cisco does not do the random dropping using RED algorithm, instead it used its own WRED.
All WRED does is to make sure that important packet does not get dropped in the random dropping process, instead a not so important packet is dropped.
With WRED multiple RED profiles are automatically created by the router based on IP Precedence or DSCP. If you decide that WRED is based on IPP then router will generate 8 different profiles for the dropping decision. If you decide to use DSCP then the router will create 64 different profiles for the dropping decision.

WRED Profile consists of :
1. Minimum Threshold: Is the point where random packet dropping starts
2. Maximum Threshold : Is the point where tail drop behavior comes into action.
3. Drop Probability: Determines how many packets to be dropped.

All these three values are calculated for each of  the profile – which is 8 profiles when IPP is used and 64profiles when DSCP is used.
By Default:
1. EF will get a very high minimum threshold.
2. AF Classes get their minimum thresholds as per their Drop Priorities.
These values can also be set manually.

Command to Configure WRED
# random-detect

Class Based WRED (CB-WRED)
When CB-WRED is used in conjuction with CBWFQ, it allows DiffServ Assured Forwarding Per Hop Behavior.

Configuration of CB-WRED
under policy-map (MQC)
# random-detect ! –> This will give the IPP based WRED by default

To give DSCP based CB-WRED
# random-detect dscp-based

To modify the thresholds
# random-detect precedence <precedencevalue> <min-threshold> <max-threshold> <mark-probability>
# random-detect dscp <dscpvalue> <min-threshold> <max-threshold> <drop-probability>

Explicit Congestion Notification (ECN )
DSCP uses 6 bits of ToS Byte in IP header, and the last 2 bits are used for ECN.
ECN marks the packets when the average queue length exceeds a specified value and the Routers and the end hosts can lower the sending rates based on ECN. But all routers and the end hosts in the network must support this feature to work.

ECN-Bits:     Description:
00                  Not ECN Capable
01                   ECN Capable
10                   ECN Capable
11                    Indicates Congestion

If the average queue length is between minimum threshold and maximum threshold then ECN bits are marked and ECN process begins. If end-points (routers and hosts) are not ECN capable then packets may be dropped

Configuration
Under Policy-map
# random-detect ecn

To allows for bursts
Exponential Weighting Constant is the value which determines the burst rate. You can control the WRED sensitivity to bursts.

Command: # random-detect exponential-weighting-constant <N>

By Default the value of N is 9
Lower Values of N – long bursts that is WRED will be more burst sensitive and can cause more packet loss.
Higher Values of N – allows for short bursts

Note:
1. If the value of n gets too low, WRED will overreact to temporary traffic bursts and drop traffic unnecessarily.
2. If the value of n gets too high, WRED will not react to congestion. Packets will be sent or dropped as if WRED were not in effect.

Monitoring CB-WRED
# show policy-map interface

3Jun/113

CBWFQ and LLQ

Class Based Weighted Fair Queueing – CBWFQ

CBWFQ is a modern congestion management technique and it is not advised for Voice and Video traffic, since both of them need strict priorities.  CBWFQ uses the Cisco MQC command structure. With CBWFQ you can define traffic classes and assign guaranteed amount of  minimum bandwidth, these classes can get more bandwidth if its available, but they always get the minimum bandwidth assigned to them.

CBWFQ will be used with Low Latency Queuing (LLQ) to deploy voice and video traffic to give strict priorities.

In the Software Queue there is a WFQ Scheduler, and you define the traffic classes using the class-maps where each traffic class (Queue) will get its minimum guaranteed bandwidth. However within each of this Queue  the packets are forwarded using the FIFO approach. There is also a Class-Default which is the default class, this class has any traffic which does not fall into any of the user defined classes. Within this Default Class Queue you can do FIFO approach or  WFQ. Dropping at the end of Queue the default action is tail drop, but it can be configured to WRED.

In CBWFQ the weights are defined as Bandwidth Reservation. Bandwidth Reservation can be defined as one of the following approaches:
1. In Kbps
2. Percentage of Bandwidth
3. Percentage of remaining Bandwidth.
Available Bandwidth Calculation
Available Bandwidth = Bandwidth * Max_Reserve – SUM(All Fixed guarantees)

Max_Reserv is the Maximum Reservable Bandwidth.
The Max_Reserve is always 75% of the interface bandwidth but this can be changed by the command max-reserved-bandwidth

Note: You need to be consistent in what approach you take to assign bandwidth- you cannot mix the approaches for reserving bandwidths. That is if you use Kbps you have to use Kbps consistently across all traffic classes and same goes for percentage.

Configuration
In Policy map structure use the bandwidth command with Kbps or percentage or remaining bandwidth, optionally you can also specify the queue size with queue-limit command.

bandwidth { bandwidth-kbps | remaining percentage | percentage }
queue-limit <limit>

Class-Default
This class gets WFQ treatment by default. If you use the bandwidth command in the class-default then it will no longer do the WFQ, but FIFO within this class (queue)

Monitoring CBWFQ
# show policy-map interface

Example:
1. Define Class Maps
class-map http
match protocol http
class-map telnet
match protocol telnet

2. Define Policy Maps
policy-map Example
class http
bandwidth 2000
class telnet
bandwidth 500
class class-default
bandwidth 1000

3. Apply to the Interface:
interface S0/0/0
service-policy output Example

Low Latency Queuing (LLQ)

This is a modern congestion management technique, which is extending CBWFQ to support Voice and Video or mission critical traffic.

LLQ is  adding Priority Queueing to the CBWFQ. The Priority Queue is used only for Voice / Video or mission critical traffic, without having the Queue Starvation for other Queues.  The starvation is avoided using the policing, the traffic  in Priority Queue is policed and the Queue can get to whatever the bandwidth it was assigned. It can however go over the assigned bandwidth if there is no congestion. The strict policing applies only in times of congestion and that too to the traffic in the Priority Queue so it does not starve other queues.

The mission critical traffic gets the bandwidth it is assigned and other queues get what ever minimum  bandwidth they were assigned, plus if there is no congestion all the queues can go over their assigned bandwidth if needed.

The  Voice traffic is handled by the PQ Scheduler and the remaining traffic is handled by the WFQ handler. The policed bandwidth for traffic in PQ is only during the time of congestion, if there is no congestion then the traffic in PQ (typically voice) can go over the bandwidth assigned to it.

Configuration:
Use the priority command instead of the bandwidth keyword in the policy-map.

Priority can be assigned in any of these two approaches
priority <bandwidth> [burst]
priority percent <percentage> [burst]

Note: There is going to be only one priority Queue with LLQ which is a policed bandwidth amount.

Example:
1. Define Class Maps
class-map http
match protocol http
class-map telnet
match protocol telnet
class-map match-any voice
match protocol rtp
match ip dscp ef
class-map voice-signalling
match ip dscp cs3

2. Define Policy Maps
policy-map Example1
class http
bandwidth percent 20

class telnet
bandwidth percent 10

class voice-signalling
bandwidth percent 5

class voice
priority percent 50

class class-default
fair-queue

3. Apply to the Interface:
interface S0/0/0
service-policy output Example1

 


3Jun/113

Custom Queuing and Priority Queuing

Custom Queuing (CQ)
This is a Legacy technology for Congestion management.
There are no dynamic Queues generated in CQ, instead you have to manually define the Queues. A maximum of 16 Queues can be defined and System Queue is Queue – 0 which is used for Layer-2 keepalives and routing protocols traffic.

Each Queue has to be assigned a byte counter, the default is 1500-Byte Counter. Each Queue will service this 1500-Bytes by default and then move on to next Queue in a deficit round robin fashion. If you define a custom byte-counter value then that many bytes will be serviced before moving on to next queue in the deficit round-robin fashion.

Configuration Examples

Commands Structure to Follow:
1. Define
queue-list <local-number> protocol <protocol> <Queue-#> list <Access-list #>
queue-list <local-number> queue <Queue-#> limit <Number of Packets>
OR
queue-list <local-number> queue <Queue-#> byte-count <packet size count>

2. Apply on interface
interface x/y
custom-queue-list <local-number>

Example
queue-list 1 protocol ip 1 list 10
queue-list 1 protocol ip 2 list 20
queue-list 1 default 10
queue-list 1 queue 1 limit 25
queue-list 1 queue 2 byte-count 1024

interface S0/0/0
custom-queue-list 1

Priority Queuing (PQ)
PQ is a legacy congestion management technique was designed for the Voice Traffic.

In PQ there are only 4 Queues
1. High Queue
2. Medium Queue
3. Normal Queue
4. Low Queue

How PQ algorithm works
All these Queues are serviced in the order of priority. First packets to get serviced are the packets in the HIGH Queue, when HIGH Queue is empty the next Queue to get serviced is the MEDIUM Queue, and when it gets empty NORMAL Queue gets serviced and in the end when NORMAL Queue gets empty the packets in LOW Queue get serviced. But this is not a round robin Queue Service as when the device is serving NORMAL Queue and packets arrive in HIGH Queue then Servicing of NORMAL Queue is halted and HIGH Queue is serviced first. This behavior applies to all Queues where the higher priority Queue is always serviced first, and lower priority queue gets halted to service any packets showing up in higher priority queues. This can cause resource starvation to lower priority queue traffic.

Configuring PQ

1. Configuration Based on Protocol Type
# priority-list <list-number> protocol <protocol-name> {high | medium | normal | low} <queue-keyword> <queue-value>

2. Configuration Based on Ingress Interface
# priority-list <list-number> interface <interface-type/number> {high | medium |normal | low}

3. Setting Default Queue Configuration For all other traffic
# priority-list <list-number> default {high | medium | normal | low}

Assign it to Interface
# interface X
# priority-group <list-number>

Assigning the size of Queues
# priority-list <list-number> queue-limit [ high-limit [ medium-limit [ normal-limit [ low-limit ]]]]

Example:
priority-list 1 protocol ip high list 10
priority-list 1 protocol ip medium list 20
priority-list 1 protocol ip normal tcp 80
priority-list 1 default low
priority-list 1queue-limit 30 60 90 100

interface Se0/0/0
priority-group 1