what does a router do? how to they communicate with one another?

We've looked at what it takes for 2 hosts directly connected to each other to communicate. And we've looked at what information technology takes for a host to speak to another host through a switch. Now nosotros add another network device every bit we look at what it takes for traffic to laissez passer from host to host through a Router.

This commodity will be the applied awarding of everything that was discussed when nosotros looked at a Router as a key player in Packet Traveling. It might be worth reviewing that section before proceeding.

We will start by looking at the two major Router Functions, then encounter them in action as we look at Router Operation.

To discuss our way through these concepts, we will use the post-obit image. We volition focus on R1, and what is required for it to forward packets from Host A, to Host B and Host C.

Router Operation

For simplicity, the MAC addresses of each NIC will be abbreviated to just iv hex digits.

Router Functions

Before we mentioned that a Router's main purpose is to facilitate advicebetwixt networks. As such, every router creates a purlieus between ii networks, and their main office is to forward packets from one network to the next.

Notice in the image above, we have R1 creating a purlieus between the 11.11.xi.x network and the 22.22.22.x network. And we have R2 creating a boundary between the 22.22.22.x and 33.33.33.x networks. Both of the routers have an interface in the 22.22.22.x network.

In order to forward packets between networks, a router must perform two functions: populate and maintain a Routing Table, and populate and maintain an ARP Table.

Populating a Routing Table

From the perspective of each Router, theRouting Table is the map of all networks in existence. The Routing Table starts empty, and is populated every bit the Router learns of new routes to each network.

There are multiple means a Router can learn the routes to each network. We volition discuss two of them in this department.

The simplest method is what is known as a Directly Connected route. Essentially, when a Router interface is configured with a particular IP accost, the Router will know the Network to which it is directly fastened.

For case, in the epitome above, R1's left interface is configured with the IP accost 11.11.11.1. This tells R1 the location of the 11.11.11.x network exists out its left interface. In the same way, R1 learns that the 22.22.22.x network is located on its right interface.

Of grade, a Router tin not be straight connected toevery network. Notice in the image above, R1 is not connected to 33.33.33.ten, but it is very likely information technology might have to one day frontward a parcel to that network. Therefore, in that location must be some other mode of learning networks, beyond merely what the router is direct connected to.

That other way is known equally aStatic Route. A Static Road is a route which is manually configured past an administrator. It would be as if you explicitly told R1 that the 33.33.33.x network exists backside R2, and to get to information technology, R1 has to ship packets to R2'south interface (configured with the IP address 22.22.22.ii).

Router Operation - Routing TableIn the end, afterwards R1 learned of the two Straight Connected routes, and after R1 was configured with the one Static Route, R1 would have a Routing Table that looked like this image.

The Routing Tabular array is populated with many Routes. Each Road contains a mapping of Networks to Interfaces or Adjacent-Hop addresses.

Every time a Router receives a packet, it will consult its Routing Table to make up one's mind how to forward the packet.

Over again, the Routing Table is a map of every network that exists (from the perspective of each router). If a router receives a packet destined to a network it does non have a route for, and so as far as that router is concerned, that network must not exist. Therefore, a router will discard a parcel if its destination is in a network non in the Routing Table.

Finally, in that location is a third method for learning routes known equally Dynamic Routing. This involves the routers detecting and speaking to ane some other automatically to inform each other of their known routes. There are various protocols that can be used for Dynamic Routing, each representing different strategies, simply alas their intricacies fall exterior the scope of this article series. They volition undoubtedly go a field of study for future articles.

That said, the Routing Table volition tell the router which IP address to forward the packet to next. But as we learned earlier, parcel commitment is always the chore of Layer two. And in club for the Router to create the L2 Header which will get the bundle to the next L3 address, the Router must maintain an ARP Tabular array.

Populating an ARP Table

The Address Resolution Protocol (ARP) is the bridge between Layer 3 and Layer 2. When provided with an IP address, ARP resolves the correlating MAC address. Devices employ ARP to populate an ARP Tabular array, or sometimes called an ARP Enshroud, which is a mapping of IP address to MAC addresses.

A router will use its Routing Table to make up one's mind the next IP accost which should receive a packet. If the Route indicates the destination exists on a direct connected network, then the "adjacent IP address" is the Destination IP address of the packet – the final hop for that bundle.

Either fashion, the Router will use a L2 header as the vessel to deliver the packet to the correct NIC.

Router Operation - ARP TableUnlike the Routing Tabular array, the ARP Table is populated 'as needed'. Which means in the image above, R1 will not initiate an ARP Asking for Host B'southward MAC address until it has a parcel which must be delivered to Host B.

But as nosotros discussed before, an ARP Table is only a mapping of IP addresses to MAC addresses. When R1'south ARP Table will be fully populated, it will wait similar this paradigm.

Once over again, for simplicity, the images in this article are but using four hex digits for the MAC addresses. In reality, a MAC address is 12 hex digits long. If its easier, yous can but repeat the iv-digit hex MAC accost iii times, giving R2's left interface a "existent" MAC accost of bb22.bb22.bb22.

Router Operation

With the understanding of how a Router populates its Routing Tabular array and how a Router intends to populate its ARP Table, nosotros can now look at how how these two tables are used practically for a Router to facilitate communication between networks.

In R1's Routing Table above, you can run across there are two type of routes: some that point to an Interface, and some that point to a Next-Hop IP address. Nosotros'll frame our give-and-take around a Router's operation around these two possibilities.

Just offset, we will hash out how Host A delivers the package to its Default Gateway (R1). Then nosotros will look at what R1 does with a packet sent from Host A to Host B, so another packet that was sent from Host A to Host C.

Host A getting the Packet to R1

Router Operation - Host to First HopIn both cases, Host A is communicating with two hosts on foreign networks. Therefore, Host A will need to become either parcel to its default gateway — R1.

Host A will create the L3 header with a Source IP address of 11.xi.11.77, and a Destination IP address of 22.22.22.88 (for Host B) or 33.33.33.99 (for Host C). This L3 header volition serve the purpose of getting the data from 'end to terminate'.

Just that L3 header won't be enough to evangelize the packet to R1. Something else will have to be used.

Host A volition so encapsulate the L3 header in a L2 header which will include a Source MAC address of aaaa.aaa.aaaa and a Destination MAC accost of aa11.aa11.aa11 — the MAC address which identifies R1's NIC. This L2 header will serve the purpose of delivering the parcel across the get-go hop.

Host A will take already been configured with its Default Gateway's IP address, and hopefully Host A will take already communicated with foreign hosts. As such, Host A more likely already had an ARP Table entry with R1'due south MAC address. Conversely, if this was Host A's first communication with a foreign host, forming the L2 header would take been preceded with an ARP Asking to discover R1's MAC accost.

At this indicate, R1 will have the packet. The Destination IP address of the package will either exist 22.22.22.88 for the communication sent to Host B, or 33.33.33.99 for the communication sent to Host C. Both of those destinations be in R1'southward Routing Table — the difference is one Route points to an Interface and the other Route points to a Side by side-Hop IP.

Routes pointing to an Interface

A Route in a Routing Tabular array that points to an Interface was typically learned because the Router was Directly Continued to the network. If a packet's Destination IP address is in a network which is directly connected to the router, the Router knows they are responsible for delivering the packet to its concluding hop.

The process is similar to what has been discussed before. The Router uses the L3 header data to determine where to send the packet next, then creates a L2 header to go information technology there. In this case, the side by side (and last) hop this packet must take is to the NIC on Host B.

Router Operation - Local Delivery

The L3 header will remain unchanged — it is identical to the L3 header created past Host A.

What is different, is the L2 header. Notice the Source MAC address is bb11.bb11.bb11 — R1's right interface MAC accost. The erstwhile L2 header which Host A had created to go the packet to R1 was stripped off, and a new L2 header was generated (by R1) to deliver it to the next NIC.

The Destination MAC address is, of course, bbbb.bbbb.bbbb — the MAC accost for Host B.

Routes pointing to a Adjacent-Hop accost

For the bundle from Host A sent to Host C, the Destination IP address volition exist 33.33.33.99. When R1 consults its Routing Tabular array, it will determine that the adjacent-hop for the 33.33.33.x network exists at the IP address 22.22.22.two — R2's left interface IP accost.

Finer, this tells R1 to utilise a L2 header which will become the packet to R2 in society to continue forwarding this package forth its fashion.

Since the current "hop" is between R1 and R2, their MAC addresses volition brand upwardly the Source and Destination MAC addresses:

Router Operation - Foreign Delivery

Once again, the L3 header remains unchanged, it includes the same Source and Destination IP addresses initially set past Host A — these addresses stand for the 2 "ends" of the communication. The L2 header, however, is completely regenerated at each hop.

Should R1 not have R2's MAC accost, information technology would but initiate an ARP Asking for the IP address in the road: 22.22.22.2. From then on, it will have no issues creating the proper L2 header which will get the packet from R1 to R2.

As the procedure continues, R2 volition finally receive the packet, and then be faced with the same state of affairs that R1 was in for the example above — deliver the packet to its final hop.

This process can exist continued as needed. Had Host A been trying to speak to Host X which had 10 routers in the path, the procedure would have been identical. Each transit Router in the path would have a Route mapping Host X's network to the next-hop IP in the path. Until the final router which would be directly connected to the network Host Ten resided in. And that final router would be responsible for delivering the packet to its terminal hop — Host X itself.

bordenjuste1979.blogspot.com

Source: https://www.practicalnetworking.net/series/packet-traveling/host-to-host-through-a-router/

0 Response to "what does a router do? how to they communicate with one another?"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel