Source and destination MAC & IP addresses.

I am sure i have gone through all the CCENT on demand videos. 

 

In the practise test however, i get a question asking, what the source and destination MAC & IP addresses are, when PC host A wants to send data to PC host B.

Host A's data will have to pass through a L2 switch and a Router on the way to Host B.

How can i work out the packet source and destination MAC and IP addresses?

 

 

 

Comments


  • Hi ac427,

    There are different perspectives into this question:

    1) HostA and HostB are on the same VLAN

    2) HostA and HostB are on different VLANs

     

    Let's consider router on a stick for inter-vlan routing.

    In the first case, since the devices are on the same subnet, the traffic will not pass through a L3 device, only through the switch itself, so the source and destination MAC Addresses and IP will look like this:

    Source MAC: HostA MAC

    Source IP: HostA IP

    Destination MAC: HostB MAC

    Destination IP: HostB IP

     

    If the hosts are on different VLANs/subnets, then the traffic will go through the L3 device (router in this case).

     

    Inbound traffic:

    Source MAC: HostA MAC

    Source IP: HostA IP

    Destination MAC: Router's MAC (specifically for the subinterface that is used to route the packets off this subnet)

    Destination IP: HostB IP

     

    Outbound traffic:

    Source MAC: Router's MAC 

    Source IP: HostA IP

    Destination MAC: HostB MAC

    Destination IP: HostB IP

     

    HTH

    Good luck!

  • here is an easy way to remember it. From the sending side think like this;

    1) the mac address stays the same in the packet so it knows where it comes from, the IP address is changed when it leaves the port of the switch / router and it will then add in the next hop info. The destantion IP address will always stay in the packet so it knows where it needs to go to. the mac address will be the next hop.

    2) so the ip addresses stay the same and the mac address is from where the packet just left and where the packet is going to. It does not need to be over thought it is just that easy

  • The source and destination IPs don't change unless any NAT device is involved. But MAC address gets changed at each Hope. Dig ARP little more deeper and you will find the details.

    As a side note - The ARP doesn't happen on WAN interfaces but L2 information still gets re-written.

     

    HTH...

    Deepak Arora

    http://deepakarora1984.blogspot.com

     

  • 1) the mac address stays the same in the packet so it knows where it comes from,

    I don't agree - the L2 information is stripped and rewritten on a hop-by-hop basis.

  • When HostA wants to send a packet to HostB, it requires:

    1. IP Address of HostB usually obtained via DNS.
    2. An appropriate target Mac Address which may or may not be that of HostB. 
    HostA obtains a target Mac Address as follows when approriate entry does not exist in it's arp-cache:

    1. Determine if IP Address of HostB, the target, appears to be in the same network as HostA. http://www.itgeared.com/articles/1054-how-ip-packets-are-routed-on-local-area/. If so, send an Arp broadcast requesting the Mac Address of HostB.
    2. If the IP Address of HostB exists in a subnet of the IP Address of HostA, HostA will determine that HostB is on the same network and send an Arp broadcast requesting its Mac Address. When a router exists between them, the Arp broadcast will be blocked by that router. This is a condition where Proxy-arp may come to the rescue.  It is enabled on many routers by default but due to security concerns in the real-world it should be explicitly disabled.  If Proxy-arp is enabled AND the router knows how to reach HostB, it will reply with a unicast message sending its Mac Address to HostA.
    3. If the IP Address of HostB does not appear to be in the same network as HostA, HostA will send an Arp broadcast requesting the Mac Address of its default-gateway unless the Mac Address of the default-gateway existsin its arp-cache. 
    1. Packet containing unchanging IP addresses (source and destination), HostA's Mac Address (source) and the target Mac Address will be sent.
    2. If the packet crosses a router, that router will replace HostA's Mac Address (source) with its own; replace the target Mac Address with that of the next hop router, if another router is in the transit path; send the packet.  
    HTH

    Ernie


Sign In or Register to comment.