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.
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
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
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