Need help understanding how packets travel across the internet
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I've been learning about networks recently at a new job, and I did a presentation on what I've learnt so far. When I was describing the relationship between the datalink and network layer, I mentioned that datalink handles the hops while network is end to end. After I was done they grilled me with some questions, and one of them asked me if the datalink layer handles packets traveling across the internet, to which I replied yes. They told me I was wrong, but I didn't ask them for the right answer because I was nervous and it really didn't cross my mind to ask. But now that I've gone back to researching this topic I'm starting to get confused and I was hoping I could have someone clear this up for me. Was I wrong? Or perhaps I explained it poorly? Here's my knowledge so far:
The packet comes with headers that contain information concerning packet delivery and whatnot. The IP header has the source and destination IP address for the packet, which is used to get the packet across the internet. On the other hand the layer 2 frame header (ethernet or whatever) has the MAC address of the source (which would be the original host at this point) and the MAC address of the next router the packet is to be sent to (using ARP). The IP packet is left alone but with each hop the frame header is rewritten with a new source (the router's) MAC address and a new destination (the next hop). This is repeated within the network until a gateway within that network is reached, where the packet is then forwarded onto the ISP/provider's network. The same thing happens within the ISP/provider's network, with the packet (frame) being sent over the datalink layer while using the IP header for ARP. EGPs like BGP are used across networks, and IGPs are used within networks. And while IP addresses indicate the final destination, even over the internet MAC addresses are used to transport the data from router to router.
This makes sense to me because the internet is physically connected and MAC addresses are king when it comes to physical connections. But after being told I was wrong I've kinda lost confidence and now I'm just confusing myself. Is a different protocol or method used when data is sent from within the local network into the internet? Are MAC addresses only relevant within a network? Any help clearing this up for me is greatly appreciated. Thanks!
ip network mac-address internet
New contributor
add a comment |Â
up vote
2
down vote
favorite
I've been learning about networks recently at a new job, and I did a presentation on what I've learnt so far. When I was describing the relationship between the datalink and network layer, I mentioned that datalink handles the hops while network is end to end. After I was done they grilled me with some questions, and one of them asked me if the datalink layer handles packets traveling across the internet, to which I replied yes. They told me I was wrong, but I didn't ask them for the right answer because I was nervous and it really didn't cross my mind to ask. But now that I've gone back to researching this topic I'm starting to get confused and I was hoping I could have someone clear this up for me. Was I wrong? Or perhaps I explained it poorly? Here's my knowledge so far:
The packet comes with headers that contain information concerning packet delivery and whatnot. The IP header has the source and destination IP address for the packet, which is used to get the packet across the internet. On the other hand the layer 2 frame header (ethernet or whatever) has the MAC address of the source (which would be the original host at this point) and the MAC address of the next router the packet is to be sent to (using ARP). The IP packet is left alone but with each hop the frame header is rewritten with a new source (the router's) MAC address and a new destination (the next hop). This is repeated within the network until a gateway within that network is reached, where the packet is then forwarded onto the ISP/provider's network. The same thing happens within the ISP/provider's network, with the packet (frame) being sent over the datalink layer while using the IP header for ARP. EGPs like BGP are used across networks, and IGPs are used within networks. And while IP addresses indicate the final destination, even over the internet MAC addresses are used to transport the data from router to router.
This makes sense to me because the internet is physically connected and MAC addresses are king when it comes to physical connections. But after being told I was wrong I've kinda lost confidence and now I'm just confusing myself. Is a different protocol or method used when data is sent from within the local network into the internet? Are MAC addresses only relevant within a network? Any help clearing this up for me is greatly appreciated. Thanks!
ip network mac-address internet
New contributor
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I've been learning about networks recently at a new job, and I did a presentation on what I've learnt so far. When I was describing the relationship between the datalink and network layer, I mentioned that datalink handles the hops while network is end to end. After I was done they grilled me with some questions, and one of them asked me if the datalink layer handles packets traveling across the internet, to which I replied yes. They told me I was wrong, but I didn't ask them for the right answer because I was nervous and it really didn't cross my mind to ask. But now that I've gone back to researching this topic I'm starting to get confused and I was hoping I could have someone clear this up for me. Was I wrong? Or perhaps I explained it poorly? Here's my knowledge so far:
The packet comes with headers that contain information concerning packet delivery and whatnot. The IP header has the source and destination IP address for the packet, which is used to get the packet across the internet. On the other hand the layer 2 frame header (ethernet or whatever) has the MAC address of the source (which would be the original host at this point) and the MAC address of the next router the packet is to be sent to (using ARP). The IP packet is left alone but with each hop the frame header is rewritten with a new source (the router's) MAC address and a new destination (the next hop). This is repeated within the network until a gateway within that network is reached, where the packet is then forwarded onto the ISP/provider's network. The same thing happens within the ISP/provider's network, with the packet (frame) being sent over the datalink layer while using the IP header for ARP. EGPs like BGP are used across networks, and IGPs are used within networks. And while IP addresses indicate the final destination, even over the internet MAC addresses are used to transport the data from router to router.
This makes sense to me because the internet is physically connected and MAC addresses are king when it comes to physical connections. But after being told I was wrong I've kinda lost confidence and now I'm just confusing myself. Is a different protocol or method used when data is sent from within the local network into the internet? Are MAC addresses only relevant within a network? Any help clearing this up for me is greatly appreciated. Thanks!
ip network mac-address internet
New contributor
I've been learning about networks recently at a new job, and I did a presentation on what I've learnt so far. When I was describing the relationship between the datalink and network layer, I mentioned that datalink handles the hops while network is end to end. After I was done they grilled me with some questions, and one of them asked me if the datalink layer handles packets traveling across the internet, to which I replied yes. They told me I was wrong, but I didn't ask them for the right answer because I was nervous and it really didn't cross my mind to ask. But now that I've gone back to researching this topic I'm starting to get confused and I was hoping I could have someone clear this up for me. Was I wrong? Or perhaps I explained it poorly? Here's my knowledge so far:
The packet comes with headers that contain information concerning packet delivery and whatnot. The IP header has the source and destination IP address for the packet, which is used to get the packet across the internet. On the other hand the layer 2 frame header (ethernet or whatever) has the MAC address of the source (which would be the original host at this point) and the MAC address of the next router the packet is to be sent to (using ARP). The IP packet is left alone but with each hop the frame header is rewritten with a new source (the router's) MAC address and a new destination (the next hop). This is repeated within the network until a gateway within that network is reached, where the packet is then forwarded onto the ISP/provider's network. The same thing happens within the ISP/provider's network, with the packet (frame) being sent over the datalink layer while using the IP header for ARP. EGPs like BGP are used across networks, and IGPs are used within networks. And while IP addresses indicate the final destination, even over the internet MAC addresses are used to transport the data from router to router.
This makes sense to me because the internet is physically connected and MAC addresses are king when it comes to physical connections. But after being told I was wrong I've kinda lost confidence and now I'm just confusing myself. Is a different protocol or method used when data is sent from within the local network into the internet? Are MAC addresses only relevant within a network? Any help clearing this up for me is greatly appreciated. Thanks!
ip network mac-address internet
ip network mac-address internet
New contributor
New contributor
New contributor
asked 7 hours ago
jwoff
133
133
New contributor
New contributor
add a comment |Â
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
1
down vote
accepted
MAC addresses are only seen or relevant on the LAN where the host with that MAC address is. Routers strip off and discard layer-2 frames, losing any layer-2 information, including MAC addresses.
Remember that not all layer-2 protocols use MAC addresses, and there are 48-bit and 64-bit MAC addresses, depending on the IEEE LAN protocol used (it is the IEEE LAN protocols that use MAC addresses). Other layer-2 protocols, especially those used for WAN connections, may not use MAC addresses. For example frame relay uses DLCI, ATM uses VPI/VCI, PPP and HDLC do not really use addressing, etc.
Layer-3 protocols, like IP, are used to deliver packets between networks (an internet, hence the name: Internet Protocol), but layer-2 protocols are used to deliver frames on the same network.
Thanks for the answer! Can I get some clarification on how IP is used when packets are sent between networks? I understand the IP address is used to figure out which network to send it to but doesn't the data need to go through the datalink (and physical) layer to actually get sent? Sorry if I'm not fully comprehending your answer.
â jwoff
6 hours ago
A router will search its routing table to see if it has an entry to use to forward the packet. If not it drops the packet, otherwise is builds a new frame for the protocol of the next interface, which could be a completely different protocol than on the incoming interface. The physical and data-link of the next interface have no relationship to that of the incoming interface. Layer-3 devices bound a layer-2 LAN.
â Ron Maupinâ¦
6 hours ago
I see, I think I understand. Thank you!
â jwoff
6 hours ago
add a comment |Â
up vote
1
down vote
You need to look at the layers as each having its own mission.
The network layer is - as you wrote - end-to-end. Its addresses have global meaning (within the scope of the entire network). Accordingly, a network layer packet has a source and a destination address that don't change. NAT messes this up, but that can be seen as a translation layer or context change.
However, the network layer's mission is to make the packet routable along the hops across the network. It doesn't actually move the data. Instead, it uses the data link layer to get the data from one node to another within the current segment.
The data link layer's task is to move data (frames) across the local segment. The segment can hold a fairly large number of nodes, so you need a way to distinguish or address them - that's where MAC addresses come into play (for Ethernet and other MAC-based segments). The network layer packet is encapsulated in a data link layer frame, addressed to the next hop's "hardware" address (local to the segment) and sent over. Note that the hardware/MAC address is only meaningful within the scope of its segment.
For completeness, the data link layer doesn't actually move data either. Instead, it uses the physical layer to move the bits of the frame from one place to another, one link at a time.
Which one of the potentially many physical layer links is used (on a switch) is controlled by the data link layer (switching). At the end of the segment, the packet is extracted from the frame and forwarded across the next segment to the next hop. Which segment is used is controlled by the network layer's routing, ie. the current hop's/router's/gateway's routing table.
At the end, across all hops, the network packet is delivered to its destination address - voilÃÂ .
Thanks for the answer! So when a gateway finds the next router to send the packet to based on the destination IP and routing table, how does it send the packet to that gateway/router? Does something in the IP protocol do that or is a datalink protocol required?
â jwoff
6 hours ago
add a comment |Â
up vote
1
down vote
... as an afterword to the other fine answers ...
When we look at a packet travelling multiple hops across the internet, with the IP address "staying the same" and the MAC addresses "changing per hop", or think of the routers unwrapping an IP packet from the ethernet frame and then rewrapping it for the next segment, we are taking a birds-eye understanding the purpose of the whole enterprise.
But in an IP network, none of the machinery involved has this point of view. One of the fundamentals of the IP design is that every single packet has a routing decision made at every single hop, and these decisions are completely independent of it each other.
Thus, when a packet arrives at a router on some ethernet interface, the actions are:
- Receive frame
- Extract packet
Decide what to do:- Discard packet, or
- Consume packet, or
- Forward packet
This happens for every single packet on every single hop.
(Digressing for astonishing scale: Internet traffic is supposed to be around 150 petabyte/month, which is 150 x 1015, at an illustrative 1000 bytes/packet and 5 hops/packet, would be about 285 Mevent/sec.)
The detail is more elaborate.
(Confining my description to a packet arriving and leaving on ethernet interfaces.)
- The interface hardware checks the integrity of the frame (ethernet FCS, for example) and discards it if wrong
- The interface hardware checks the destination MAC address, and discards the frame if not for this MAC address
- It checks the content type and discards the frame if its a type this router doesn't handle
- Assuming it's an IP payload
- It unwraps the payload IP packet
- It checks the header checksum and discards if error
- It checks the destination IP address and if for this router consumes it locally
- Assuming for some other host (and TTL > 1)
- Checks routing table
- Assuming it's for another network connected by an ethernet interface
- Makes appropriate change (decrement TTL, fragment, recompute header checksums)
- Finds target MAC address from routing table/cache/ARP
- Wraps IP packet in ethernet frame and transmits
At step 2, the incoming frame's destination MAC address was the MAC address of the incoming interface; at step 13 the outgoing frame has the router's outgoing interface MAC address for source, and the next hop router's MAC address as destination.
Of course, the operating system of the router is likely to add various security checks, logging and accounting along the way.
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
MAC addresses are only seen or relevant on the LAN where the host with that MAC address is. Routers strip off and discard layer-2 frames, losing any layer-2 information, including MAC addresses.
Remember that not all layer-2 protocols use MAC addresses, and there are 48-bit and 64-bit MAC addresses, depending on the IEEE LAN protocol used (it is the IEEE LAN protocols that use MAC addresses). Other layer-2 protocols, especially those used for WAN connections, may not use MAC addresses. For example frame relay uses DLCI, ATM uses VPI/VCI, PPP and HDLC do not really use addressing, etc.
Layer-3 protocols, like IP, are used to deliver packets between networks (an internet, hence the name: Internet Protocol), but layer-2 protocols are used to deliver frames on the same network.
Thanks for the answer! Can I get some clarification on how IP is used when packets are sent between networks? I understand the IP address is used to figure out which network to send it to but doesn't the data need to go through the datalink (and physical) layer to actually get sent? Sorry if I'm not fully comprehending your answer.
â jwoff
6 hours ago
A router will search its routing table to see if it has an entry to use to forward the packet. If not it drops the packet, otherwise is builds a new frame for the protocol of the next interface, which could be a completely different protocol than on the incoming interface. The physical and data-link of the next interface have no relationship to that of the incoming interface. Layer-3 devices bound a layer-2 LAN.
â Ron Maupinâ¦
6 hours ago
I see, I think I understand. Thank you!
â jwoff
6 hours ago
add a comment |Â
up vote
1
down vote
accepted
MAC addresses are only seen or relevant on the LAN where the host with that MAC address is. Routers strip off and discard layer-2 frames, losing any layer-2 information, including MAC addresses.
Remember that not all layer-2 protocols use MAC addresses, and there are 48-bit and 64-bit MAC addresses, depending on the IEEE LAN protocol used (it is the IEEE LAN protocols that use MAC addresses). Other layer-2 protocols, especially those used for WAN connections, may not use MAC addresses. For example frame relay uses DLCI, ATM uses VPI/VCI, PPP and HDLC do not really use addressing, etc.
Layer-3 protocols, like IP, are used to deliver packets between networks (an internet, hence the name: Internet Protocol), but layer-2 protocols are used to deliver frames on the same network.
Thanks for the answer! Can I get some clarification on how IP is used when packets are sent between networks? I understand the IP address is used to figure out which network to send it to but doesn't the data need to go through the datalink (and physical) layer to actually get sent? Sorry if I'm not fully comprehending your answer.
â jwoff
6 hours ago
A router will search its routing table to see if it has an entry to use to forward the packet. If not it drops the packet, otherwise is builds a new frame for the protocol of the next interface, which could be a completely different protocol than on the incoming interface. The physical and data-link of the next interface have no relationship to that of the incoming interface. Layer-3 devices bound a layer-2 LAN.
â Ron Maupinâ¦
6 hours ago
I see, I think I understand. Thank you!
â jwoff
6 hours ago
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
MAC addresses are only seen or relevant on the LAN where the host with that MAC address is. Routers strip off and discard layer-2 frames, losing any layer-2 information, including MAC addresses.
Remember that not all layer-2 protocols use MAC addresses, and there are 48-bit and 64-bit MAC addresses, depending on the IEEE LAN protocol used (it is the IEEE LAN protocols that use MAC addresses). Other layer-2 protocols, especially those used for WAN connections, may not use MAC addresses. For example frame relay uses DLCI, ATM uses VPI/VCI, PPP and HDLC do not really use addressing, etc.
Layer-3 protocols, like IP, are used to deliver packets between networks (an internet, hence the name: Internet Protocol), but layer-2 protocols are used to deliver frames on the same network.
MAC addresses are only seen or relevant on the LAN where the host with that MAC address is. Routers strip off and discard layer-2 frames, losing any layer-2 information, including MAC addresses.
Remember that not all layer-2 protocols use MAC addresses, and there are 48-bit and 64-bit MAC addresses, depending on the IEEE LAN protocol used (it is the IEEE LAN protocols that use MAC addresses). Other layer-2 protocols, especially those used for WAN connections, may not use MAC addresses. For example frame relay uses DLCI, ATM uses VPI/VCI, PPP and HDLC do not really use addressing, etc.
Layer-3 protocols, like IP, are used to deliver packets between networks (an internet, hence the name: Internet Protocol), but layer-2 protocols are used to deliver frames on the same network.
answered 6 hours ago
Ron Maupinâ¦
58.3k1056101
58.3k1056101
Thanks for the answer! Can I get some clarification on how IP is used when packets are sent between networks? I understand the IP address is used to figure out which network to send it to but doesn't the data need to go through the datalink (and physical) layer to actually get sent? Sorry if I'm not fully comprehending your answer.
â jwoff
6 hours ago
A router will search its routing table to see if it has an entry to use to forward the packet. If not it drops the packet, otherwise is builds a new frame for the protocol of the next interface, which could be a completely different protocol than on the incoming interface. The physical and data-link of the next interface have no relationship to that of the incoming interface. Layer-3 devices bound a layer-2 LAN.
â Ron Maupinâ¦
6 hours ago
I see, I think I understand. Thank you!
â jwoff
6 hours ago
add a comment |Â
Thanks for the answer! Can I get some clarification on how IP is used when packets are sent between networks? I understand the IP address is used to figure out which network to send it to but doesn't the data need to go through the datalink (and physical) layer to actually get sent? Sorry if I'm not fully comprehending your answer.
â jwoff
6 hours ago
A router will search its routing table to see if it has an entry to use to forward the packet. If not it drops the packet, otherwise is builds a new frame for the protocol of the next interface, which could be a completely different protocol than on the incoming interface. The physical and data-link of the next interface have no relationship to that of the incoming interface. Layer-3 devices bound a layer-2 LAN.
â Ron Maupinâ¦
6 hours ago
I see, I think I understand. Thank you!
â jwoff
6 hours ago
Thanks for the answer! Can I get some clarification on how IP is used when packets are sent between networks? I understand the IP address is used to figure out which network to send it to but doesn't the data need to go through the datalink (and physical) layer to actually get sent? Sorry if I'm not fully comprehending your answer.
â jwoff
6 hours ago
Thanks for the answer! Can I get some clarification on how IP is used when packets are sent between networks? I understand the IP address is used to figure out which network to send it to but doesn't the data need to go through the datalink (and physical) layer to actually get sent? Sorry if I'm not fully comprehending your answer.
â jwoff
6 hours ago
A router will search its routing table to see if it has an entry to use to forward the packet. If not it drops the packet, otherwise is builds a new frame for the protocol of the next interface, which could be a completely different protocol than on the incoming interface. The physical and data-link of the next interface have no relationship to that of the incoming interface. Layer-3 devices bound a layer-2 LAN.
â Ron Maupinâ¦
6 hours ago
A router will search its routing table to see if it has an entry to use to forward the packet. If not it drops the packet, otherwise is builds a new frame for the protocol of the next interface, which could be a completely different protocol than on the incoming interface. The physical and data-link of the next interface have no relationship to that of the incoming interface. Layer-3 devices bound a layer-2 LAN.
â Ron Maupinâ¦
6 hours ago
I see, I think I understand. Thank you!
â jwoff
6 hours ago
I see, I think I understand. Thank you!
â jwoff
6 hours ago
add a comment |Â
up vote
1
down vote
You need to look at the layers as each having its own mission.
The network layer is - as you wrote - end-to-end. Its addresses have global meaning (within the scope of the entire network). Accordingly, a network layer packet has a source and a destination address that don't change. NAT messes this up, but that can be seen as a translation layer or context change.
However, the network layer's mission is to make the packet routable along the hops across the network. It doesn't actually move the data. Instead, it uses the data link layer to get the data from one node to another within the current segment.
The data link layer's task is to move data (frames) across the local segment. The segment can hold a fairly large number of nodes, so you need a way to distinguish or address them - that's where MAC addresses come into play (for Ethernet and other MAC-based segments). The network layer packet is encapsulated in a data link layer frame, addressed to the next hop's "hardware" address (local to the segment) and sent over. Note that the hardware/MAC address is only meaningful within the scope of its segment.
For completeness, the data link layer doesn't actually move data either. Instead, it uses the physical layer to move the bits of the frame from one place to another, one link at a time.
Which one of the potentially many physical layer links is used (on a switch) is controlled by the data link layer (switching). At the end of the segment, the packet is extracted from the frame and forwarded across the next segment to the next hop. Which segment is used is controlled by the network layer's routing, ie. the current hop's/router's/gateway's routing table.
At the end, across all hops, the network packet is delivered to its destination address - voilÃÂ .
Thanks for the answer! So when a gateway finds the next router to send the packet to based on the destination IP and routing table, how does it send the packet to that gateway/router? Does something in the IP protocol do that or is a datalink protocol required?
â jwoff
6 hours ago
add a comment |Â
up vote
1
down vote
You need to look at the layers as each having its own mission.
The network layer is - as you wrote - end-to-end. Its addresses have global meaning (within the scope of the entire network). Accordingly, a network layer packet has a source and a destination address that don't change. NAT messes this up, but that can be seen as a translation layer or context change.
However, the network layer's mission is to make the packet routable along the hops across the network. It doesn't actually move the data. Instead, it uses the data link layer to get the data from one node to another within the current segment.
The data link layer's task is to move data (frames) across the local segment. The segment can hold a fairly large number of nodes, so you need a way to distinguish or address them - that's where MAC addresses come into play (for Ethernet and other MAC-based segments). The network layer packet is encapsulated in a data link layer frame, addressed to the next hop's "hardware" address (local to the segment) and sent over. Note that the hardware/MAC address is only meaningful within the scope of its segment.
For completeness, the data link layer doesn't actually move data either. Instead, it uses the physical layer to move the bits of the frame from one place to another, one link at a time.
Which one of the potentially many physical layer links is used (on a switch) is controlled by the data link layer (switching). At the end of the segment, the packet is extracted from the frame and forwarded across the next segment to the next hop. Which segment is used is controlled by the network layer's routing, ie. the current hop's/router's/gateway's routing table.
At the end, across all hops, the network packet is delivered to its destination address - voilÃÂ .
Thanks for the answer! So when a gateway finds the next router to send the packet to based on the destination IP and routing table, how does it send the packet to that gateway/router? Does something in the IP protocol do that or is a datalink protocol required?
â jwoff
6 hours ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
You need to look at the layers as each having its own mission.
The network layer is - as you wrote - end-to-end. Its addresses have global meaning (within the scope of the entire network). Accordingly, a network layer packet has a source and a destination address that don't change. NAT messes this up, but that can be seen as a translation layer or context change.
However, the network layer's mission is to make the packet routable along the hops across the network. It doesn't actually move the data. Instead, it uses the data link layer to get the data from one node to another within the current segment.
The data link layer's task is to move data (frames) across the local segment. The segment can hold a fairly large number of nodes, so you need a way to distinguish or address them - that's where MAC addresses come into play (for Ethernet and other MAC-based segments). The network layer packet is encapsulated in a data link layer frame, addressed to the next hop's "hardware" address (local to the segment) and sent over. Note that the hardware/MAC address is only meaningful within the scope of its segment.
For completeness, the data link layer doesn't actually move data either. Instead, it uses the physical layer to move the bits of the frame from one place to another, one link at a time.
Which one of the potentially many physical layer links is used (on a switch) is controlled by the data link layer (switching). At the end of the segment, the packet is extracted from the frame and forwarded across the next segment to the next hop. Which segment is used is controlled by the network layer's routing, ie. the current hop's/router's/gateway's routing table.
At the end, across all hops, the network packet is delivered to its destination address - voilÃÂ .
You need to look at the layers as each having its own mission.
The network layer is - as you wrote - end-to-end. Its addresses have global meaning (within the scope of the entire network). Accordingly, a network layer packet has a source and a destination address that don't change. NAT messes this up, but that can be seen as a translation layer or context change.
However, the network layer's mission is to make the packet routable along the hops across the network. It doesn't actually move the data. Instead, it uses the data link layer to get the data from one node to another within the current segment.
The data link layer's task is to move data (frames) across the local segment. The segment can hold a fairly large number of nodes, so you need a way to distinguish or address them - that's where MAC addresses come into play (for Ethernet and other MAC-based segments). The network layer packet is encapsulated in a data link layer frame, addressed to the next hop's "hardware" address (local to the segment) and sent over. Note that the hardware/MAC address is only meaningful within the scope of its segment.
For completeness, the data link layer doesn't actually move data either. Instead, it uses the physical layer to move the bits of the frame from one place to another, one link at a time.
Which one of the potentially many physical layer links is used (on a switch) is controlled by the data link layer (switching). At the end of the segment, the packet is extracted from the frame and forwarded across the next segment to the next hop. Which segment is used is controlled by the network layer's routing, ie. the current hop's/router's/gateway's routing table.
At the end, across all hops, the network packet is delivered to its destination address - voilÃÂ .
answered 6 hours ago
Zac67
21.4k21149
21.4k21149
Thanks for the answer! So when a gateway finds the next router to send the packet to based on the destination IP and routing table, how does it send the packet to that gateway/router? Does something in the IP protocol do that or is a datalink protocol required?
â jwoff
6 hours ago
add a comment |Â
Thanks for the answer! So when a gateway finds the next router to send the packet to based on the destination IP and routing table, how does it send the packet to that gateway/router? Does something in the IP protocol do that or is a datalink protocol required?
â jwoff
6 hours ago
Thanks for the answer! So when a gateway finds the next router to send the packet to based on the destination IP and routing table, how does it send the packet to that gateway/router? Does something in the IP protocol do that or is a datalink protocol required?
â jwoff
6 hours ago
Thanks for the answer! So when a gateway finds the next router to send the packet to based on the destination IP and routing table, how does it send the packet to that gateway/router? Does something in the IP protocol do that or is a datalink protocol required?
â jwoff
6 hours ago
add a comment |Â
up vote
1
down vote
... as an afterword to the other fine answers ...
When we look at a packet travelling multiple hops across the internet, with the IP address "staying the same" and the MAC addresses "changing per hop", or think of the routers unwrapping an IP packet from the ethernet frame and then rewrapping it for the next segment, we are taking a birds-eye understanding the purpose of the whole enterprise.
But in an IP network, none of the machinery involved has this point of view. One of the fundamentals of the IP design is that every single packet has a routing decision made at every single hop, and these decisions are completely independent of it each other.
Thus, when a packet arrives at a router on some ethernet interface, the actions are:
- Receive frame
- Extract packet
Decide what to do:- Discard packet, or
- Consume packet, or
- Forward packet
This happens for every single packet on every single hop.
(Digressing for astonishing scale: Internet traffic is supposed to be around 150 petabyte/month, which is 150 x 1015, at an illustrative 1000 bytes/packet and 5 hops/packet, would be about 285 Mevent/sec.)
The detail is more elaborate.
(Confining my description to a packet arriving and leaving on ethernet interfaces.)
- The interface hardware checks the integrity of the frame (ethernet FCS, for example) and discards it if wrong
- The interface hardware checks the destination MAC address, and discards the frame if not for this MAC address
- It checks the content type and discards the frame if its a type this router doesn't handle
- Assuming it's an IP payload
- It unwraps the payload IP packet
- It checks the header checksum and discards if error
- It checks the destination IP address and if for this router consumes it locally
- Assuming for some other host (and TTL > 1)
- Checks routing table
- Assuming it's for another network connected by an ethernet interface
- Makes appropriate change (decrement TTL, fragment, recompute header checksums)
- Finds target MAC address from routing table/cache/ARP
- Wraps IP packet in ethernet frame and transmits
At step 2, the incoming frame's destination MAC address was the MAC address of the incoming interface; at step 13 the outgoing frame has the router's outgoing interface MAC address for source, and the next hop router's MAC address as destination.
Of course, the operating system of the router is likely to add various security checks, logging and accounting along the way.
add a comment |Â
up vote
1
down vote
... as an afterword to the other fine answers ...
When we look at a packet travelling multiple hops across the internet, with the IP address "staying the same" and the MAC addresses "changing per hop", or think of the routers unwrapping an IP packet from the ethernet frame and then rewrapping it for the next segment, we are taking a birds-eye understanding the purpose of the whole enterprise.
But in an IP network, none of the machinery involved has this point of view. One of the fundamentals of the IP design is that every single packet has a routing decision made at every single hop, and these decisions are completely independent of it each other.
Thus, when a packet arrives at a router on some ethernet interface, the actions are:
- Receive frame
- Extract packet
Decide what to do:- Discard packet, or
- Consume packet, or
- Forward packet
This happens for every single packet on every single hop.
(Digressing for astonishing scale: Internet traffic is supposed to be around 150 petabyte/month, which is 150 x 1015, at an illustrative 1000 bytes/packet and 5 hops/packet, would be about 285 Mevent/sec.)
The detail is more elaborate.
(Confining my description to a packet arriving and leaving on ethernet interfaces.)
- The interface hardware checks the integrity of the frame (ethernet FCS, for example) and discards it if wrong
- The interface hardware checks the destination MAC address, and discards the frame if not for this MAC address
- It checks the content type and discards the frame if its a type this router doesn't handle
- Assuming it's an IP payload
- It unwraps the payload IP packet
- It checks the header checksum and discards if error
- It checks the destination IP address and if for this router consumes it locally
- Assuming for some other host (and TTL > 1)
- Checks routing table
- Assuming it's for another network connected by an ethernet interface
- Makes appropriate change (decrement TTL, fragment, recompute header checksums)
- Finds target MAC address from routing table/cache/ARP
- Wraps IP packet in ethernet frame and transmits
At step 2, the incoming frame's destination MAC address was the MAC address of the incoming interface; at step 13 the outgoing frame has the router's outgoing interface MAC address for source, and the next hop router's MAC address as destination.
Of course, the operating system of the router is likely to add various security checks, logging and accounting along the way.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
... as an afterword to the other fine answers ...
When we look at a packet travelling multiple hops across the internet, with the IP address "staying the same" and the MAC addresses "changing per hop", or think of the routers unwrapping an IP packet from the ethernet frame and then rewrapping it for the next segment, we are taking a birds-eye understanding the purpose of the whole enterprise.
But in an IP network, none of the machinery involved has this point of view. One of the fundamentals of the IP design is that every single packet has a routing decision made at every single hop, and these decisions are completely independent of it each other.
Thus, when a packet arrives at a router on some ethernet interface, the actions are:
- Receive frame
- Extract packet
Decide what to do:- Discard packet, or
- Consume packet, or
- Forward packet
This happens for every single packet on every single hop.
(Digressing for astonishing scale: Internet traffic is supposed to be around 150 petabyte/month, which is 150 x 1015, at an illustrative 1000 bytes/packet and 5 hops/packet, would be about 285 Mevent/sec.)
The detail is more elaborate.
(Confining my description to a packet arriving and leaving on ethernet interfaces.)
- The interface hardware checks the integrity of the frame (ethernet FCS, for example) and discards it if wrong
- The interface hardware checks the destination MAC address, and discards the frame if not for this MAC address
- It checks the content type and discards the frame if its a type this router doesn't handle
- Assuming it's an IP payload
- It unwraps the payload IP packet
- It checks the header checksum and discards if error
- It checks the destination IP address and if for this router consumes it locally
- Assuming for some other host (and TTL > 1)
- Checks routing table
- Assuming it's for another network connected by an ethernet interface
- Makes appropriate change (decrement TTL, fragment, recompute header checksums)
- Finds target MAC address from routing table/cache/ARP
- Wraps IP packet in ethernet frame and transmits
At step 2, the incoming frame's destination MAC address was the MAC address of the incoming interface; at step 13 the outgoing frame has the router's outgoing interface MAC address for source, and the next hop router's MAC address as destination.
Of course, the operating system of the router is likely to add various security checks, logging and accounting along the way.
... as an afterword to the other fine answers ...
When we look at a packet travelling multiple hops across the internet, with the IP address "staying the same" and the MAC addresses "changing per hop", or think of the routers unwrapping an IP packet from the ethernet frame and then rewrapping it for the next segment, we are taking a birds-eye understanding the purpose of the whole enterprise.
But in an IP network, none of the machinery involved has this point of view. One of the fundamentals of the IP design is that every single packet has a routing decision made at every single hop, and these decisions are completely independent of it each other.
Thus, when a packet arrives at a router on some ethernet interface, the actions are:
- Receive frame
- Extract packet
Decide what to do:- Discard packet, or
- Consume packet, or
- Forward packet
This happens for every single packet on every single hop.
(Digressing for astonishing scale: Internet traffic is supposed to be around 150 petabyte/month, which is 150 x 1015, at an illustrative 1000 bytes/packet and 5 hops/packet, would be about 285 Mevent/sec.)
The detail is more elaborate.
(Confining my description to a packet arriving and leaving on ethernet interfaces.)
- The interface hardware checks the integrity of the frame (ethernet FCS, for example) and discards it if wrong
- The interface hardware checks the destination MAC address, and discards the frame if not for this MAC address
- It checks the content type and discards the frame if its a type this router doesn't handle
- Assuming it's an IP payload
- It unwraps the payload IP packet
- It checks the header checksum and discards if error
- It checks the destination IP address and if for this router consumes it locally
- Assuming for some other host (and TTL > 1)
- Checks routing table
- Assuming it's for another network connected by an ethernet interface
- Makes appropriate change (decrement TTL, fragment, recompute header checksums)
- Finds target MAC address from routing table/cache/ARP
- Wraps IP packet in ethernet frame and transmits
At step 2, the incoming frame's destination MAC address was the MAC address of the incoming interface; at step 13 the outgoing frame has the router's outgoing interface MAC address for source, and the next hop router's MAC address as destination.
Of course, the operating system of the router is likely to add various security checks, logging and accounting along the way.
edited 58 mins ago
answered 2 hours ago
jonathanjo
6,770423
6,770423
add a comment |Â
add a comment |Â
jwoff is a new contributor. Be nice, and check out our Code of Conduct.
jwoff is a new contributor. Be nice, and check out our Code of Conduct.
jwoff is a new contributor. Be nice, and check out our Code of Conduct.
jwoff is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fnetworkengineering.stackexchange.com%2fquestions%2f54065%2fneed-help-understanding-how-packets-travel-across-the-internet%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password