Routing fundamentals.
All right, we still haven't left our local area network yet.
Once we're ready to leave our network,
this is where routers
are really going to start coming into play.
When we start talking about
connecting to subnets within our network
or connecting our internal network
and an external network,
we have to use a router.
The first thing you must understand
is the function of a router,
which is to route traffic.
Now, I know that sounds kind of silly,
but essentially that's what it's going to do.
It's going to forward the traffic in one direction or another
between different subnets
or between an internal and external network
or between two different external networks.
Each subnet or external network
is going to be its own broadcast domain
because routers are used to separate broadcast domains.
Unlike switches, which are Layer 2 devices
and therefore can only maintain one broadcast domain
for everything that's connected to the switch,
the routers are going to be Layer 3 devices,
and they're used to separate and break apart
those broadcast domains into smaller portions
to provide additional efficiency and security
to your networks.
Now, before we go too far in this lesson,
it's important to note that there's a difference
between the real world and the exam.
In the real world,
you may often find yourself using a Layer 3 switch,
also known as a multilayer switch.
When you do this,
it can perform routing functions for you.
Many small-office, home-office networks
or small and medium-sized businesses
will often opt to use a Layer 3 switch
because it can handle both functions.
It can handle Layer 2 forwarding
when it's acting like a switch
and Layer 3 routing when it acts as a router.
For the exam though, remember,
if you're using a multilayer switch,
it is functioning as a router,
and so we're going to treat it as a router
or a Layer 3 device.
Now, in this entire section,
we're going to be referring to these devices as a router,
even if I'm using a multilayer switch in the real world.
Now for the exam, if they say switch,
they're talking about a standard Layer 2 switch.
If they say multilayer switch or router,
they're referring to Layer 3 functionality
of a device that we call a router.
So how does the basic router perform this work?
Well, let's consider this diagram here.
I have two networks,
one on the left side
and one on the right side of the screen.
As you can see,
PC1 is connected to our left network
and PC2 is connected to our right network.
Now, to connect these two networks together,
we have two routers in a serial connection
or wide area network connection between them.
This could be a fiber connection,
a serial connection, a satellite connection, a VPN,
or any other kind of link.
It really doesn't matter right now.
As long as you understand
that there is connectivity between these two routers
and they can communicate to each other
over that WAN connection,
that's all we need to know.
Now, if I'm sitting at PC1
and I want to send a message to PC2,
I can't just send it through ARP like I did with a switch.
If you remember back in switching,
we talked about how PC1
would send an ARP packet to the switch,
and if it didn't know where to deliver it,
it would send it out every single switch port
based on that MAC address.
Well, PC1 can and will still do that.
But what's going to happen here
is that our ARP request is going to go up to the switch
and the switch is going to realize
that it doesn't know the MAC address
associated with that request,
so it's going to forward it out its default gateway.
The default gateway is the router.
Now, that router is then going to respond to the ARP request
on behalf of the destination device.
At this point,
we're now going to have to leave MAC addresses behind
because MAC addresses only work internally in our network.
Once we get to the router,
we're going to switch to using IP addresses,
or logical addressing at Layer 3.
This is where we begin to make
our Layer 2 to Layer 3 transitions.
At this point, PC1 has determined the MAC address
for where the router is
because it needs to send the packet
to get out of this local area network
and leave to go find this device.
The left router in this case
wants to send the information to PC2
'cause that's what PC1 told it to do.
To do that,
it's going to pass the information over to Router 2,
and then Router 1 is going to get the data frame,
which is Layer 2, from PC1.
The router will repackage it up as a packet,
which is Layer 3,
and then add an IP header to it.
This allows Router 1
to then push the data over its default connection
as an IP packet,
and the data will then be sent across the serial connection
to get to Router 2.
All right, once that packet gets to Router 2,
Router 2 is going to strip off the IP header
and bring it back down to Layer 2 data frames
by adding a MAC address for PC2.
This way it's going to correlate PC2's MAC address
with the destination IP of the packet
because Router 2 knows who PC2 is,
it's on its network.
Now, since Router 2 knows the MAC address for PC2,
it can call it to PC2 directly over Layer 2
and send that data frame through the switch.
The switch is going to take that information
and push it from Router 2 down to PC2,
just as if the two of them were computers
sitting on the same switch trying to communicate locally.
When PC2 wants to send a response to PC1,
this process is going to be reversed,
and that way the communication can continue back and forth
between PC1, its switch, Router 1,
the WAN connection, Router 2, its switch, and PC2.
All right, so a quick summary
of what we just saw in terms of data flow.
We started out with Layer 2 pieces of information
called a data frame coming from PC1.
When it got to Router 1,
it got packaged up as a Layer 3 packet
to cross the wide area network.
When it got to Router 2,
it stripped it back down to Layer 2
to make it a data frame again,
using MAC addresses to deliver it to PC2
on its local network.
Essentially, this is how routing works.
Now at this point, it's pretty simple,
but it's going to get a lot more complicated
as we start to move packets across
not just a direct WAN link like this one,
but over the world's largest wide area network,
the internet.