RIP, EIGRP, OSPF, IS-IS, BGP, MPLS, VTP, STP.
ritam
New Member
Posts:
18
Joined:
Sat Aug 17, 2013 11:42 am

Router to Router communication

Sat Aug 31, 2013 3:54 am

Hi

Can anyone please tell me how does one router handles the data as it travels from one Router to another router? I mean, say, I have the below topology-



pc1<->Switch <->Router1<->Router2<->Switch<->pc2


In the above the pc1 wants to send data or ping to pc2,so it inserts a source IP address as its own address,dest ip as that of pc2,source mac as that of pc1 and dest mac is unknown so it arp to FF.FF.FF.FF (correct me if I m wrong). Router 1 replies with its own mac address as proxy arp ,then when it recieves this packet from pc1 it de-encapsulates or strips off the IP header and trailer (I'm not sure if its called IP or TCP/UDP header,please tell me) and encapsulates in hdlc or ppp ,right?



But here I am confused as I have read in many books and in the internet that the Router changes the MAC address of the packet ,i.e. it changes the source MAC to that of Router1(source MAC) and destination MAC address as that of the Router2 and without any change in source or destination IP address of the packet.

Then what is the purpose of HDLC encapsulation in this case if changing the MAC address suffices? HDLC doesn't change the MAC address! So which one of the above views are correct - is it HDLC encapsulation (as mentioned in Sir Wendell Odom's book) or is it change in MAC address or both when a packet traverses from one router to another Router as in the above case?

Any help will be greatly appreciated .

Thanks in advance

With best regards

p.s.:If kindly someone gives me an urgent/quick reply then i will be greatly obliged.

User avatar
jamie
Member
Posts:
101
Joined:
Tue Apr 02, 2013 9:05 am
Certs:
CCNP, CCDP

Re: Router to Router communication

Sat Aug 31, 2013 4:58 am

you are getting HDLC confused with Ethernet
Jamie

totaluser
Member
Posts:
217
Joined:
Sun Mar 13, 2011 3:03 pm
Certs:
CCNA, CCNP, CCDA

Re: Router to Router communication

Sat Aug 31, 2013 5:32 am

ok, let's assume that Router1 <---> Router2 are interconnected with Ethernet link
so the communication process is following

PC1 wants to communicate with PC2 using
PC1 has IP address assigned to its interface and PC1 knows the IP address of PC2 with which it wants to communicate
PC1 performs logical AND operation on its own IP address and its own subnet mask ==> now it knows the network address of PC1's network
PC1 performs logical AND operation on destination IP address and its own subnet mask ==> it DOES NOT know the network address of the other side because the mask could be different
all PC1 now knows is if PC2 is on the different network (the results of the logical AND operation are different) or if it is on a local segment e.g. the same IP network as PC1 (the results of the logical AND operation are the same --> same network address)

ok, so far PC1 knows that PC2 is not on the same network and if it wants to communicate it needs to use its default gateway
now that PC1 knows it will communicate via default gateway (at Layer2) it needs to know the MAC address of interface of default gateway router connecting to LAN
it will lookup ARP cache and either find it or broadcast ARP request for IP address of the interface on default gateway router

now PC1 can construct frame and send it on its interface towards switch
IP header data as the packet leaves PC1
SRC IP : PC1
DST IP : PC2
Ethernet header data as the frame leaves PC1
SRC MAC: PC1
DST MAC: Default gateway

ok, so now the frame arrives at the switch
switch will use it's CAM table to find over which port the MAC address of DEFAULT GATEWAY can be reached and forwards it on that port only
if it does not have that information it will flood that frame to all other ports except for the one over which it was received (and only in the same VLAN)

so now the frame arrives at the default gateway (Router1)
router1 will check if the destination MAC address of the frame matches the MAC address of the interface over which it was received (if it does not and it is not broadcast the frame will be dropped)
in this case it matches so frame is processed further
FCS is checked to detect if frame was corrupt during transmission or not (if FCS in frame and calculated FCS do not match the frame will be dropped)
now router1 strips/removes L2 header and trailer and what is left is IP packet
router1 checks if the destination IP address matches one of it's interfaces (so the packet was destined for the router)
in this case it does not so router1 checks it's routing table to see if there is entry (IP prefix and subnet mask/prefix length) that destination IP address falls in
if there are multiple entries, the longest prefix match will be used
if no entries are found then packet is dropped (well even if default router is present but routing table behavior is set to be CLASSFUL it will not be used :D )
so the entry was found, and with it is associated the next-hop IP address and outgoing interface
now router1 decrements TTL field and recalculates IP header checksum
before transmitting it further it needs to add L2 encapsulation appropriate for the outgoing interface
since the link between Router1 and Router2 is Ethernet, router1 will have to check its ARP cache
it either finds an entry for the next-hop IP address referenced in the route entry or it will broadcast ARP request for that IP address

now router1 can construct the frame and send it towards router2

IP header data as the packet leaves Router1
SRC IP : PC1
DST IP : PC2
Ethernet header data as the frame leaves Router1
SRC MAC: Router1's interface towards Router2
DST MAC: Router2's interface towards Router1



so now the frame arrives at the Router2
router2 will check if the destination MAC address of the frame matches the MAC address of the interface over which it was received (if it does not and it is not broadcast the frame will be dropped)
in this case it matches so frame is processed further
FCS is checked to detect if frame was corrupt during transmission or not (if FCS in frame and calculated FCS do not match the frame will be dropped)
now router2 strips/removes L2 header and trailer and what is left is IP packet
router2 checks if the destination IP address matches one of it's interfaces (so the packet was destined for the router)
in this case it does not so router2 checks it's routing table to see if there is entry (IP prefix and subnet mask/prefix length) that destination IP address falls in
if there are multiple entries, the longest prefix match will be used
if no entries are found then packet is dropped (well even if default router is present but routing table behavior is set to be CLASSFUL it will not be used :D )
so the entry was found, and with it is directly connected route associated with the outgoing interface
now router2 decrements TTL field and recalculates IP header checksum
before transmitting it further it needs to add L2 encapsulation appropriate for the outgoing interface
since the link between Router2 and PC2 is Ethernet, router2 will have to check its ARP cache
it either finds an entry for PC2's IP ad address or it will broadcast ARP request for that IP address

now router2 can construct the frame and send it towards the destination PC2

IP header data as the packet leaves Router2
SRC IP : PC1
DST IP : PC2
Ethernet header data as the frame leaves Router2
SRC MAC: Router2's interface towards PC2
DST MAC: PC2's interface

ok, so now the frame arrives at the switch
switch will use it's CAM table to find over which port the MAC address of PC2 can be reached and forwards it on that port only
if it does not have that information it will flood that frame to all other ports except for the one over which it was received (and only in the same VLAN)

now the frame arrived at PC2 but the communication process is far from over
PC2 will check if the destination MAC address of the frame matches the MAC address of the interface over which it was received (if it does not and it is not broadcast the frame will be dropped)
in this case it matches so frame is processed further
FCS is checked to detect if frame was corrupt during transmission or not (if FCS in frame and calculated FCS do not match the frame will be dropped)
now PC2 strips/removes L2 header and trailer and what is left is IP packet
PC2 checks if the destination IP address matches one of it's interfaces (so the packet was destined for PC2)
IP header checksum is checked to detect if packet header was corrupt during transmission or not (if checksum in packet and calculated checksum do not match the packet will be dropped)
so the check was successful and packet was indeed destined for PC2
PC2 will strip/remove IP header and is left with payload (which in case of ICMP communication is handled by ICMP protocol now)
PC2 now responds to ICMP echo request and the process repeats again in other direction


if you want to go into more detail in some section then tell me which ones


as for the Ethernet technology which uses MAC addresses as L2 addressing when compared to HDLC which does not use L2 addressing

Ethernet is mainly LAN technology where multiple devices share the same L2 segment and you need to somehow distinguish between them
you need L2 addresses which in this case are MAC addresses

HDLC on the other hand is WAN technology used for point-to-point links only
as the name suggests, only 2 devices can be connected using HDLC, exactly 1 source and exactly 1 destination
so you can be sure that once you place a frame onto HDLC link it will only arrive (if at all due to possible L1 problems :D ) at the other end, the single possible destination
for this reason there is no need for L2 addresses

but the above noted process does not change much to accommodate for these changes

ritam
New Member
Posts:
18
Joined:
Sat Aug 17, 2013 11:42 am

Re: Router to Router communication

Sat Aug 31, 2013 11:51 am

Hi Totaluser,
One word "Awesome". I have never found such a great explanation on any forums so far. You are great!! :D Thanks for the labor you took for me. :)
With that I ask you some more things-
You said that the link is Ethernet between the routers.Then when is HDLC used? And how will the frames be forwarded when HDLC is used? I mean even then ,when hdlc is used will there be a change in mac address when communicating between routers ?

totaluser
Member
Posts:
217
Joined:
Sun Mar 13, 2011 3:03 pm
Certs:
CCNA, CCNP, CCDA

Re: Router to Router communication

Sat Aug 31, 2013 12:33 pm

that really depends on the situation
usually if you want to interconnect routers that are geographically close (like a single building) I usually would have the chance to choose the medium and L2 protocol used, e.g. I might go for copper cable or fiber and use Ethernet

if I am interconnecting devices that are further apart I will need to use some sort of WAN interconnection provided by some ISP
now I cannot choose the protocol I want but I have to use what that ISP uses (or wants me to use)
that might be HDLC or PPP or FrameRelay or something else

here is the modification for HDLC of the process from my post

so now the frame arrives at the default gateway (Router1)
router1 will check if the destination MAC address of the frame matches the MAC address of the interface over which it was received (if it does not and it is not broadcast the frame will be dropped)
in this case it matches so frame is processed further
FCS is checked to detect if frame was corrupt during transmission or not (if FCS in frame and calculated FCS do not match the frame will be dropped)
now router1 strips/removes L2 header and trailer and what is left is IP packet
router1 checks if the destination IP address matches one of it's interfaces (so the packet was destined for the router)
in this case it does not so router1 checks it's routing table to see if there is entry (IP prefix and subnet mask/prefix length) that destination IP address falls in
if there are multiple entries, the longest prefix match will be used
if no entries are found then packet is dropped (well even if default router is present but routing table behavior is set to be CLASSFUL it will not be used )
so the entry was found, and with it is associated the next-hop IP address and outgoing interface
now router1 decrements TTL field and recalculates IP header checksum
before transmitting it further it needs to add L2 encapsulation appropriate for the outgoing interface
since the link between Router1 and Router2 is HDLC (point-to-point link) router1 does not need to bother with addressing
Router1 adds HDLC header and trailer (address field in HDLC header will be set to all-zeros for unicast communication)

now router1 can construct the frame and send it towards router2


IP header data as the packet leaves Router1
SRC IP : PC1
DST IP : PC2
HDLC header as the frame leaves Router1
Address field set to 000000



so now the frame arrives at the Router2
since we are using HDLC router2 is the only possible destination for traffic sent from router1 it does not need to check if it is destined for us

FCS is checked to detect if frame was corrupt during transmission or not (if FCS in frame and calculated FCS do not match the frame will be dropped)

now router2 strips/removes L2 header (HDLC) and trailer and what is left is IP packet
router2 checks if the destination IP address matches one of it's interfaces (so the packet was destined for the router)
in this case it does not so router2 checks it's routing table to see if there is entry (IP prefix and subnet mask/prefix length) that destination IP address falls in
if there are multiple entries, the longest prefix match will be used
if no entries are found then packet is dropped (well even if default router is present but routing table behavior is set to be CLASSFUL it will not be used )
so the entry was found, and with it is directly connected route associated with the outgoing interface
now router2 decrements TTL field and recalculates IP header checksum
before transmitting it further it needs to add L2 encapsulation appropriate for the outgoing interface
since the link between Router2 and PC2 is Ethernet, router2 will have to check its ARP cache
it either finds an entry for PC2's IP ad address or it will broadcast ARP request for that IP address

now router2 can construct the frame and send it towards the destination PC2

ritam
New Member
Posts:
18
Joined:
Sat Aug 17, 2013 11:42 am

Re: Router to Router communication

Sat Aug 31, 2013 9:43 pm

Hi totaluser,
Then you mean there is no change in MAC address when you transmit through HDLC/PPP/Frame Relay?
When you are using either of those multiple access protocols ,what happens to the MAC address portion of the packet?The MAC address remains unchanged?

User avatar
mellowd
CCIE #38070
Posts:
13814
Joined:
Wed Jun 18, 2008 7:49 am
Certs:
CCIE (RS,SP), JNCIE-SP, BC-/SPNE/NP

Re: Router to Router communication

Sun Sep 01, 2013 2:18 am

There is no MAC header on those frames

totaluser
Member
Posts:
217
Joined:
Sun Mar 13, 2011 3:03 pm
Certs:
CCNA, CCNP, CCDA

Re: Router to Router communication

Mon Sep 02, 2013 6:57 am

ritam wrote:Hi totaluser,
Then you mean there is no change in MAC address when you transmit through HDLC/PPP/Frame Relay?
When you are using either of those multiple access protocols ,what happens to the MAC address portion of the packet?The MAC address remains unchanged?


just to make a few things clear
Frame is Layer2 Protocol Data Unit (PDU) and in L2 header it carries L2 addresses which in case of Ethernet is MAC address and case of HDLC is address field filled with 0000 0000
Packet is Layer3 Protocol Data Unit (PDU) and in L3 header it carries L3 addresses which can be IPv4 or IPv6 these days

don't mix those two up

and as you can see in this process of communication ROUTER always removes L2 header on the received FRAME, inspects PACKET and then encapsulates this PACKET into another FRAME
this always happens
this is by the way also the reason why (in topology using Ethernet) MAC address change at every hop

so when ROUTER receives frame with Ethernet encapsulation, it strips header (which contains MAC addresses) and trailer inspects the payload of the frame which is the packet and if it can route that packet then it encapsulates it with appropriate L2 encapsulation
it could be Ethernet so MAC addresses are present in new L2 header or it could be HDLC and appropriate address field is populated accordingly

I hope now your understanding is getting better.
MAC addresses (or any other L2 addresses) never remain unchanged when routed by router

if you have any other questions feel free to ask

ritam
New Member
Posts:
18
Joined:
Sat Aug 17, 2013 11:42 am

Re: Router to Router communication

Tue Sep 03, 2013 2:15 am

Hi totaluser,
That is what I am asking. If the communication is through serial line, then it is HDLC encapsulation,right?
When it is through ethernet then only mac addresses changes?
But when the communication is through hdlc/ppp it is not changing any mac addresses since the frame is inside a hdlc encapsulation,right?
Then is its a serial line ,it is always hdlc or ppp, and if its a ethernet crossover cable its always ehternet framing so mac addresses are involved? right?
Pls correct me if i am wrong :?

cadetalain
Member
Posts:
159
Joined:
Tue Oct 11, 2011 2:05 pm
Certs:
CCNP-CCNA Security-CCNA Voice-CCNA

Re: Router to Router communication

Tue Sep 03, 2013 3:50 am

Hi,
The router will build a new L2 header and so if the exit interface is ethernet it will change the src MAC to be the one for its outgoing interface and the dst MAC will be the one from next-hop or the device if it is directly connected.
if the exit interface is hdlc,ppp or frame-relay then it will build the corresponding L2 header and get rid of the ethernet header( so no MAC anymore).

Alain

User avatar
ristau5741
Post Whore
Posts:
10340
Joined:
Tue Aug 21, 2007 2:15 pm
Certs:
Instanity

Re: Router to Router communication

Tue Sep 03, 2013 8:52 am

hdlc, ppp or frame-relay are typically point to point links, there is only one place to send the electrons, the other side. This is not so with Ethernet.
Tips of the day:
- The human mind is the ultimate creation invention.
- I have so many customers, my customers have customers.
- Sausage time
- POP, stack, and store

'

Return to Cisco Routing and Switching

Who is online

Users browsing this forum: No registered users and 40 guests