Okay, so I'm studying for the Network+ exam, and I've gone over the OSI model about a million times, and I understand most of it fairly well, and my studies are coming along fine. However, there is one hiccup in my comprehension. I understand that when data is sent to another network, it has to use logical addresses, or IP addresses, to get there, and I understand that is layer 3 (Network). So, my question is, what if the destination for the data is on the local network? Do they use IP or MAC with ARP, and is that Layer 3 or 2? Like, is the Network layer used at all if the destination is on the local network?
-
Both Mac Addresses and IP Addresses are used for IP over Ethernet; there are no exceptions for local vs non-local network case. If you have questions about whether specific devices (such as a switch or router) only look at one address, then that is a different question.– Mike PenningtonCommented Jul 7, 2014 at 5:19
3 Answers
I understand that when data is sent to another network, it has to use logical addresses, or IP addresses, to get there
Like the moderator said, IP and mac addresses are used on ethernet, so you are confused and don't understand how this works. If a PC-A on ethernet sends IPv4 traffic to an PC-B on another network, the packet still needs to arrive at the first-hop router. The destination IP address will be PC-B, but the destination mac-address is the first-hop router's mac.
PC-A is configured with the next-hop router IP address and PC-A ARPs to find the mac address of the first-hop router.
In this case, the first-hop router (also called the "default gateway") uses its routing table to find the proper interface to deliver the packet towards PC-B.
what if the destination for the data is on the local network? Do they use IP or MAC with ARP, and is that Layer 3 or 2? Like, is the Network layer used at all if the destination is on the local network?
If PC-A wants to send IPv4 traffic to PC-C on a local network, both the destination mac-address and the destination IP address are for PC-C.
PC-A realizes that PC-C is on the same network, so it ARPs to find the mac address of PC-C.
In this case, the lan-switch uses its mac-address table to find the proper interface to deliver the packet. However, PC-C still checks the destination IP address to ensure it belongs on PC-C.
When you say "what is the destination", I think that depends a lot on what you actually do.
if you have an application such as FTP, and you FTP from host A to host B on the same network.. you still go all the way up to layer 7 (Application layer), does not matter if host A is on the same network, or on the other side of the world.
The interesting part is how far up the layer each hop needs to go. if you are on the same network, then you are most likely connected with a switch (a layer 2 device), then the hop in between the two hosts, only need to go to layer 2 for the switch to know what to do with package. but if the two hosts are on separate networks, then the router (level 3) needs to read the address on the network layer to know what to do with it.
PS: if you use another tool like Ping, then only layer 1,2 and 3 are used. (do not think layer 4 is needed for this).
-
1I really wish negative points were followed by comments to what was wrong with this answer, the negative point does not teach me (or anyone) anything by itself.– SverreCommented Jul 7, 2014 at 11:03
-
Some might say there are good reasons to downvote without commenting– user5025Commented Jul 7, 2014 at 12:40
-
that is fair I guess.. so whoever did not like my post, feel free to PM me, so I can improve :)– SverreCommented Jul 8, 2014 at 2:24
MAC addresses are used in layer 2 and layer 3 of the OSI model in order to assist with frame and packet forwarding. First the MAC address is received showing where it needs to go and the layer 3 IP address. This is done at the Frame and IP layer. Once the frame MAC is accounted for and the layer 3 IP is located the layer 3 device forwards the frame to the appropriate IP address which will continue the process if routes exist and the layer 3 protocol is correct.
Best,