|
Question : Question about some basic packet addressing concepts at layer 2 & 3 in an ip network
|
|
Just trying to get my head round some low level network concepts - specifically packet addressing at the various OSI layers.
Imagine a simple sample IP network. 1 host machine connected to a layer 2 switch, then to a router, then onto the internet.
Say I want to send an http packet to bbc.co.uk (212.58.224.131) from my host machine.
THREE QUESTIONS:
1. At the point the packet leaves my host machine, am I correct in thinking that the layer 3 destination address will be: 212.58.224.131 ? What then will be the layer 2 destination address of that packet - will it be the MAC address of the layer 2 switch or the MAC address of the router? In terms of the fundamentals, am I right in thinking the destination IP address of that packet will never change, whereas the MAC address will be updated for each 'hop' along the way?
2. If I'm right in my asumptions above, what is the first MAC destination address for the packet leaving my host machine in my exampel network - would it be the layer 2 switch or the router? I'm guessing it will the MAc address of the router? And the layer 2 switch will simply forward on the packet on the correct interface? If it was a layer 3 switch however, would this be different?
3. The other thing I'm trying to get my head round is the default gateway address on the host. Unless a route is specifically specified on the host, all outgoing packets will be 'through' this destination address to reach their final destination. Now am I right in thinking that the http packet that leaves my host machine will not have it's destination IP address as that default gateway IP address, rather the host machine will (through doing an ARP request) find out the MAC (layer 2) address of the device with that default gateway IP (layer 3 address) and structure the resulting packet so that's it's MAC address is the address of the default gateway device (in our example, the router), but it's IP address is still that of bbc.co.uk (212.58.224.131) ?
|
Answer : Question about some basic packet addressing concepts at layer 2 & 3 in an ip network
|
|
I think the best way to explain this is to start with Layer 3.
Let's say your PC has the following IP configuration: IP address 10.1.1.100 subnet mask 255.255.255.0 default gateway 10.1.1.1
First, the PC looks at the IP address and subnetmask to determine if the destination (212.58.224.131) is on the subnet or not. If the destination is on the local subnet, then the packet is sent to the switch, which maimtains a database of connected MAC addresses. If the destination is not on the subnet, then the packet must be routed. It is sent to the default gateway (otherwise known as the next-hop). Assuming the default gateway if your router (connected to the internet). The router maintains a routing table and basically goes through a similar process to see if the destination is on any of it's interfaces or if it knows of a specific route to that destination. If not, it forwards the packet to it's default gateway, and so on.
At the Layer 2 level, the packets are sent directly to the MAC address of the default gateway once it's determined that the destination is not on the local subnet.
So to specifically answer your questions: 1. Yes, the Layer 2 destination will always be the next hop until it reaches the destination's subnet. 2. Yes, a Layer 3 switch is one that is capable of routing. Basically, it is a switch/router. 3. Correct.
|
|
|
|