Textbook: None related
Layers headers physical layer Internetwork layer addresses packets gateway routing IP header Transport layer ports clients and servers reliable delivery TCP header Application layer HTTP
Modern operating systems must include some support of networking. In fact, they basically have to support TCP/IP, the de facto world networking standard. (It hasn't always been that way, but with the explosion of the Internet it has.)
On one level... The Internet is a network of wires connected with computers. On another... The Internet gives programs the capability to communicate between computers. TCP bridges this gap by decomposing it into a set of four layers:
Each layer adds a header explaining how to handle the message.
+----------+--------------+-----------+------------------------------+ | physical | internetwork | transport | application | | header | header | header | message | +----------+--------------+-----------+------------------------------+ <--- front
Of the physical layer we will say little: It magically sends a message across a single network.
The Internet is a network of networks.
/--------\ /------------\ | CMU CS | ---- | CMU Andrew | \--------/ \------------/ \ / \ /-----\ / | PSC | \-----/ | /-----\ /----\ | MCI | ---- | OU | \-----/ \----/Each network can deliver messages within itself directly. Messages between networks must find their way - without a map!
Networks have gateways, computers that route messages between networks.
/---------\ /------------\ | CMU CS | | CMU Andrew | | | --- gw.cs --- | | gs88.sp | | truffle.bh | \---------/ \------------/ | rtrbone.net | /------\ /-------\ | | | PSC | | Pitt | -- pitt-ip-fddi -- | | | | | mario | \------/ \-------/ | nss5.psc | /-------\ | MCI | \-------/Packets travel gateway to gateway until reaching destination network.
Now we look at the internetwork layer, implemented using IP (Internet Protocol).
IP provides best-effort delivery: It makes a good try to get packet to destination computer but may lose (drop) it.
Reasons for dropping a packet include
Packet drops are frequent (50% not uncommon). The endpoints negotiate and resend until all packets make it.
Machines have two names: a mnemonic English name
jasmine.bh.andrew.cmu.eduand a 4-byte IP address
128.2.124.152The IP address is used to describe the destination of a message.
Before a message is sent, it is divided into packets.
1011011011100010010000... original message | | | | v v v v ...|1011011 ...|0111000 ...|1001000 ...|... packets ^ headerEach packet has about 1,000 bytes.
Each gateway has a routing table telling where to send packets.
/----------\ | 10.*.*.* | rest of \----------/ Internet | | | 10.0.0.5 /----------\ o | 40.*.*.* | | 20.0.0.5 \----------/ | | /----------\ 20.0.0.6 30.0.0.6 /----------\ 30.0.0.7 | 40.0.0.7 | 20.*.*.* | -------- o -------- | 30.*.*.* | -------- o \----------/ \----------/The routing table for 20.0.0.6/30.0.0.6 in this network would be
if destination then route network is... to... 20.*.*.* destination directly 30.*.*.* destination directly 10.*.*.* 20.0.0.5 40.*.*.* 30.0.0.7 otherwise 30.0.0.7
Periodically gateways tell their neighbors about the best routes they know to destination networks. When a gateway receives this information, it updates its routing table and forwards information about any changes to its neighbors.
The following is a version 6 header.
byte 0 IP version number (in this case, 6) byte 1 ignore byte 4 length of packet byte 6 transport protocol byte 7 hop limit (subtract 1 each gateway, drop if 0, to avoid immortal packets) byte 8 source computer IP address byte 24 destination computer IP address byte 40 : transport layer message
IP gives us
Each program reserves a port of communication so that other prograsm can specify which program should receive its messages.
port | protocol |
---|---|
21 | FTP |
25 | SMTP |
80 | HTTP |
The server is a program waiting on a computer with a port reserved. A client reserves a port on its own computer and sends messages to the server by sending messages to the server's port-computer combination. Then the server can respond by sending messages to the client's port-computer combination. And they talk.
(Notice there's nothing wrong with a server or client talking to multiple programs using the same port.)
One challenging problem is deciding how long to wait before giving up on acknowledgements. The sender adapts based on what it has recently seen. Doing this well turns out to be quite complicated. We'll skip the details on this adaptation process - it's complicated.
But this simple acknowledge technique has a major problem that we will address: It's very slow.
+-------------------+ +----|----+----+----+----|----+----+----+----+----+----+ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | +----|----+----+----+----|----+----+----+----+----+----+ +-------------------+ A sliding window of size 4The window size corresponds to the number of buckets.
byte 0 source port byte 2 destination port byte 4 sequence number (tells which segment is sent) byte 8 acknowledgement number (tells which segment has been received) byte 12 header length byte 12.5 ignore byte 14 desired window size byte 16 ignore byte 20 : options : byte ?? : application message
Now we move onto the application layer. We'll look at two application layer protocols: HTTP and SMTP. HTTP is the protocol used for the World-Wide Web.
We're going to look at HTTP/0.9, the original HTTP definition. This particular protocol is a minimalistic protocol that all Web servers and browsers implement.
Say I'm running a Web
server on the computer chomas.cs.csbsju.edu on port 8000.
From the browser, the user can type the URL
http://chomas.cs.csbsju.edu:8000/test.html. The browser will
interpret this and send the following message to the server.
(The following is what Netscape would send.)
GET /test.html HTTP/1.0
Connection: Keep-Alive
User-Agent: Mozilla/4.72 [en] (X11; U; Linux 2.2.14-5.0 i686)
Host: chomas.cs.csbsju.edu:8000
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*
Accept-Encoding: gzip
Accept-Language: en
Accept-Charset: iso-8859-1,*,utf-8
This message says that the browser wants the file
``/test.html'' from the server. In HTTP/0.9, everything after
these first two words is ignored. (You can see that Netscape is using
HTTP/1.0, and after the message it also tells the server quite
a few other things. For example, the Accept: line tells the
server that it prefers GIF images.
An HTTP/0.9 server will simply reply with the requested file.
<h1>This is test.html</h1> <h2>Not too impressive, is it?</h2>The browser receives this and displays it to the screen.
SMTP is another application-layer protocol, used for sending mail. It typically runs at port 25 and is quite a bit more complicated than HTTP because it involves a give-and-take sequence of commands. Here's a session where I send a message to myself. The boldface indicates messages that the client sends.
220 potemkin.computing.csbsju.edu ESMTP Server (Microsoft Exchange Internet Mail Service 5.5.2650.21) ready helo 250 OK mail from: junk@gmail.com 250 OK - mail fromrcpt to: junk2@gmail.com 250 OK - Recipient data 354 Send data. End with CRLF.CRLF Subject: Test message -------- This is a test message. ---Carl Burch . 250 OK quit 221 closing connection