Lecture 19: Networking overview; ethernet

Ethernet overview

A network is a group of computers (which I will also call nodes, hosts, or machines) that are connected together.

The physical medium that is used to connect them (e.g. twisted pairs of wires, radio waves, fiber-optic cable, etc) along with the rules for interpreting those signals (e.g. high voltage means 1) are referred to as the physical layer of the network. The physical layer gives a mechanism for transmitting a packet of bits from one host to another.

On top of the physical layer, the link layer defines how packets of bits should be sent and received. Ethernet is the most commonly used link-layer protocol.

Ethernet is a broadcast protocol: many hosts are connected to all other hosts. To send a packet, the sender first checks to see if the medium is in use. If not, it places the packet on the wire. It is possible that there are collisions if two hosts on the same network try to send at the same time. Senders are responsible for listening to the network to ensure that the packets they sent were received. If a collision is detected, the sender may retransmit after a delay. If the packet fails multiple times, it may be dropped. To detect collisions, ethernet packets contain a checksum.

Checking before transmitting is sometimes called "carrier sense (CS)"; the fact that hosts can communicate without mastering the bus is sometimes called "multiple access (MA)". Ethernet uses collision detection (CD), so Ethernet is therefore sometimes described as a "CSMA/CD" protocol.

Every ethernet packet contains a destination address; each receiver is responsible for discarding packets that are not destined for them. However, many network cards can be placed in promiscuous mode, where every packet is received whether it is addressed to the host or not.

End-to-end principle

Ethernet does not provide guaranteed delivery. If it does not detect a collision, it does not retransmit, even though the packet could have been lost for other reasons.

We could imagine building a more robust protocol by having the recipients respond with an acknowlegement. For example, we discussed a token ring, in which communication tokens are passed from one host to the next; if a message comes back to the sender without having been read, then the sender knows it was not received and can respond appropriately.

The end-to-end principle argues that adding additional complexity at this layer does not and cannot save other parts of the system from resolving the same problems. For example, even if the network can reliably deliver packets, a file transfer program will still have to implement some kind of acknowlegement to indicate that the file has been successfully written to disk. With this acknowlegement in place, acknowlegements at the ethernet layer become redundant.

OSI layers

The protocols that control network communication are organized in a "stack", with each layer of the stack using the properties of the lower layers to provide features to higher layers.

We have already discussed the physical and link layers; these sit at the bottom of the stack. With only link layer protocols, a machine can send a fixed-size packet of data to another machine on the same local area network.

The network (or internet) layer sits above the link layer and connects together multiple local area networks. With the network layer, a machine can send a packet to another machine anywhere on the internet.

The transport layer uses the network layer and provides the ability for processes on different machines to communicate with each other. The transport layer may also provide reliable, in-order delivery of data.

The session layer gives applications the ability to establish and tear down connections with other processes. It is closely tied to the transport layer.

The presentation layer defines the translation from abstract concepts (such as "integers") to concrete arrays of bytes. For example, the presentation layer might specify the endianness of integers contained in messages, or how strings are encoded. The presentation layer is closely tied to the application layer.

The application layer is the application-specific protocol that individual clients and servers use to communicate.

In the coming lectures, we will make our way up the network stack, discussing the operation of each layer.