IPv4 Addressing
IPv4 Addressing
Introduction
a. As we saw in the OSI Model, the Network layer provides the logical addressing (IP
addresses).
b. IPv4 is the primary protocol for 3rd layer.
IPv4 Header:
a. Has two important fields of 32 bits which are :
i. Source IP Address
ii. Destination IP Address
b. IPv4 address is written in dotted decimal format 176.20.10.0/24. (4 octets {octet is 8
bits})
c. /x enable us to differentiate the bits that represent the network and the bits that
represent the end Host.(x bits represent the network and remaining ones represent the end
host).
b.
c. We will focus on the classes A, B and C, Class D is for Multicast addresses and class E is
reserved for experimental
Loopback Addresses:
a. Address range 127.0.0.0–127.255.255.255
b. Used to test the network stack on the local device
c. When I ping any address from that range of address i will get the same thing (0ms) because
I am pinging my self the traffic goes nowhere :
i.
ii.
d. Netmask
i. Is another way to show the prefix (the network bits)
ii. Class A : /8 →255.0.0.0.
iii. Class B : /16 → 255.255.0.0
iv. Class C : /24 → 255.255.255.0
ii. By -2 we remove the Network address and the Broadcast address e.g. The network
172.16.0.0/16 has Host portion of 16 bits = 2 = 65,536–2 = 65,534.
16
IPv4 Header:
a. As we said this is used at layer 3 to help send data between devices on separate networks.
b. IPv4 header is used to encapsulate the TCP/UPD segment.
c. L3 header has the information to route the frame to its destination because it has the IP
address of it.
d. IPv4 header has a size of 32 bytes == 256 bits
e.
f. IPv4 Header Fields:
i. Version field:
1. Length : 4 bits
2. identifies the version of IP used
3. IPv4 = 4 (0100).
v. Total Length :
1. Length of 16 bits.
2. Indicates the total length of the packet (L3 header + L4 segment).
3. Measured in bytes (a value of 20 in this field means 20 bytes).
4. Minimum value of 20 = IPv4 header with no encapsulated data
5. Maximum value of 65535
x. Protocol Field:
1. Indicates the protocol of the encapsulated 4L PDU
2. Usually it has one of :
1. Value of 6 for the TCP
2. Value of 17 for the UDP
3. Value of 1 for ICMP
4. Value of 89 for OSPF (Open Shortest Path First) → Dynamic routing protocol allow
routers to learn routes to destination from their neighbors