Routing (Part 1: How to send via the router)
If a packet is being sent to the local network (eg, "A" sending a packet to "B"), it will need B's MAC address (via ARP, as discussed above). If it is sending to another network, it will not need the destination's MAC address, just that of the router it is sending the packet to. So, for G to send a packet to F, the packet sent by G would look like this:
Source IP | 192.168.1.4 | (G) |
---|---|---|
Source MAC | 02:F1:A0:23:37:52 | (G) |
Destination IP | 192.168.2.4 | (F) |
Destination MAC | 01:33:4A:DC:7B:37 | (router) |
Data | Hello F! My name is G |
However, the packet received by F (from the router) would look like this:
Source IP | 192.168.1.4 | (G) |
---|---|---|
Source MAC | 01:33:4A:DC:7B:37 | (router) |
Destination IP | 192.168.2.4 | (F) |
Destination MAC | 05:4C:5D:CA:83:23 | (F) |
Data | Hello F! My name is G |
So G and F never know each others' MAC address; they don't need to. The router knows both, because it talks directly to both hosts.
In the same way, when your PC talks to www.google.com, it does not need to know anything about Google's physical address, only the address of your ISP's router. At a higher level, you personally don't need to know Google's IP address (eg, 64.233.183.147), only the TCP name (www.google.com). This is how TCP/IP blend together; IP deals with the "internet" side of things, whilst TCP deals with the higher levels.