As I mentioned before,
we have different ways of categorizing our traffic.
We can do it through classification,
marking,
utilizing congestion management,
congestion avoidance,
policing and shaping,
and link efficiency.
All these ways are ways for us
to help implement our quality of service
and take us from this to this.
Now, as you can see, we want to start shaping out
those peaks and valleys using these different mechanisms
to give us a better quality of service.
Now, when we look at the classification of traffic,
traffic is going to be placed into these different categories.
Now, this is going to be done
based on the type of traffic that it is.
There's email, but even inside of email,
we have many different classes of information
inside of an email.
If you think about email, we have POP3 traffic,
we have IMAP traffic,
we have SMTP traffic,
we have Exchange traffic.
Those are four different types right there.
And so we can look at the headers,
and we can look at the packet type of information,
and we can even use the ports that are being used,
and then we can determine what services
need higher or less priority.
We can then do this not just across email,
but across all of our traffic.
And by doing this, this classification
doesn't alter any bits in the frame itself or the packet.
Instead, there is no marking inside of there.
It's all based on the analysis of the packet itself.
The ports and the protocols used
and our switches and routers are going to implement QoS
based on that information.
Now, another way to do this is by marking that traffic.
With this, we're going to alter the bits within the frame.
Now, we can do this inside frames, cells, or packets,
depending on what networks we're using,
and this will indicate how we handle this piece of traffic.
Our network tools are going to make decisions
based on those markings.
If you look at the type of service header,
it's going to have a byte of information or 8 bits.
The first three of that 8 bits is the IP precedence.
The next six of that is going to be the DiffServ code point
or DSCP.
Now, you don't need to memorize how this type of service
is done inside the header,
but I do want you to remember,
one of the ways that we can do this quality service
is by marking and altering that traffic.
Next, we have congestion management.
and when a device receives traffic
faster than it can be transmitted,
it's going to end up buffering that extra traffic
until bandwidth becomes available.
This is known as queuing.
The queuing algorithm is going to empty the packets
in a specified sequence and amount.
These algorithms are going to use one of three mechanisms.
There is a weighted fair queuing,
there's a low-latency queuing,
or there is a weighted round-robin.
Now, let's look at this example I have here.
I have four categories of traffic:
traffic 1, 2, 3, and 4.
It really doesn't matter what kind of traffic it is.
For our example, right now,
we just need to know that there's four categories.
Now, if we're going to be using a weighted fair queuing,
how are we going to start emptying these piles of traffic?
Well, I'm going to take one from 1, one from 2,
one from 3, and one from 4.
Then I'm going to go back to 1 and 2 and 3 and 4
and we'll just keep taking turns.
Now, is that a good mechanism?
Well, maybe.
It depends on what your traffic is.
If column 1, for example, was representing VoIP traffic,
this actually isn't a very good mechanism
because it has us to keep waiting for our turn.
So instead, let's look at this low-latency queuing instead.
Based on our categories of 1, 2, 3, and 4,
we're going to assign priorities to them.
If 1 was a higher priority than 2,
then all of 1 would get emptied,
then all of 2 would get emptied,
and then all of 3 and then all of 4.
Now, this works well to prioritize things
like voice and video,
but if you're sitting in category 3 or 4,
you might start receiving a lot of timeouts
and drop packets because it's never going to be your turn
and you're just going to wait and wait and wait.
Now, the next one we have
is called the weighted round-robin,
and this is actually one of my favorites.
This is kind of a hybrid between the other two.
Now, with a weighted round-robin,
we might say that category 1 is VoIP
and category 2 is video.
Category 3 is web, and category 4 is email.
And so we might say that in the priority order,
1 is going to be highest.
And we're going to use a weighted round-robin
and we might say, "We're going to take three out of category 1,
two out of category 2, and then one out of 3
and one out of 4."
And we'll keep going around that way.
We'll take 3, 2, 1, 1, 3, 2, 1, 1,
and we keep going.
That way, VoIP traffic is getting a lot of priority.
Video is getting the second highest priority,
and then we start looking at web and email
at the bottom of the barrel,
but they're still getting a turn
every couple of rounds here,
and so that way, it becomes a weighted round-robin.
As I said, this is the quality of service mechanism
that I really like to implement inside my own networks.
Next, we have the idea of congestion avoidance.
As new packets keep arriving,
they can be discarded if the output queue
is already filled up.
Now, I like to think about this as a bucket.
As you can see here, I have a cylinder on the bottom,
and it has a minimum and a maximum.
Now, if it's already at maximum
and you try to put more into the bucket,
it just overflows over the top.
Now, to help prevent this, we have what's called the RED,
or random early detection.
This is used to prevent this overflow from happening for us.
As the queue starts approaching that maximum,
we have this possibility that discard is going to happen,
and so we start doing, is we start dropping traffic.
Instead of just dropping traffic randomly,
we're going to drop it based on priority
with the lowest traffic priority getting dropped first.
RED is going to drop packets from the selected queues
based on their defined limits.
Now, I might start dropping TCP traffic first
because I know it'll retransmit itself,
where UDP, if you drop it, it's gone forever,
and so I might keep that in my queue a little bit longer
so it doesn't get dropped.
Now, that's the idea here.
With TCP traffic, even if I drop it,
we're going to get that retransmission and we'll try again,
but with UDP, if it dropped,
you're never going to know about it
and you're going to have loss of service.
Now, when you're dealing with congestion avoidance,
we're going to try to use the buffer to our advantage
and be able to use it to help us get more bandwidth through.
Now, when we start putting all these things together,
we start getting into these two concepts
known as policing and shaping.
Policing is going to discard packets
that exceed the configured rate limit,
which we like to refer to as our speed limit.
Just like if you're driving down the highway too fast,
you're going to get pulled over by a cop
and you're going to get a ticket.
That's what policing is going to do for us.
Now, we're just going to go and drop you off the network
anytime you're going too fast.
So drop packets are going to result in retransmissions,
which then creates more bandwidth.
Therefore, policing is only good
for very high speed interfaces.
If you're using a dial-up modem or an ISDN connection
or even a T1, you probably don't want to use policing.
You're much better off using our second method,
which is known as shaping.
Now, what shaping is going to do for us
is it's going to allow the buffer
to delay traffic from exceeding the configured rate.
Instead of dropping those packets like we did in policing,
we're just going to hold them in our buffer.
Then, when it's empty and there's space available,
we're going to start pushing it over that empty space
and start shaping out the packets.
This is why we call it shaping or packet shaping.
Now, you can see what this looks like here on the screen.
I have traffic at the top,
and you'll see all those jagged lines going down.
Now, what really happens here in your network
is there's this high period of time
and there's low periods of time
because not everything is happening all the time
in an equal amount.
If we do policing, all we did was chop off the tops,
which gave us more retransmissions,
and with shaping instead,
we're going to start filling in from the bottom from our queue,
so it keeps up there right towards the speed limit
without going over it.
Again, shaping does a better job
of maximizing your bandwidth,
especially on slow speed interfaces like a T1 connection,
a dial-up, satellite connections, or ISDN.
The last thing we need to talk about here
is link efficiency.
Now, there's a couple of things we need to mention
in regard to link efficiency,
the first of which is compression.
To get the most out of your link,
you want to make it the most efficient possible,
and so to do that, we can compress our packets.
If we take our payloads and we compress it down,
that's going to conserve bandwidth because it's less ones
and zeros that need to go across the wire.
VoIP is a great thing that you can compress
because there is so much extra space
that's wasted inside of voice traffic.
VoIP payloads can actually be reduced
by up to 50% of their original space.
We could take it down from 40 bytes down to 20 bytes
by using compression.
If you think that's good, look at the VoIP header.
I can compress the VoIP header down from 90
or 95% of its original value.
I could take it from 40 bytes
down to just two to four bytes.
To do this, we use something called compressed RTP, or CRTP.
Now, when I have the original VoIP payload,
as you can see here, I have an IP address,
I have UDP as my packet type, and I have RTP for its header,
and then I have my voice payload.
I can compress all of that down into just an CRTP,
which consolidates the IP, the UDP,
and the RTP all together into one.
The voice payload can also be squeezed down
to about half of its size.
Now, you're not going to notice a big difference
in your audio quality either by doing this.
This can be utilized on slower speed links
to make the most of your limited bandwidth,
and it's not just for VoIP.
You can do this with other types of data too.
Compression is a great thing to use.
They have devices out there called WAN accelerators
that focus specifically on compressing your data
before sending it out your way in link.
The last thing I want to talk about here is what we call LFI,
which is another method
to make more efficient use of your links.
This is known as link fragmentation and interleaving.
Now, what this does is if you have a really big packet,
it'll start chopping those up
and take those big packets and fragment them,
and then interleave smaller packets in between them.
This way, it's going to allow you to utilize
those slower speed links
to make the most of your limited bandwidth.
Notice here I have three voice packets
and one big chunk of data.
Now, what the router would do is it's going to chop up
and put that one small voice piece
and then one small data piece,
and then one small voice piece and one small data piece.
That way the voice doesn't suffer from huge latency
by waiting for that big piece of data to go through first.
By doing this fragmentation and interleaving,
it allows you to get some of that high priority traffic out
in between those larger data structures as well.