What is a router and how do they work ? - CCNA 200-301

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello everyone my name is rafael and welcome to network engineer pro in this video we're going to talk about routers how they function and what the role is inside of a network so let's get right into it a router can be a physical or virtual appliance that passes or routes information between two or more different computer networks when it comes to the osi model routers are associated with layer 3 which is the network layer a router is considered a gateway or a default gateway in its position where two or more networks meet a pc on network a needing to send traffic to network b will send it to its default gateway to get routed so let's take a windows pc for example you open the command prompt and you type in ipconfig the ip address inside the default gateway field is going to be the ip of an interface on a router let's look at this diagram really quick to help make more sense of it all right guys here's the topology and before we get started i just want to explain really quick about what's going on so if you look over here on the left we have pc1 pc1 has an ip 1.1.1.1 and a mac address of all a's that makes it a member of network 1.1.1.0 24. on the right-hand side we have pc2 pc2 has an ip 2.2.2.2 and a mac address of all these that makes it a member of network 2.2.2.0 24. each pc connects up to a switch pc1 connects to switch 1 pc2 connects to switch 2. each of these switches connect to a router router r1 and on the left we have interface e0 with ip 1.1.1.254 and a mac of all bs this ip or interface is going to be the default gateway for pc one on the right hand side we have interface e0 slash one interface e01 has an ip of 2.2.2.254 and a mac address of all c's and you guessed it it is the default gateway for pc2 now we want to see what happens when pc1 wants to send data over to pc2 now pc1 is ready to send some data it could be anything in http get a file um a picture it doesn't matter let's just say for simplicity a png now when pc1 builds this packet it's going to take the data and it's going to put an ip header and since we're using ipv4 we're going to put an ipv4 header and there's a lot of fields inside the ipv4 header like ttl and a lot of other things but for now to keep it simple we only care about the source and destination ip address the source ip is going to be the ip of pc1 which is 1.1.1.1 the destination ip is going to be the ip of pc2 so 2.2.2 now we're going to take our data and we're going to take our ip header and we're going to put it inside of an ethernet frame now there's a lot of fields inside the ethernet frame as well but for now all we care about are the source and destination mac address the source mac address is going to be the mac address of pc1 which in our case is a a a a now what about the destination mac address what's the destination mac address gonna be you're probably thinking it's gonna be the mac of pc2 but it's not now when a pc wants to send data to a network outside of its own to a completely different network it's going to send it to its default gateway so if there's any mac address that pc1 needs it's the mac address of its default gateway which we know is bbb but does pc1 know that mac address let's assume that it doesn't there's a process called arp very important process stands for the address resolution protocol pc1 needs an arp entry in its arp table that maps the ip of its default gateway 1.1.1.254 to mac address b b b to get this information we need to send an arp request an arp request is basically a broadcast message that gets sent out on the lan asking hey whoever has ip 1.1.1.254 please give me your mac address because i really really need it now like i said that message is a broadcast message so if you were to look at a packet capture the destination mac address in the ethernet frame is going to be all f's that means that when switch 1 gets the broadcast so it's going to go like this the broadcast messages is going to go up towards switch one switch one is going to flood it out of every single interface it has except the one it arrived on so if we had another pc here like pc3 pc3 would get the broadcast but it would realize it's not for him and drop it the broadcast is going to continue its way up to router 1. router 1 is going to get the broadcast and say oh snap i have ip 1.1.1.254. here's the mac address info you requested now router 1 is going to go ahead and send the mac address information in an arp reply directly over to pc1 and it's going to add the mac address and ip binding to its arp cache now by default arp caches on cisco routers are four hours so now that we have a valid arb entry now that we know that 1.1.1.254 maps to a mac address or a data link layer address of bbb we can finish building the frame now that we have that we can go ahead and put inside the destination mac address field b b b b great so now that everything here is properly built we can send it on the wire pc one is going to send it over to switch one switch one is going to get the ethernet frame and switches have mac address tables they learn mac addresses they do forwarding they do flooding i'll go into detail on how they do that exactly in another video but let's keep it simple for now just know that they build mac address tables now switch 1 is going to get the ethernet frame and it's going to look at its mac address table so we'll just call this mac table that's what switches do they learn mac addresses so all of these devices like pc1 and router 1 plugged into the switch when they start sending data the switch is going to record the mac address so the mac address of aaaa and it's going to say okay mac address aaa lives on ethernet04 so in the mac address table you're going to have entries like aaa out of interface e 0 4 mac address b b b b lives on ethernet 0 14. so when it so when switch one gets it it's going to look at the ethernet frame and it's going to see a destination mac address of all these it's going to look at its mac address table and say okay i know where bbb is it's on ethernet 014 it's going to send it right out of ethernet 014 now router 1 gets the message it it's going to look at the ethernet frame and it's going to say okay the destination mac address bbb that's me that's my interface let me look at it further it's going to look at the ip header inside the packet it's going to see that the destination ip address is 2.2.2.2 the first thing it's going to do is it's going to look at its ip addresses configured on on the interfaces and say do i have an interface configured with ip2.2.2.2 i don't so i need to route it i need to consult my routing table and see if i know about that network so a routing table is basically a a database of networks and a pointer so either an interface on where to send it or a next top ip so again router 1 is going to look at the destination ip address of 2.2.2.2 and say all right do i know about this network great yes i do i know about network 2.2.2.0 it's a directly connected network out of interface e01 so i have the two important pieces of information that i need i know about the network and i know where to send it great now something very important happens now this is going to be called frame rewrite so when router1 originally got the ethernet frame it had a source mac address of pc1 all a's and a destination mac address of its default gateway it's going to trash that it's going to rewrite it and the source mac address this time is going to be the egress interface on the router to get to this network so if we want to reach the 2.2.2.0 24 network we're going to use interface e01 so the mac address of interface e01 of all c's is going to be our new source mac address what's our destination mac address going to be well it's going to be the mac address of pc2 and how did router 1 know about the mac address of pc2 he arpped for it just like pc1 did in the beginning so router 1 has an arp cache in its arb cache says 2.2.2.2 maps to a mac address of dddd and because i have this information i can properly build the new ethernet frame so now now that everything's built it's going to send it out over to switch 2. switch 2 is going to get it switch 2 is going to do the same thing switch 1 did it's going to look at its mac address table switch 2 has been sitting here all day learning mac addresses it knows that pc2 is connected it knows that router once connected and it knows the mac address and what port to send it out of switch 2 is going to say all right i received an ethernet frame with a destination mac address of all these in my mac address table i have a entry saying that the mac address all these is connected to port e 0 4. it sends it out over to pc2 and everyone is happy now all these arp entries like i said these are cached now on cisco devices they're cached for four hours so the whole art process of broadcast of our arp requests and our replies that doesn't need to happen again now there are some details about how switches learn mac addresses and the floor forwarding and flooding of uh frames i'll go into that into a i'll go into detail on that in another video but i just wanted to keep it simple for the purpose of routing now over here is a snippet of a show ip route i actually have this entire topology set up in my lab so let's go ahead and look at the cli and let's do our first show command of the day show iprout all right so here's a topology that we've been working with the entire video so let's go ahead and execute our first show command show ip route now before i hit enter if i hit question mark i get the context sensitive help so if i only wanted to see connected routes or eigrp routes i could specify that which is really nice because some routers have hundreds of thousands of routes and if you only wanted to see what's important to you you can so let's just hit enter and look at everything so right now i only have connected routes so you can see here here's a list of networks you have um you have your connected routes you have your local routes local routes are created whenever you create an interface and give it an ip a local route gets created but let's say for example you were looking at the routing table and you forgot what l means you could look at the codes which is kind of like a legend and say okay capital l oh that means local routes or if you see a c the letter c you can look here and find okay where's c oh cool c is here c c means connected great so that's really cool so once we start talking about routing in detail and routing protocols we'll get more into this i'm going to show you guys how to read the entire routing table depending on what kind of routes are there so don't even worry it might look confusing now but it'll make sense soon okay so just to sum it up pc one sent a packet over to router one it arrived on the e0 interface of router one router one looked at the destination ip address of 2.2.2.2 discovered that it was not a configured interface on the router itself and determined it needed to be routed so based on that destination ip address of 2.2.2.2 router 1 looked at its routing table and said let me see if i have a route perfect i do here's the route right here it's directly connected right out of interface e01 i have the network i know exactly where to send it and it does this at lightning speed now routers can contain different types of routes such as connected routes static routes which you have to sit there and enter manually or even dynamic routes which are learned from dynamic routing protocols like ospf and eigrp and more alright so for this video and the next few i'm working on i wanted to keep them simple to help build a foundation so stay tuned because we'll go more into detail on things like analyzing ip headers and ethernet frames what a switch is what happens to a ttl as it goes from router to router then we take all that stuff and we put it together and we start doing the fun stuff like spanning tree configuring routing protocols breaking them and fixing them and so on alright everyone to sum up what we did today we covered what a router is how they work and even some hands on the cli using our show command show iprout i really hope you all enjoyed the video if you did don't forget to hit that subscribe button below because the next one is coming out soon also i'm going to be releasing a lot more content in the future like more videos webinars free courses protocol cheat sheets and more so if you want to stay up to date and be a part of that go to networkengineerpro.com which i put a link in the description of the video click get notified so you can get the newsletter and be the first to know what i'm working on and when it comes out that's all for now thanks everyone and i'll see you in the next video
Info
Channel: Network Engineer Pro
Views: 160
Rating: undefined out of 5
Keywords: cisco, networking, ccna, routers, routing, IT certification, 200-301 ccna, routers for beginners, routing table
Id: 6LoIfN_CwRQ
Channel Id: undefined
Length: 14min 25sec (865 seconds)
Published: Sun Sep 06 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.