So guys, next we will going to discuss some basics regarding L2 routing.
So router router means layer three, router.
Layer three router is a gateway to a subnet.
So here the word gateway means common point of entry and exit to and from the subnet routers.
Each local interface hosts a subnet.
So let us try to understand these two points.
You can see in this topology there is a L3 router and this L3 router has two interfaces.
Each interface is host a subnet.
So let's say this subnet is a and this subnet has a network ID 11 .1.1.0 slash 24 and the other interface
of this L3 router host A subnet B and the network ID of this subnet is ten .1.1.0 slash 24.
Now this L3 router is a common point of entry and exit of a traffic to and from this subnet.
Now this means that any packet generated by any machine present in the subnet A and if that packet is
destined to any machine which is outside the subnet A, then that particular packet has to pass through
the layer three router.
Similarly, any packet that is being received from outside the subnet A and is destined to any machine
which is present in subnet A, then that packet has to pass through the L3 router.
Right.
So whenever there is a communication between machines which are present in different subnet, then that
packet has to pass through the Gateway L3 router.
And also you can see that in this diagram, the layer three router has two interfaces and both the interfaces
are configured with the IP address and mask value.
You can derive the network ID from this IP address and mask value and you can see that interface on
the right hand side hosts a subnet A to which four machines are connected and the interface on the left
hand side hosts a subnet V two which.
Machine e is connected.
So each router's local interface actually hosts a subnet.
A machine present in one subnet cannot talk to any machine present in another subnet without l3 router.
So l3 router is like a matchmaker between the machines present in different subnets.
Machines present in different subnets can not talk to each other because you need a layer three router
as a bridge between two different subnets.
The purpose of layer three router is to route a traffic or data from one subnet to another.
Layer three routers are the boundaries of a subnet.
So you can see that for a subnet A we have a L3 router, which is actually a boundary for a subnet A
and for a subnet B Also this layer three router is a boundary.
So whenever the machines present in the subnet wants to send a traffic to a machine present in a different
subnet, then that traffic has to cross the boundary.
And that boundary is a layer three router which is connected directly to that subnet.
Now, Next, we will discuss the protocol identifier field.
Now, every header in the packet has to provide a mechanism to convey what is the next header following
the current header in the packet.
So let us take an example of how the packet is actually framed by the TCP IP stack.
So on the right hand side, you can see that I have drawn the layers of the TCP IP stack.
The topmost layer is the application layer, followed by transport layer, then network layer, then
data link layer, and finally the physical layer.
Now you can see on the left hand side.
Corresponding to each layer of the TCP IP stack.
I have listed the most famous protocol which operates at that particular layer of TCP IP stack.
For example, Ethernet protocol is a data link layer protocol.
Similarly, IPv4 and IPv6 are network layer protocols, and most famous transport layer protocols are
UDP and TCP protocols.
And for an application layer of the TCP IP stack, you can have any application headers.
For example, Http is an application layer protocol.
Now, if you analyze the headers of these most famous protocols, you will observe that there is one
piece of information in each of these headers which actually conveys the information regarding what
is the protocol operating in the next layer of the TCP IP stack.
So here you can see that in the Ethernet header there is a type field.
Now the value of this type field helps us to know that the next protocol, which is operating in the
network layer is actually IPV four protocol or IPV six protocol.
So if the value of the type field, for example, is 0800, it means that the next protocol which is
operating in the network layer is IPV four protocol.
And if the value of type field in the Ethernet header is 041, that is 41.
So the next protocol.
So the next protocol that is operating in the network layer is IPV six protocol.
Similarly, in the network layer headers, there is a field called protocol field.
The value of this protocol field determines that what is the transport layer protocol you are running?
So if the value of this protocol field is six, it means that the transport layer protocol is TCP protocol.
And if the value of this protocol field in the IPv4 or IPv6 header is 17, it means that the transport
layer protocol that is operating is a UDP protocol.
So these are actually standardized values to identify the protocol running in the next layer.
Similarly, if the transport layer protocol being used is either UDP or TCP, then the header of UDP
protocol or TCP protocol contains a field called port number.
Using this port number, the operating system identifies that which application actually is interested
in receiving a particular type of packet.
So, for example, you have an application one and this application is listening on port number, say
80.
Now, if the packet arrives on the machine and suppose the port number is specified in the UDP header
of the packet is 80, then operating system knows that this packet needs to be delivered to application
one.
So port number is actually the identifier of the application running in application layer of TCP IP
stack.
So to iterate once again, every header in the packet has to provide the mechanism to convey what is
the next header following the current header in the packet.