|application layer|
“message”(user data)
|transport layer (TCP/UDP/SCTP)|
“segment”(source port, target port, control, data), between two computers. If the segment is too large, it will be splited into several packets in the IP protocal.
UDP, is conection-less “send and forget” protocal.
Adding source port, target port, and whole data + source ip + target ip checksum, on top of IP protocal.
Min header length is 8B(source port 2B, target port 2B, data length 2B, checksum 2B).
The data unit is call “Datagram”.
The datagrams might arrive out of order, not at all, or even more than once, but the individual datagrams, if they arrive, will be undamaged (since it has a checksum).
Large UDP packets might become fragmented as they pass through the network. Fragmentation occurs when the UDP data size is greater than the maximum transfer unit (MTU) size allowed by the routers that the packet passes though when it travels over the network. But the IP protocol will reassemble the fragments before delivering them to the application.
TCP, is connection-oriented reliable protocal.
Adding source port, target port, whole data checksum, byte seq and ack byte seq on top of IP protocal.
Min header length is 20B(source port 2B, target port 2B, send seq 4B, ack seq 4B, sender rcv window size 2B…).
p206
three-way handshake:
SYN, SEQ=x: connection reqeust (from client)
SYN, ACK=X+1, SEQ=y: connection accepted (from server)
ACK=y+1: connection confirm (from client)
disconnect:
FIN, SEQ=X: disconnection reqeust(from client)
ACK=x+1: agree half-close (from server)
FIN, SEQ=y, ACK=x+1: disconnection request(from server)
ACK=y+1: agree half-close, now all closed(disconnected) (from client)
TCP Status (p211):
client – CLOSED, SYNSENT, ESTABLISHED, FIN_WAIT_1, FIN_WAIT_2, TIME_WAIT-CLOSED
server – CLOSED, LISTEN, SYN_RCVD, ESTABLISHED, CLOSE_WAIT, LAST_ACK, CLOSED
CLOSING (closing at the same time)
SCTP(Stream Control Transmission Protocol):
|network layer (ICMP/IP/IPv6/ARP/RARP)|
“packet”(source ip, target ip, control, data) transport between two IPs, which may be connected through many nodes [router - router].
ICMP(Internet Control Message Protocal), the whole ICMP data is placed inside IP data(on top of IP). Has a whole data checksum.
IP(4B = 32 bits) (only header checksum but not whole data checksum), the header will indicate which protocal(ICMP/TCP/UDP) the data it carrys is, so when it arrived, it can pass it to proper up stream.
p167
Min header length is 20B(source ip 4B, target ip 4B…).
class A (0…)[1~126], net-id 8 bits, host-id 24 bits
class B (10…)[128~191], net-id 16 bits, host-id 16 bits
class C (110…)[192~223], net-id 24 bits, host-id 8 bits
class D (1110…)[224~239], reserved group
class E (11110…)[240~247], reserved
Loopback:
127.x.x.x
Private IP range:
10.x.x.x (class A)
172.16.x.x (class B)
172.31.x.x (class B)
192.168.x.x (class C)
0.0.0.0: myself
255.255.255.255: local network broadcast
IPv6(16B = 128 bits = 32 bits * 4)
ARP(Address Resolutino Protocal), IP -> MAC, broadcast MAC request in the local network, who own the IP should response, then cache it.
RARP(Reverse Address Resolution Protocal), MAC -> IP, example, DHCP
|data link layer(LLC/MAC)|
“frame”(control, data) reliable transport between two nodes [node - node].
LLC(Logic Link Control)
MAC(Midea Access Control, 6B = 48 bits, top 1 bit is Indiviaual(0)/Group(1) indicator, high 2~24 is Assigned by IEEE, low 24 bits is by manufactors. If data is sent to my MAC, accept it, if not, ignore it.
Hardware: Hub, Switch, Bridge
|physical layer|
“bit” stream transport. signal modulation
|physical media|
to let it connected physically