I am just wanting a little clarification on this since in the books I only see this:
hostA
router
hostB
but on practice test I have seen this:
hostA
switchA
router
switchB
hostB
Question is like this:
host A sends a ping to host B
what is the destination ip and mac from between host A and switchA, switchA and router, router and switchB, and switchB and hostB?
From what I understand hostA will determine if hostB is on the local network and if not then it will send it to the default gateway. Since hostB is not local, hostA will create a packet with a destination IP of hostB, a source IP of hostA, and frame the packet with the mac address of the interface of the router port it connects to and it will have a source mac of hostA. The switch operates at layer 2 so it will just look at the hardware destination and push it out the interface going to the router, not making any changes to the frame or packet. The router then takes the frame, strips the packet from it and trashes the frame, then the packet is given to the protocol listed in the type field (IP in this case). IP on the router then takes the packet and checks the destination IP address. Since the router has an entry for the network address it sends it to the interface of that entry, now that buffer finds the hardware address of hostB (because it has the destination IP of hostB it does an ARP or checks the ARP cache) and sends the info to the data link layer. The data link layer then frames the packet with a destination address of the mac of hostB, source mac address of the router (is this correct?-- this is what I'm iffy on), and type field. SwitchB just checks the hardware destination address and forwards it out to hostB.
Now I know this is long but I'm wondering if I am correct in thinking this is the way it all works since in most examples I have seen they never have switches in between the hosts and the router.
Thanks in advance for reading that stuff and giving an answer, lol.