How do frames and packets traverse the internet?

kfranc9

Member
Jun 6, 2004
147
0
0
I am currently a college student but I have some pretty good experience in IT. My teacher made a statement and I'd like to find out if its true:

The question is, how do frames (which I am more interested in) and packets travel across the internet?

His answer:
An IP packet's source and destination address does not change traveling from router to router.
A frame's source and destination address changes at every router it travels through.

I think this is as simple as i can put it. Does anyone know how this actually works?
 

spidey07

No Lifer
Aug 4, 2000
65,469
5
76
That's completely correct and an important point to learn. frames travel from source to destination at layer2 - mac addresses. A router separates layer2 networks. Packets are layer3 and no addressing changes take place. That's why it's called the network layer, used for inter-network communication.

When a packet goes through a router a few things are happening
1) the frame has a DST mac address of the router interface
2) router gets the frame, which contains the packet
3) router checks routing table, decides what interface to send it out of and what layer2 destination address this is
4) router uses it's L2 address as the source, and L2 address of the next hope for the destination
5) router lowers TTL in the IP layer (L3)
 

kfranc9

Member
Jun 6, 2004
147
0
0
OK, i guess what I don't understand is why. Why does a router look at layer 2 information? (I probably already know this answer) Furthermore, why is it important that it change the source and destination MAC address?
 

ScottMac

Moderator<br>Networking<br>Elite member
Mar 19, 2001
5,471
2
0
For each segment defined by a router (or Layer 3) endpoint, the packet is taken out of the frame it arrived in, evaluated to some extent (usually to see if it needs to be forwarded further), then it is installed in a new frame for transmission across the next segment.

It would be like a snail mail letter being sent to your local post office, they open it (remove the packet from the frame) read it (evaluate it for further action), then put it a new envelope, addressed to the next-closest post office (the next router upstream) , where the process is repeated until the letter gets to where it's going.

It gets a new Layer 2 address each hop because the sending router must re-encapsulate the packet to send it to the next hop.

Remember that the Layer 2 can be Ethrnet, ISDN, Frame-Relay, ATM, IPX/Novell ... each with their own encpasulation. Even Ethernet has Ethernet II, 802.3, SNAP and some other frame types; all are different.
 

drebo

Diamond Member
Feb 24, 2006
7,034
1
81
Originally posted by: kfranc9
OK, i guess what I don't understand is why. Why does a router look at layer 2 information? (I probably already know this answer) Furthermore, why is it important that it change the source and destination MAC address?

Every network device looks at layer 2 to make sure that a frame is addressed to itself. (this is probably an oversimplification, but let it be)

In spidey's example, the host computer knows its own network and how to get around within the local network, however anything outside of that is foreign. That's why computers that access external networks have a default gateway. The default gateway can direct packets to other networks. When the host computer sends a packet to a network other than its own, it sends the packet addressed to its end recipient, and the frame addressed to its default gateway.

So, when your computer on network 192.168.1.0/24 wants to get to the server located at 4.2.2.1, it's going to address your packet to 4.2.2.1 and your frame to the hardware address of the default gateway. The default gateway sees an incoming packet with its address and therefore knows to look at it further...sees that the layer 3 is to another network and forwards it if possible to its next-hop router on the way to the destination network.

So, the layer 2 address has to change at each hop in order for the frame to be forwarded to the next physical device. The layer 3 addresses cannot change, otherwise the routers would not know where the packet needs to be forwarded to.
 

ScottMac

Moderator<br>Networking<br>Elite member
Mar 19, 2001
5,471
2
0
Originally posted by: Nuwave
Can you explain to me NAT and what exactly it does? Examples earn brownie points!

Start this as another topic if you're really interested. Don't threadjack this one.

Thanks