actually a suite of protocols - best known:
how TCP/IP corresponds to OSI model (see textbook, Figure 10.9, p. 465)
| request/reply using
| symbolic names
+------------------------+
| 7 / application layer | >- mail, ftp, telnet, dns, ...
+------------------------+
| UDP messages or
| TCP streams
+------------------------+
| 6 / presentation layer | \
| 5 / session layer | - TCP - sessions, packets (in-order, error-free)
| 4 / transport layer | /
+------------------------+
| packets
+------------------------+
| (internetworking) | >- IP - formatting header
| - - - - - - - - - - - -|
| 3 / network layer | (separate network layer may be absent)
+------------------------+
| datagrams
+------------------------+
| 2 / data-link layer | \- host to network, e.g., Ethernet
| 1 / physical layer | /
+------------------------+
each host has a 32-bit unique address (Internet wide)
.com, .edu, .gov, .org, .net, .int, .mil, .biz, .info, .name, .pro, .aero, .coop, .museum, along with country domains such as .jp, .uk, .nl
USA-oriented, note that in other countries second-level domain names can differ, e.g., in England universities are .ac.uk (academic community) and companies are .co.uk
+-----+-----^-----^-----+
| A | B | C | D |
+-----+-----^-----^-----+
class A (1 octet) 1-126 (A=0xxxxxxx) | 126 | 16,777,214 |
+-----^-----.-----------+
class B (2 octets) 128.0-191.255 (A=10xxxxxx) | 16,384 | 65,534 |
+-----------^-----.-----+
class C (3 octets) 192.0-223.255.255 (A=110xxxxx) | 2,097,152 | 254 |
+-----------------^-----+
class D 224-239 (A=1110xxxx) reserved for multicast backbone
class E 240-247 (A=11110xxx) reserved for experimental purposes
208.12.16.0 /20
+---------------.------+
| 20-bit net id | host |
+---------------^------+
typically fixed internet connections (e.g., cable modems) have fixed IP addresses, whereas dial-up providers dynamically assign IP addresses from a pool each time a user dials up. however, a proxy server will have a single IP address and the traffic wrt the internet appears to come and go from that one machine.
(web sites will often assign cookies to give each user a unique identity)
see also Chris Lewis, "All about IP addresses"
frame
.----------------.---------------.------.-----------.------.-----.
| dest. MAC addr | src. MAC addr | type | IP header | data | CRC |
`----------------^---------------^------^-----------^------^-----'
contains
destination and
source IP addresses
IP addr prefix port +--------+ port 0
---------------+----- | |--------> 100.100
100.100 | 0 -->| router |
200.200 | 1 | | port 1
| |--------> 200.200
+--------+
- LAN 1 (1.1.1._) - backbone - LAN 2 (2.2.2._) -
/ \ link / \
+---------+ +------+ +------+ +---------+
| host 1 | port 0 |router| port 1 port 0 |router| port 1 | host 2 |
| 1.1.1.1 |<-------->| one |<---------------->| two |<---------.>| 2.2.2.2 |
+---------+ 1.1.1.0 +------+ 3.3.3.0 3.3.3.1 +------+ 2.2.2.1 | +---------+
^ |
| port 2 |
backbone | 4.4.4.0 | +---------+
link | | | host 3 |
| `>| 2.2.2.3 |
v +---------+
+---------+
| router | connected to
| three | the internet
| 4.4.4.1 |<------------>
+---------+
[from router 1] destination mask gateway port
----------- ---- ------- ----
[to host 1] 1.1.1.1 /32 1.1.1.0 0 host route
[to host 2] 2.2.2.2 /32 3.3.3.1 1 host route
[to network 1] 1.1.1.0 /24 1.1.1.0 0 network route
[to network 2] 2.2.2.0 /24 3.3.3.1 1 network route
[w/in router] 127.0.0 0 / 8 - - loopback
[to internet] 0.0.0.0 / 0 4.4.4.1 2 default route
(see also )
--- LAN 1 (1.1.1._) --- --- LAN 2 (2.2.2._) ---
/ \ / \
+--------+ +----------+ +--------+
| host 1 | port 0 | router | port 1 | host 2 |
| |<---------------->| |<--------------->| |
+--------+ +----------+ +--------+
IP 1.1.1.1 1.1.1.0 2.2.2.1 2.2.2.2
MAC aa-aa-aa-aa-aa-aa bb-bb-bb-bb-bb-bb cc-cc-cc-cc-cc-cc dd-dd-dd-dd-dd-dd
packet from host 1 to host 2
IP dest IP source
+-----------+-----------+---------+
| 2.2.2.2 | 1.1.1.1 | payload |
+-----------+-----------+---------+
frame -- first hop -- from host 1 to router
MAC destination MAC source IP dest IP source
+-------------------+-------------------+-----------+-----------+---------+
| bb-bb-bb-bb-bb-bb | aa-aa-aa-aa-aa-aa | 2.2.2.2 | 1.1.1.1 | payload |
+-------------------+-------------------+-----------+-----------+---------+
frame -- second hop -- from router to host 2
MAC destination MAC source IP dest IP source
+-------------------+-------------------+-----------+-----------+---------+
| dd-dd-dd-dd-dd-dd | cc-cc-cc-cc-cc-cc | 2.2.2.2 | 1.1.1.1 | payload |
+-------------------+-------------------+-----------+-----------+---------+
range of IP addresses
208.12.21.0 /24 |--| 8-bit host id
208.12.16.0 /20 |----------..--------------------| 12-bit host id
| |
208.12.16.00 208.12.31.255
forwarding table
208.12.21.0 /24 port_0 longer prefix - smaller range - encompassed entry
208.12.16.0 /20 port_1 shorter prefix - larger range - encompassing entry
+------+------+------+------+
| | ICMP | UDP | TCP |
| ARP +------+------+------+
| | IP |
+------+--------------------+
| local area network |
+---------------------------+
client server
------ ------
openlistenfd()
socket()
bind()
listen()
|
open_clientfd() |
socket() v
connect() -------> accept() <-.
v v |
write() ------------> read() |
v v |
read() <------------ write() |
v v |
close() ---- EOF ---> read() |
v |
close() ---'
client host address server host address
130.127.48.16 130.127.28.32
.---------. listen socket .---------.
| client |--------------------->| server |
| process | | process |
| |--------------------->| |
| |<---------------------| |
`---------' connection socket `---------'
server listen socket address = 130.127.28.32:80 (well-known port)
server gets new socket for each accept, can fork off a child
process for that client with the new socket and go back to
waiting on the listen socket
mark@cs.clemson.edu