-2

I have to teach my sixth form about MAC Addresses and IP Addresses in a few weeks time and there are some areas I am unclear on which I am hoping some of you will be able to clarify for me.

So as I understand it the following happens when a device on a LAN sends a packet/frame to a device on another separate LAN via the internet.

A packet is created at the sending end with the destination and sending IP

First question: Is the destination IP actually the IP of the gateway for the receiving device’s LAN

This is then turned into a frame which will go to the gateway for the LAN - this happens at the data link layer and the frame has a MAC sending and destination address added

Second question: The destination MAC address - is this the final destination or the destination of the gateway?

The packet/frame is then sent onto the internet and routed (using the IP address) to the next hop towards the final destination

Third question: At each hop, does the data link layer change the destination MAC address in the frame to the MAC address of the next hop?

The packet/frame is routed to the destination address (which is the gateway )

Fourth question: Once the frame/packet reaches the gateway of the receiving LAN is the destination MAC address in the frame used by a switch to ensure it ends up at the correct device? This obviously assumes that the destination MAC address is not amended by the routers as the frame/packet traverses the internet - if it is amended then once the receiving gateway receives the frame/packet, how does it know where to send it?

Any corrections/confirmations of my understanding would be gratefully recieved.

Robert Flook
  • 307
  • 6
  • 12
  • 2
    In my opinion if you do not understand the basics of something, you cannot effectively teach it. The IP given is the public IP (dynamic or static) allocated to the destination by their ISP. The `192.xxx.xxx.xxx` IP range is reserved for internal network use and is *not* the public IP address. ***Also, this is a programming site and as such, this type of question is off-topic here***. – AStopher Nov 11 '14 at 11:20
  • I am perfectly aware of the difference between an internal and external IP address and the difference between static and dynamic IP addresses. I am also aware of the purpose of IP addresses. My question was more to do with routing and MAC addresses. Also I wasn't after opinions on whether someone can/cannot teach something, I was simply hoping for some facts to ensure my the accuracy of what I was teaching. – Robert Flook Nov 11 '14 at 18:07
  • You'll be better off asking at Super User, as this is a programming site. – AStopher Nov 11 '14 at 18:32

1 Answers1

0

These are quite basic questions about IP routing. I suggest you lookup information on IP routing.

Let's say we have the following setup:

HOST A - SW1 - R1 - R2 - SW2 - HOST B

The destination MAC address is the MAC of the next hop device, the source MAC address is the MAC of the sending device and both are changed each time the frame passes a hop.

eg: HOST A sends the packet: Source MAC = HOST A, Destination MAC = SW1. eg: R1 sends the packet: Source MAC = R1, Destination MAC = R2.

The destination IP is the actual IP of the destination (host B). The source IP is the actual IP of the source (host A).

So in short, an Ethernet frames source and destination address are changed everytime it passes a hop and the IP packet inside the frame remains untouched (unless NAT is used).

CustomX
  • 9,948
  • 30
  • 85
  • 115