Hello again AZM
I’m always glad I could be of help!
If Switch B were configured as you describe above, the functionality would be EXACTLY the same as described in my previous post. This is because when the frame leaves the VLAN 20 SVI interface on Switch 1, its destination address (10.10.20.2) is in the SAME subnet as the VLAN 20 SVI interface (10.10.20.1). This means that it is on the last hop of the trip and no additional routing is necessary. So when this frame exits the trunk port of Switch 1, it will have in its header the destination MAC address of Host B. When the frame reaches the trunk port of Switch 2, only a MAC address table lookup will take place within the switch which will direct the frame out of the port where Host B is connected.
On the return trip, when Host B sends a packet to 10.10.10.2, it will see that it is not in the same subnet as its own, so it will send the packet to the default gateway configured in its network settings, which is the VLAN 20 SVI port on Switch 1 (10.10.20.1). When it encapsulates the packet in a frame it will place the MAC address of this SVI port as the destination MAC address. The frame will go to the VLAN 20 SVI port on Switch 1, become de-encapsulated and will go through the routing table much like it did in the initial trip from Host A to B.
I believe the following principles will help you out in understanding where layer 2 and layer 3 addressing functionalities take place:
When a packet is sent from one host to the other, the destination IP address remains the same for the whole trip. The destination MAC address however changes for each hop.
When one host sends a packet to another, each hop requires the use of the next hop router’s MAC address as the destination address. That means that for all hops except for the last one, routing will take place. Thus de-encapsulation will take place to layer 3, routing tables will be looked up and packets will be routed. On the LAST hop, the destination MAC address is always the MAC address of the host. In that case, there will be no routing, no layer 3 de-encapsulation. De-encapsulation will occur on the destination host itself all the way up to the application layer.
I hope this has been helpful!