1

i created the following topology using packet tracer to understand how the switch mac table works , enter image description here

at the beginning , i looked at the mac table in the swithc S1 before i send any packet or do any pings and i found that the router R1 mac address(the one on fa0) is always there , so why is that ?! is it always like this when router connects to switch ?! is this normal ?

later a sent a packet from PC1 to the web server (IP: 10.1.1.99) and i noticed that when the packet came out of PC1 the mac address of the destination was (00:E0:8F:79:BD:01) which the mac address of router R1 on port 0 and when the packet leaved R1 the packet destination address became (00:DD:32:33:15:62) which is the mac of web server , so is this what really happens in real life? why the packet didn't have the mac of web server when it came out from pc1 not from Router R1 ? Can anybody explain this to me ?! Note : i used RIP to route the two LAN networks together ,

Kind regards

  • You should take a look at how routing works. MAC addresses are only known in the context of the same L2 segment. In L2, the frame is passed to the router which forwards the packet based on L3 information (L3 hop) and then uses L2 to transport it. – Zac67 Jul 2 '17 at 18:12
  • sir thank you for the replay , the point of this that i want to know how this is working from the point of mac address and how switch mac table really works . so please help me if you know the answer to my questions , kind regards – Wissam A Jackal Jul 2 '17 at 18:16
  • S1's job is to bridge the segment between PC1 and R1/0 based on the destination MAC address and its MAC table. S2's job is to bridge the segment between R1 and web server based on its MAC table. Both only see the MAC addresses of their segment. Switches don't know about IP addresses. R1's job is to route between these segment based on the IP addresses. However, since it uses Ethernet on both sides it needs to resolve the destination IP address to a MAC address when forwarding the packet. – Zac67 Jul 2 '17 at 18:43
  • thanks again , so the mac of web server is not known by the PC1 in its segment nor by the switch so PC1 uses the mac of the router to send it ?! is that correct ? – Wissam A Jackal Jul 2 '17 at 18:53
  • Exactly. PC1 looks at its local routing table and decides it needs R1 to reach the web server. It uses the server's IP address as destination but as destination MAC address for Ethernet transport it uses the router's. – Zac67 Jul 2 '17 at 19:03
2

To answer your questions:

PC1 looks at its local routing table and decides it needs R1 to reach the web server. It uses the server's IP address as destination but as destination MAC address for Ethernet transport it uses the router's MAC.

The router looks at the destination IP address and decides to forward the packet out of the interface facing the web server. Since it's an Ethernet interface and the destination IP is local to the segment it'll ARP the IP address of the server and use the MAC as destination.

0
  1. The first part may be CDP? I'm not 100% sure on what communication is initially done when you connect a router and switch, but considering CDP is enabled by default, it would communicate immediately on that link.

  2. When the PC is attempting to reach the web server, it doesn't know the web servers MAC address and instead knows that it needs to send the packet to it's default gateway (router). So the destination MAC will be the gateway interface's MAC address. The router will strip this away and look at the destination IP, and it will know that it needs to send the packet to the web server since it knows the web server MAC address. The source and destination IP will always remain the original, while the source and destination MAC address will always change as a packet frame goes from device to device.

I hope this helps, it's kind of difficult for me to explain as I just really learned how it works.

Edit:

This is indeed how it works in real life. Packet Tracer does a great job of simulating simple real-life networks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.