I working on pre test questions and I feel I am very weak when questions come up with questions asking for example. Host A pings Host B. What source MAC address and source Ip address are contained in the frame as the frame leaves Router2 destined for host B? Can some one please help me grasp this topic its the only thing I am weak in. Please let me know if their are any sites that give a better explantion how frame or packet changes in a LAN and WAN. Thx
If host A and B were in different subnets and there's a router between the two, then the (layer 3) source IP and destination IP address values remain the same. However, the MAC address information in the layer 2 headers are only locally significant to the local broadcast domain. When host A makes the ping, it determines that the destination (host B) is in another subnet and must therefore determine the router's interface MAC address (at least the interface facing host A's subnet). Once it determines this via ARP, it creates a frame with the source MAC of itself and a destination MAC of the router's first interface.
Once the router receives it and figures out via it's routing table which network interface to send it out on (let's say it's the second interface that's facing the subnet host B is on), it does an ARP for host B's MAC address if it doesn't know it already, and once host B responds with that info, the ping from host A is re-framed so the source MAC is the router's second interface and the destination MAC value is host B's.
Then it kind of works in reverse when host B sends an ICMP echo-reply back. This is all assuming there's no network address translation happening.
Since Docrice did all the dirty work of explaining the details, I'll just go for the big picture.
The souce and destination IP address stays the same from start to finish. It will always be the source host and destination host. The MAC addresses (or whatever the Layer 2 addressing scheme may be) will change from step to step along the way.
A good way to look at it, is like when you send a letter. You're address is the source, and your friend's is the destination. Along it's journey it may have to go from city to city, state to state, or even country to country, but your and your friend's addresses are always on the letter. They are like the IP addresses.
As the letter travels from one city post office to another city post office, the carriers have a way of knowing which post office it came from and where the next post office is that it's going to. The addresses of those post offices are like the MAC addresses. And even as those addresses change, the carrier can always tell the origin (your address) and the ultimate destination (your friend).
Hopefully that helps.