When we send traffic across the internet,
that packet is stopping at every router along the way
and asking for directions.
The directions on where that packet should go
are contained within a routing table.
Every router has a list of directions,
and when a packet is inbound, the router
evaluates the destination IP address,
and then determines what the best
route might be based on this predetermined list of routes.
The packet then makes its way to the next router,
and that router performs the same lookups
to its routing table, and determines
where its next route might be.
Any device that needs to make a decision on where traffic goes
has a routing table.
This means that our routers have routing tables,
our workstations have routing tables,
and anything else that makes this forwarding decision
has to have a list that it can reference to find out where it
should be sending this traffic.
When these frames traverse a router,
we refer to that as a hop.
Whenever we talk about what the next hop might
be for a particular piece of traffic,
we're referring to what router this traffic is going to.
Whenever we hit that destination router or destination gateway,
that is the next hop in the communication.
If you look at the routing table within a single router,
that router doesn't have to know the entire path from point A
to point B. It only has to know what the next hop will be
to get that packet on its way.
You'll find that there are routes listed in the routing
table that are specific to the locally-connected interfaces,
but very often there can be a default route--
that would be once you go through every possible option
and none of those match the destination,
use this particular link as the default.
As you can imagine, when there are many different routers
and many different configurations,
sometimes you can create a loop-- that
would be where router A says to send the traffic to router B,
router B says to send the traffic to router A,
and then the process keeps repeating over and over again.
In order to identify and resolve this type of loop,
IP version 4 has a mechanism called "time to live."
There's a counter inside of the IPv4 packet,
and every time it hits a router, that number decreases by one.
Once that number gets to zero, the packet
is discarded by the router.
There's a similar function within IPv6
called a "hop limit."
So although we might accidentally configure a router
to create a routing loop, we can count on the time to live
and a hop limit to discard that traffic,
rather than constantly having it cycle through the network
around in a circle indefinitely.
When you're configuring a router,
you may be setting it up for a dynamic routing protocol,
so the router determines what the best routes might be,
or you might be configuring this manually, with static routes,
and you would configure and tell the router where
the destination should be.
Every router needs to be configured
with some type of routing table, so
that any inbound communication knows
where to go as its next hop.
A router that's not configured properly
or has an incorrect next hop will end up
sending traffic down the wrong part of the network,
or it may create a routing loop where traffic simply
bounces back and forth until it's discarded by the router.
As you can imagine, it would not be
possible to configure a single router
with every possible destination in the world of where traffic
might go.
In order to simplify these routing tables,
you would commonly add a default route.
This is a route that is used when
nothing else in the routing table happens to match,
and instead of simply dropping that packet because there's
no destination to that particular route,
you would instead send it out this default connection.
You might sometimes see this referred to
as a "gateway of last resort," and if you're
looking at a router that might be at a small remote site,
you might see that it only has a default route.
The default route would say that anything that's going into this
router should be sent out that connection to the internet,
which would go to the rest of the world and we commonly
define these default routes with a route of 0.0.0.0/0.
As you can imagine, adding a default route
can greatly simplify the configuration
of a routing table, especially if you're manually
configuring these routes.
So you might configure a dynamic routing protocol
inside of your router, but you might also add a default route
to cover any of the instances where a specific route can't
be found.
If you configure a dynamic routing protocol,
then it's really up to the protocol
to determine what the best route might be.
And different protocols have different ways
of making this determination.
If you were to configure a router with RIP version
2, OSPF, or EIGRP, you may notice
that there are differences between the routing tables
for each of those dynamic routing protocols.
The way that these routing protocols would grade or rank
these different routes is by using a metric.
Each routing protocol has its own method
of calculating metrics, so the metrics
you get with RIP version 2 are different than the metrics that
are calculated by OSPF and EIGRP.
These metrics are useful when you
run into things like redundant routes,
where there may be multiple ways to get from point A to point B.
By determining what the lowest metric is, the router can then
make a decision on what the best route might
be to that remote site.
Generally speaking, a metric that is the lower value
is the best one, so a metric of 1
is a better metric than a value of 2.
Let's look at a network diagram that has a computer,
it has a router and a second router.
And let's see what the differences
are in routing tables between all three of those devices.
Let's start down here with this laptop.
The IP address of this device is 192.168.1.22.
You can see that it's on a network of 192.168.1.0/24,
and it also has an interface on this router of 192.168.1.1.
The routing table of that laptop is shown here.
You can see that there are a number
of different destinations, the gateway that
would be used to send traffic to that destination, the interface
that traffic would exit on for that particular device,
and a metric value that determines how we would
rank those particular routes.
When the next route is being calculated,
the routing table is examined to determine what the most
specific route might be.
So if traffic was being sent to 192.168.1.1 from this laptop,
we would look at this routing table
and see which one of these connections
matches 192.168.1.1.
We can see that the default route of 0.0.0.0/0 is very
nonspecific, so that is certainly not the most specific
route.
We do have a loopback destination inside of this
device that's 127.0.0.1/8.
And then we have three more routes that are listed.
These are all part of this local network of 192.168.1.0.
If we're sending traffic to anything on our local network,
we might be sending traffic to ourself,
in which case we use 192.168.1.22/32,
which means that we're sending it to ourself,
because that is our IP address.
And there's also a broadcast address or broadcast
destination of 192.168.1.255, and that is also
sent out our local network to the rest of the local subnet.
Let's say that we were sending traffic
from this laptop to a location that's not specifically
listed in this routing table.
In this case, we would use our default route of 0.0.0.0/0,
because that particular destination matches anything
that's not specifically listed in our routing table.
To get to that destination, we would use a gateway address
or a next hop of 192.168.1.1.
So anything that's sent to that network
would be sent directly to this router interface, which
is 192.168.1.1.
To get to that particular gateway,
we need to send that traffic out our local interface
of 192.168.1.22, and that is indeed
the IP address on this laptop.
Now let's have a look at the routing table
that's on that local router.
You can see this router has two interfaces inside of it--
192.168.1.1 and a 10.1.10.14.
You can see that the 10.1.10.0 network is identified
with those routes, and the 192.168 routes
are listed as well.
This router also has a default route of 0.0.0.0/0,
and the gateway for that route is 10.1.10.1.
That is our default route and the next hop
for that default route, which is on this router up here,
of 10.1.10.1.
So traffic sent from this laptop would be sent to this router.
This router would then examine its local routing table
to determine where this traffic should go from there.
And if we were sending traffic out to the internet,
it would send all that traffic out
to the default route, which would send it
to the second router.
The second router has a similar set of routes.
You can see that there is a 10.1.10.1
interface, and a 74.208.221.234 address,
which is out on the internet side.
To send information to the 10. network, which
is locally connected to that router,
you can see those routes in the routing table.
You can also see the other locally connected network,
which is the 74.208.221.0 network.
You'll notice that this router also
has another route inside of it that's
specific-- it's the 192.168.1.0.
That's because there could be traffic inbound
from the internet that needs to reach this laptop,
but this particular router has no idea that this 192.168.1.0
network even exists.
We have to make sure that router has
an entry in its routing table that tells it if any traffic is
going down to that 192.168.1 network,
it needs to go to the next hop of 10.1.10.14, which is
the second router listed below.
We also, in this router, have a default route of 0.0.0.0/0,
and the gateway for this default route is a router
that's located on the internet service provider,
and its IP address is 74.208.221.1.
To be able to reach that particular next hop, which
is not specifically listed in our map,
we would send traffic out the interface of 74.208.221.234,
which is this external connection
on this final router.
When you're troubleshooting routing problems,
you have to go to every single device that
has a routing table, and examine what that routing table might
be to make sure that the flow of traffic
is going the direction that you would want.
For example, if you looked at this routing table and you saw
that the default route of 0.0.0.0/0 had a next hop
gateway of 74.208.221.5, based on the map we have here,
we don't exactly know what that next hop IP address happens
to be, because we're not in charge of the routers
at the internet service provider.
So if we're having problems communicating out
to the rest of the internet, we may
want to contact the ISP to confirm
that the gateway for that address
is configured properly in our routing table.
And if it isn't, we'll need to make changes
to this routing table that points that default
route to the proper gateway at the ISP.
You may find that there are routers on your network that
are using multiple dynamic routing
protocols to be able to build its routing table.
This is not unusual when you might have an internet router
where you might be using OSPF on the inside of your network,
and BGP on the outside of your network.
Since we're using two different routing protocols,
we're going to have completely different types of metrics
that help determine where the next hop might go.
And we can't compare the metrics across these different routing
protocols, because they use completely different algorithms
to be able to make these determinations.
So the question would be, which route
do we use when we have this type of conflict?
Fortunately, there is a tiebreaker.
This tiebreaker is an administrative distance.
This is used by the router to determine what routing protocol
has priority over another.
You can see a number of different routing sources here,
listed in our table, and you can see
the administrative distances for all of those.
For the purposes of the Network+,
it's not necessary to memorize these administrative distances,
but it's useful to see what the process might be when making
a determination of what source you would use.
For example, if it's a locally-connected route, which
means it's an interface that's plugged directly
into our router, then that is really the best hop
that you would use.
It has an administrative distance of 0.
If you were to manually configure a static route
inside of your router, that would
have an administrative distance of 1.
Any routes that use EIGRP to determine the route
have an administrative distance of 90.
OSPF has 110, RIP version 1 and version 2
have a 120 administrative distance,
a DHCP default route uses 254, and an unknown source,
which means it's not listed or one unknown by the router,
has an administrative distance of 255.
Obviously, the routes that are determined
using a source that has a very small administrative distance
has priority in the routing table.
It's not enough to know where the next hop might be.
We also have to set priorities over the type of traffic that's
going over our networks.
For example, we might have a Voice over IP phone,
we might have laptops and tablets and desktop computers,
and all of these need to be able to send and receive traffic
on the network.
The challenge is that there are different applications running
on all of these different systems,
and different applications have different priorities
depending on what the organization is
trying to accomplish.
For example, your Voice over IP phone or voice
communication is real-time, which
means it needs to have a very high priority on the network.
If you're looking at a streamed or offline video which
has buffering, there may be a smaller priority
associated with that.
And if you're doing any type of interactive communication
to a database, it might have the lowest priority.
Obviously, the determination on what
makes an application more important than others
is different depending on the organization.
It's up to the network administrators and the people
in charge of the applications to determine
how these applications should be prioritized
as they go across the network.
For example, if your organization
has a lot of telephone calls and you're
communicating with people constantly over the phone,
you may want to make sure that your Voice over IP
communication has a much higher priority than someone who may
be watching a YouTube video.
The method for prioritizing traffic on the network
is generically called traffic shaping.
You might see this also referred to as packet shaping.
This allows you to set priorities
for different applications based on how much bandwidth they may
be using, or the data rates that are used on the network,
and you could set different applications
to have a higher priority than others.
So for example, an IP phone may have the highest priority,
and you might have normal priority for a file transfer
or a mail communication.
We sometimes refer to this as configuring
the QoS, or the Quality of Service,
for the different applications.
And there are different ways to implement QoS.
You can implement Quality of Service inside of an operating
system, you can configure it inside of routers or switches.
Some firewalls and standalone QoS devices
can also be configured to prioritize traffic as it's
traversing those devices.