The Network Layer: Forwarding & IP

a datagram

A datagram is a self-contained packet that carries its own complete destination address, like a postcard you can drop in any mailbox without first phoning the post office to set up a route. Each datagram travels independently: the network looks at the address on each one as it arrives and decides where to send it next, with no memory of the datagrams that came before.

This is the model the Internet chose, and it is called the datagram model (in contrast to the virtual-circuit model). When you send a stream of data, it is chopped into many datagrams, and each is forwarded on its own. Two datagrams from the same conversation may take different paths, arrive out of order, or one may be lost while the other gets through, because the routers in the middle keep no per-conversation state — they decide hop by hop, purely from the destination address each datagram carries.

The payoff of this design is robustness and simplicity. Routers stay stateless and simple, so they are fast and cheap, and if a router fails the surviving routers can route around it on the very next datagram without tearing down and rebuilding anything. The cost is that all the cleanup — reordering, detecting loss, retransmitting — is pushed to the end hosts (this is the end-to-end principle in action). On the Internet, an IP datagram is the concrete unit of the datagram model.

You stream a video as 50,000 datagrams. Datagram #4012 might cross the Atlantic via London while #4013 goes via Amsterdam; #4013 may even arrive first. The network does not care — each one carried its own address and was forwarded on its own merits.

Independent, self-addressed packets — the Internet's core delivery model.

Datagram and packet are often used interchangeably. Strictly, datagram emphasizes the connectionless, independently-routed model; packet is the more general word for any formatted unit of data on a network.

Also called
packet資料報資料包