Router logic question
lincis_aus
Member Posts: 50 ■■■□□□□□□□
in CCNA & CCENT
Hey guys,
I have a question for you regarding L2 and L3 addressing and routing logic.
Look at the attached diagram (taken from Odoms official ICND1 guide).
I understand what is happening here, but no where have i read what happens when R1 passes data over to R2. Ok, he encapsulates the L3PDU with a L2H and L2T (HDLC or PPP), and then passes the data out to R2.
Now does the router just send the packet on not worrying about the destination address as the routing table told it to go through out S/0, or does it send the data based on HDLC/PPP addressing?
Cheers
I have a question for you regarding L2 and L3 addressing and routing logic.
Look at the attached diagram (taken from Odoms official ICND1 guide).
I understand what is happening here, but no where have i read what happens when R1 passes data over to R2. Ok, he encapsulates the L3PDU with a L2H and L2T (HDLC or PPP), and then passes the data out to R2.
Now does the router just send the packet on not worrying about the destination address as the routing table told it to go through out S/0, or does it send the data based on HDLC/PPP addressing?
Cheers
Comments
-
SharkDiver Member Posts: 844It seems that the packet is destined for the PC at the bottom which is 150.150.4.10.
At each hop along the way, it will look up the destination network and find out what next-hop address to send the packet to.
PC1 will send the packet to its default gateway, which is R1.
On each of the other routers along the way, they are checking the routing table to find out where to send packets to eventually get the 150.150.4.0 network. -
lincis_aus Member Posts: 50 ■■■□□□□□□□Yeah, i do understand that, but what is the destination L2 address when R1 sends data to R2? Would it be defined by the L2 protocol the routers are using between eachother?
-
fsanyee Member Posts: 171This may can help to understand: Specifying a Next Hop IP Address for Static Routes - Cisco Systems
-
SharkDiver Member Posts: 844The L2 address changes at each hop along the way.
The L2 address of the packet as it goes from R1 to R2 would be the L2 address of R2's serial interface on the link between R1 and R2. -
Forsaken_GA Member Posts: 4,024It also depends on the nature of the link. If it's a point to point link, then yes, the router just literally encapsulates the packet and shoves it out the outgoing interface. By it's very nature, a point to point link has only one destination - the other side of the link.
For anything else, you need to do layer 3 to layer 2 resolution. The thing most people get hung up on is this -
#1 - The layer 2 to layer 3 resolution is *not* for the destination. It's for the next hop. The only time the layer 2 to layer 3 mapping is the same as the destination is when the destination is the next hop.
#2 - The layer 2 to layer 3 resolution is link local. Every time the packet goes over a new link, the layer 2 to layer 3 resolution for the next hop changes, which means the router has to de-encapsulate the frame off the incoming interface and then re-encapsulate it on the outgoing. -
Forsaken_GA Member Posts: 4,024lincis_aus wrote: »Yeah, i do understand that, but what is the destination L2 address when R1 sends data to R2? Would it be defined by the L2 protocol the routers are using between eachother?
Yes. Without knowing that, there's no way to answer that question, and the very likely answer is that there isn't one. Not all layer 2 protocols have layer 2 addresses. As I mentioned, point to point links have no need of layer 2 addresses. If the R1 to R2 serial link is encapsulated as HDLC or PPP, then there won't be a layer 2 address. R2 to R3 looks like a frame relay cloud, so the layer 2 address will be the appropriate DLCI. And R3 to PC2 is ethernet, so the layer 2 destination address will be PC2's MAC address, because that's what ethernet uses for layer 2 addressing. -
fsanyee Member Posts: 171I think he don't understand that when he use an exit interface instead of a nexthop addres in a static route.
-
lincis_aus Member Posts: 50 ■■■□□□□□□□Thanks guys for your replies. Fsanyee, the routing theory in this question is irrelevant. I was simply asking what L2 destination address R1 would put when sending frame over to R2, and i got my answer from Forsaken. I was a bit confused, because i know in an ethernet environment, PC1 would put R1s ethernet MAC in the L2 header, so R1 must put some L2 address aswell when sending to R2. I understand now. I read in the official book, that HDLC and PPP do use destination L2 addresses, but these days are irrelevant, as there is only 1 destination in a point to point connection. Now frame relay would be a different matter, as it is a multi access connection, thus a DLCI would be used.
Thanks guys -
thedrama Member Posts: 291 ■□□□□□□□□□lincis_aus wrote: »Thanks guys for your replies. Fsanyee, the routing theory in this question is irrelevant. I was simply asking what L2 destination address R1 would put when sending frame over to R2, and i got my answer from Forsaken. I was a bit confused, because i know in an ethernet environment, PC1 would put R1s ethernet MAC in the L2 header, so R1 must put some L2 address aswell when sending to R2. I understand now. I read in the official book, that HDLC and PPP do use destination L2 addresses, but these days are irrelevant, as there is only 1 destination in a point to point connection. Now frame relay would be a different matter, as it is a multi access connection, thus a DLCI would be used.
Thanks guys
As a summary, data encapsulation occurs between routers as well. MAC address changes at each hop/router. When you send a packet from a Router A to directly connected Router B, As the Router A receives the packet, it just looks at the destination IP (after making the controls at first two layers at the receiving interface) if it finds a match on its routing table about where the packet is transmitted to and from which interface, relays the packet to that interface. Then, now, the process occurs from OSI layer 3 to 1. If it can't find an entry on its routing table, just discards the packet. Now, for your question, the packet relayed to the relevant exit interface of the Router A. Router A will look at its own ARP cache whether it has an entry for the next hop's(Router B's directly connected interface to Router A) MAC address. if it finds an entry, now its time to create the frame as source IP as
the originating source, as Dest. IP, the final destination(if ping or telnet command was used, that IP address) and the source MAC will be the
Router A's that exit interface's MAC address and the dest. MAC will be the MAC address of the directly connected interface of Router B to Router A.Monster PC specs(Packard Bell VR46) : Intel Celeron Dual-Core 1.2 GHz CPU , 4096 MB DDR3 RAM, Intel Media Graphics (R) 4 Family with IntelGMA 4500 M HD graphics.
5 year-old laptop PC specs(Toshiba Satellite A210) : AMD Athlon 64 x2 1.9 GHz CPU, ATI Radeon X1200 128 MB Video Memory graphics card, 3072 MB 667 Mhz DDR2 RAM. (1 stick 2 gigabytes and 1 stick 1 gigabytes) -
Forsaken_GA Member Posts: 4,024If it can't find an entry on its routing table, just discards the packet. Now, for your question, the packet relayed to the relevant exit interface of the Router A. Router A will look at its own ARP cache whether it has an entry for the next hop's(Router B's directly connected interface to Router A) MAC address. if it finds an entry, now its time to create the frame as source IP as
the originating source, as Dest. IP, the final destination(if ping or telnet command was used, that IP address) and the source MAC will be the
Router A's that exit interface's MAC address and the dest. MAC will be the MAC address of the directly connected interface of Router B to Router A.
You're correct in an ethernet scenario. However, not everything is Ethernet. As the graphic in the original post shows, there's also some serial WAN links involved. Serial doesn't do MAC addressing. Nor is Layer 2 addressing needed on every link type, some links, you just encapsulate it with a frame then serialize it out the link. Since it's got only one other possible destination, the routing still works fine. -
thedrama Member Posts: 291 ■□□□□□□□□□Forsaken_GA wrote: »You're correct in an ethernet scenario. However, not everything is Ethernet. As the graphic in the original post shows, there's also some serial WAN links involved. Serial doesn't do MAC addressing. Nor is Layer 2 addressing needed on every link type, some links, you just encapsulate it with a frame then serialize it out the link. Since it's got only one other possible destination, the routing still works fine.
Sorry, i made an illustration once there is an ethernet link between. if other, HDLC or PPP on dedicated, Frame Relay on shared must be implemented as encapsulation with their own frames. But that time, no ARP between routers?Monster PC specs(Packard Bell VR46) : Intel Celeron Dual-Core 1.2 GHz CPU , 4096 MB DDR3 RAM, Intel Media Graphics (R) 4 Family with IntelGMA 4500 M HD graphics.
5 year-old laptop PC specs(Toshiba Satellite A210) : AMD Athlon 64 x2 1.9 GHz CPU, ATI Radeon X1200 128 MB Video Memory graphics card, 3072 MB 667 Mhz DDR2 RAM. (1 stick 2 gigabytes and 1 stick 1 gigabytes) -
Forsaken_GA Member Posts: 4,024lincis_aus wrote: »I was a bit confused, because i know in an ethernet environment, PC1 would put R1s ethernet MAC in the L2 header, so R1 must put some L2 address aswell when sending to R2. I understand now. I read in the official book, that HDLC and PPP do use destination L2 addresses, but these days are irrelevant, as there is only 1 destination in a point to point connection. Now frame relay would be a different matter, as it is a multi access connection, thus a DLCI would be used.
Right, it all depends on what the next link is. The thing to keep in mind is that the packet (L3 PDU) stays the same end to end. Nothing modifies it. The frame (l2 PDU) is essentially destroyed by the router receiving it. As soon as it has the entire frame, it rips the frame off and then looks at the underlying packet, and then decides what to do with it. Once it's decided what interface the packet is going out, it puts it in a new frame that's appropriate for that link, and that link may or may not need a layer 2 address.
The way I like to relate it is to imagine you're travelling from Los Angeles to London by way of New York. Let's say you hop a plane at LAX, and fly to Chicago. From Chicago, you take the train to La Guardia. From La Guardia, you take a plane to Heathrow.
You are the layer 3 packet. The vehicle you're traveling in is the layer 2 frame, and the places of transport are the routers. Airliner is a different method of transport than rail. So it goes with layer 2 transport, where ethernet is not the same as frame relay. They all get you where you need to go, they just do it in different ways. And as the travel agent (network engineer) it's your job to make sure that the passenger (packet) arrives there in one piece.
Of course, when you start including things like collisions and fragmentation, my analogy starts to break down -
Forsaken_GA Member Posts: 4,024Sorry, i made an illustration once there is an ethernet link between. if other, HDLC or PPP on dedicated, Frame Relay on shared must be implemented as encapsulation with their own frames. But that time, no ARP between routers?
In the example he has above, R1 and R2 will not have ARP information for each others serial interfaces. ARP resolves layer 3's to MAC's, and serial addresses don't have MAC's. R1 would only use the ARP cache when sending frames to PC1, not when receiving frames from it. -
LinoCatucci Registered Users Posts: 4 ■□□□□□□□□□Hello Forsaken_GA,
I could't find a way to email / send you a message directly but I am quite new to cisco gear.
I can buy some 2nd hand Cisco gear. Below are the specs.
1 Cisco 2621XM Router (128/32), Refurb
2 Cisco WS-C2950G-24 Switch (Layer-2),Refurb
The routers and switches have the latest iOS 12.4.
Asume that the hardware is working, does the hardware sounds good?
Cheers,
Lino -
jude56g Member Posts: 107 ■■■□□□□□□□Forsaken_GA wrote: »You are the layer 3 packet. The vehicle you're traveling in is the layer 2 frame, and the places of transport are the routers. Airliner is a different method of transport than rail. So it goes with layer 2 transport, where ethernet is not the same as frame relay. They all get you where you need to go, they just do it in different ways. And as the travel agent (network engineer) it's your job to make sure that the passenger (packet) arrives there in one piece.
Of course, when you start including things like collisions and fragmentation, my analogy starts to break down
Great analogy.