okay so I want to talk through in a lot
more detail exactly how we can send
information from host a over here to
host B over here this process is really
important so I want to get really
detailed and walk through this
step-by-step so in the last video you
know we talked about how we can't just
send the ethernet frame from host a with
host B's MAC address as the destination
so we can't just say our destination MAC
is going to be we'll just use the last
last bit here eight six ad we can't just
send it to this destination MAC address
because then it's only going to be sent
on this Ethernet here from host a and
it's only going to go it's only going to
be seen by these computers that are
connected here it's not going to get
forwarded over here so instead what
we're going to do is we're going to use
IP addresses so the destination IP
address is going to be host B's IP
address which is one ninety two dot one
sixty eight dot twenty two and then we
can also set the source address of the
frame that or of the IP packet that host
a is sending to be one ninety two dot
one sixty eight dot 9.2 which is host
beads excuse me which is host A's IP
address and then this so the actual
frame that gets sent here is going to
have this IP packet inside it with this
source and destination IP address going
from 9.2 to twenty-two but the IP packet
is going to be inside of an Ethernet
frame because this is still an Ethernet
network so we still need to have a
source and destination MAC address in
our Ethernet header remember if we look
at our Ethernet frame format we've got
the preamble and then we have this
destination address source address and
this destination and source address
these are Ethernet addresses and then
the ether type will tell us that the
payload is an IP packet and so the IP
addresses are going to be somewhere in
this payload but we still need to figure
out what these are so the source address
is pretty simple we're sending from host
a so it's going to be host a x' MAC
address which ends with the to C to D so
the source address here is going to be
to C to D and whatever comes before that
but the destination we can't use host
B's
we have to use something on this network
so the sort of obvious choice is we will
we want the San Francisco router here to
forward it so we should use San
Francisco's MAC address as the
destination and in fact that's what we
do so the destination address is going
to be this a e95 so this is going to be
a e95 but the question is how does that
actually get set how does host a know
that San Francisco is the right place to
send as Ethernet frame so I understand
this a little bit better let's take a
look at how host a is actually
configured and so I've set my computer
up in the same way and so here are the
settings in my computer here and so this
is for my Ethernet link on my computer
so my IP address is set to 192 168 9.2
so that's the same as host a here and
then I've set there's two other things
that you set when you set up an IP
address computer and that is a subnet
mask which in this case is 255.255.255.0
and what this essentially is saying is
this is this is kind of telling us what
prefix of IP addresses is shared by this
Ethernet network and the way it tells us
that is that if we convert this to
binary 255 if you convert 255 to binary
it's just a string of ones it's eight
ones and so if we have three of these
strings of eight ones together that's 24
ones followed by some zeros so if we
convert this whole thing to binary we
get 24 ones followed by eight zeros and
the 24 ones is the key part there
because what this is saying is this is
basically saying the same thing as if we
have a prefix if you remember from the
last video of one ninety two dot one
sixty eight dot nine with a prefix
length of 24 so if we go back here this
subnet mask with 24 ones is just another
way of saying that the prefix length is
the slash 24 and so what this says is
that everything connected to this
Ethernet network has this prefix IP
address of 192 dot 168 nine dots
something so that's great so we know
from host a if we want to go to one
ninety two dot one sixty eight dot nine
dot something then it's going to be
connected to this Ethernet network
where that were directly connected to
but what if we want to go somewhere else
what if we want to go to 192 168 22 for
example so for anything else we have
this router IP address configured which
is 192 dot 168 9.1 and that is the IP
address of this routers San Francisco
routers interface and so what this is
saying is if it's not on this subnet if
it's not 192 dot 168 at nine dots
something that matches this IP and this
prefix then send it to this router so
again that's great but how do we
actually send it to that router we have
the IP address we know that we want to
send it to this 9.1 but we need to know
how to how to get it to that MAC address
and so there's actually a specific
protocol that you can use to send a
broadcast to everybody on the ethernet
network asking who owns this IP address
so I could send from host a I could send
a broadcast saying like hey everybody on
this Ethernet network if any of you are
are the owner of 9.1
respond to me and tell me what your MAC
address is and the protocol that we use
to do that is called address resolution
protocol and this down here is the
actual format of that of that address
resolution protocol and so what we would
actually send from host a to find out
the MAC address of the san francisco
router is we'd send an ethernet frame to
a broadcast address so the destination
address of this Ethernet frame is going
to be the broadcast address which is
just all F's or all ones if you convert
to binary the source address then is
going to be the source address of
computer a which is this whatever - C -
D
and I'm just going to abbreviate that so
I have to write the whole thing out then
the ether type is going to be the ether
type that the ether type again describes
what is in the payload and so what's in
the payload is this ARP request and so
the payload is actually going to be this
whole thing here so if we look at what's
in the payload that's this and this is
this is this whole thing is called ARP
ARP which is the address resolution
protocol
and so the ethertype here is going to is
going to tell us that that the payload
is is this format and so there's a
special code for that which is zero
eight zero six and so when we see the
zero eight zero six then we know that
the payload is going to be this art
format and so there's a bunch of things
in this art frame and I'll go through
them kind of quickly because it's
actually not that complicated
so what ARP is doing is it's it's
providing it's this protocol that lets
us do a mapping between hardware
addresses and protocol addresses and so
the hardware address is the MAC address
for our Ethernet and the protocol
address is the IP address and so the
first thing that we say in the ARP frame
is we tell it the types of hardware
address and protocol address and so this
is almost always going to be the
hardware address is almost always going
to be 1 which means Ethernet and the
protocol address is always going to be
zero eight zero zero which means IP and
so we're going to map between Ethernet
and IP and then the hardware address
length is just the length of the
hardware address and for Ethernet is
always going to be six bytes and the
protocol address length is the length of
the address for IP and for IP that's
always going to be four bytes so these
things are always these values here the
next thing is the opcode and this is
going to be either one or two and one
means that this is a broadcasted
question that's being broadcast to the
entire unit network asking who owns a
particular IP address and then to is the
reply from someone saying I own that
particular address and here's my MAC
address and so the hardware address of
the sender is going to be whoever
sending the packet so there's actually
going to be two of these are frames
being sent one that's being sent from
host a so the hardware address of the
sender is going to be host a and then
the protocol address of the sender is
going to be 192 dot 168 9.2 and in the
hardware address that the target is
actually going to start out being all
zeros because host a doesn't know the
address yet and then the protocol
address of the target is going to be one
ninety two dot one sixty eight dot 9.1
and so by fill
all of this out host a can ask everyone
on the network and say hey whoever has
one ninety two dot one sixty eight dot
9.1 please respond and fill in your
hardware address and by the way I'm 192
168 9.2 and my address is whatever
whatever to C to D and so this is being
broadcast to everyone on the network
because the Ethernet destination is this
all FS or all one's broadcast address
and so the san francisco router is going
to see this and it's going to reply and
it's going to basically send another one
of these except it's going to send
opcode 2 and it's just going to swap
these so in this case when san francisco
replies it's hardware address is going
to be filled in it's protocol address in
this case it's going to be 9.1 the
hardware address are the target now it
knows is this
it'll fill that in it'll fill in the
protocol address of the target is 2 and
so that'll be the reply and so once
we're done with that whole process host
a has has been able to figure out the
appropriate destination MAC address that
it's going to send its Ethernet frames
to the contain the IP packet that are
going to this destination of 22