-
Notifications
You must be signed in to change notification settings - Fork 16
/
IP.protocol.txt
153 lines (132 loc) · 9.99 KB
/
IP.protocol.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
IP
FEATURES ==> #Internet layer, i.e. add features for:
# - routing (IP address)
# - congestion (ECN)
# - anti-loops (TTL)
# - error correction, for header only
# - fragmentation
IPv4 PACKET ==> #In bytes.
#Start is header, folowed by contents.
#0-3 (Version): 4|6 for IPv4|6
#4-7 (IHL, Internet Header Length):
# - header size, divided by 4
# - 5 if no Options, up to 15 if max Options
#8-13 (DSCP, Differentiated Services Code Point): used in VoIP
#14-15 (ECN)
#16-31 (Total length): header + contents size (max 65KB)
#32-47 (Identification): IP fragmentation ID
#48-50 (flags): IP fragmentation flags
# - 48: reserved|unused
# - 49: DF (Don't Fragment)
# - 50: MF (More Fragments)
#51-63 (fragment offset): IP fragmentation offset
#64-71 (TTL)
#72-79 (protocol)
#80-95 (header checksum)
#96-127 (sender IP address)
#128-159 (destination IP address)
#160-480 (Options): optional and not often used
ECN ==> #Explicit Congestion Number. Can be:
# - 3: incoming congestion, i.e. suggests other end to send fewer packets
# - 1|2: no congestion
# - 0: not supported
MTU ==> #Maximum Transmission Unit. Max size of a network packet allowed on a given network.
#High MTU:
# - more latency, due to waiting for data
# - higher cost of packet corruption
#Low MTU:
# - more bandwidth, due to more packet headers
# - more processing, due to more packets
#IPv4 mandates min 160 bytes
MTU DISCOVERY ==> #Guess MTU by sending packets with Don't Fragment field, and retrying with smaller sizes
IP FRAGMENTATION ==> #When link layer has smaller MTU than IP layer, split IP packet.
#Each split packet has same Identification header field
#Can setup Flags header field:
# - Don't Fragment: drop packet if fragmentation needed
# - More Fragments: means there are other fragmented packets. Not set on last one.
#Each packet sets its offset, i.e. position where its chunk starts.
# - max 8191
# - divided by 8, i.e. max 65KB
#Total length field is of each fragment
#Only with IPv4
# - IPv6 requires MTU discovery instead
TTL ==> #Time To Live.
#Each node decrements by 1. If 0, drop.
#Goal: prevent looping
#Recommended: 64
PROTOCOL NUMBER ==> #Transport layer protocol
#1 (ICMP), 6 (TCP), 17 (UDP), 58 (IPv6-ICMP), 132 (SCTP)
HEADER CHECKSUM ==> #Drop if mismatched checksum.
#Recalculated each time due to TTL.
#How:
# - sums each 2-byte word NUM of the header (except checkum itself)
# - repeat on the result, since it is likely to be 3 byte long
#Only with IPv4
IP ADDRESS ==> #Host ID
IPv4 ADDRESS ==> #Uses 4 bytes
#Notation:
# - X.X.X.X (decimal, 0-255, 4 bytes)
# - sometimes written in hex 0xXXXXXXXX
IPv6 ADDRESS ==> #Uses 16 bytes
#Notation:
# - XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX (hex, 0000-ffff, 16 bytes)
# - last XXXX:XXXX can be written X.X.X.X (decimal, 0-255)
# - can omit XXXX if 0
# - sometimes surrounded by []
IP ADDRESS STRUCTURE ==> #First bits (network prefix): network, i.e. group of hosts
#Last bits (host identifier): host, i.e. single machine with 1|n sockets
IP/NUM #CIDR (Classless Inter-Domain Routing)
#Notation for NUM of bits for the network prefix ("netmask length")
SUBNET MASK ==> #Other notation:
# - 1 bits for network prefix
# - 0 bits for host identifier
#Also called "network mask"/"netmask"
#E.g. IP/24 -> 255.0.0.0
HOST MASK ==> #Complement of subnet mask, e.g. IP/24 -> 0.255.255.255
#Also called "cisco wildcard"
CLASSES ==> #Other notation, using the first byte (network number) of IP address.
#Obsolete. Opposite is "classless IP".
#Can be:
# - 0-127 (class A): IP/8
# - 128-191 (class B): IP/16
# - 192-223 (class C): IP/24
# - 224-239 (class D): IP/4
# - 240-255 (class E): IP/3
CIDR BLOCK ==> #Range of IP addresses for a given network prefix
SUBNET ==> #Divising a network into multiple subnets by assigning multiple subnet masks:
# - a larger one for the network
# - a smaller one for the subnets
# - prefixed by the larger one
# - i.e. network ID is supernet ID + subnet ID
SUPERNET ==> #Opposite. Merge multiple networks into a supernet by adding a larger subnet mask
COMMON SUBNETS ==> #The internet forms a series of subnets:
# - /0: entire internet
# - /8 (IPv4), /12 (IPv6): RIR (Regional Internet Registries), i.e. 5 continents
# - /17-21 (IPv4), /20-36 (IPv6): ISP
# - /20-22 (IPv4), /48-56 (IPv6): company
# - /24-28 (IPv4), /64 (IPv6): LAN (Local Area Network), i.e. building|campus|etc.
RESERVED IPv4 ADDRESSES ==> #
0.0.0.0/8 #Current network
127.0.0.0/8 #Localhost (hostname): single host network
10.0.0.0/8
172.16-31.0.0/12
192.168.0.0/16 #Private networks: not on internet
224.0.0.0/4 #Multicast
240.0.0.0/3 #Reserved|unused
RESERVED IPv6 ADDRESSES ==> #
::1/128 #Localhost
RESERVED HOST ==> #Only 0 bits: network space
# - network itself, not a host
#Only 1 bits: broadcast address
# - all hosts in network
UNICAST ==> #One sender to one receiver
BROADCAST ==> #One sender to all receivers in a given network
MULTICAST ==> #One sender to multiple receivers in a given network
ANYCAST ==> #One sender to one out of multiple receivers in a given network, e.g. closest one
NAT ==> #Network Address Translation.
#Changing source|destination IP address of a packet in transit.
IPSEC ==> #Encrypt IP packets for authentication + confidentiality
#Unlike SSL, done at internet layer, i.e. includes IP addresses
#Use HMAC-SHA1 and 3DES|AES