7 Network Layer IPv4
7 Network Layer IPv4
OPM
The internet layer facilitates internetworking, which is the concept of connecting multiple networks with each other through network gateways.
OPM
OPM
IPv4
IPv4 was described in RFC 791 (September 1981).
IPv4 is a connectionless protocol for use on Packet switched networks.
It operates on a best effort service model, in that it does not guarantee delivery, nor does it assure proper sequencing or avoidance of duplicate delivery. These aspects are addressed by an transport protocol, such as TCP and UDP.
OPM
IPv4 (cont.)
IPv4 uses 32 bits addresses, which limits the address space to 4294967296 (232) addresses.
IPv4 address exhaustion (occurred on February 3, 2011) significantly delayed by following addressing changes such as
Classful network design, Classless network design (Classless Inter Domain Routing CIDR), Network Address Translation (NAT). Dynamic Host Configuration Protocol (DHCP)
OPM
OPM
These IP addresses are not routable outside of private networks, and private machines cannot directly communicate with public networks.
They can, however, do so through network address translation (NAT).
OPM
Addresses ending in 0 or 255 Class C networks in classful networking, and networks with CIDR prefixes /24 to /32 (255.255.255.0255.255.255.255) can not have an address ending in 0 or 255. OPM 8 In networks except class C, the IP addresses ending with 0 and 255 can be used.
OPM
OPM
10
OPM
11
In IPv4 addressing, a block of addresses can be defined as x.y.z.t /n in which x.y.z.t defines one of the addresses and the /n defines the mask.
OPM
12
OPM
13
OPM
14
OPM
15
NAT implementation
OPM
16
Addresses in a NAT
OPM
17
OPM
18
OPM
19
4 bytes
20 bytes Header Size < 24 x 4 bytes = 60 bytes 20 bytes Total Length < 216 bytes = 65536 bytes
OPM 20
OPM
21
OPM
22
Identification : uniquely identifies a datagram or must be copied in fragments. Retransmission of a packet carries the same identification number. Some experimental work has suggested using the ID field for other purposes, such as for adding packet-tracing information to help trace datagrams with spoofed source addresses
OPM
23
Checksum :- 16-bit field (checksum of 16-bit blocks) used for error-checking of the header.
Checksum is calculated as 1s complement of sum of 1s complement of all 16-bit blocks of IP header. When a packet arrives at a router, the router calculates the checksum of the header and compares it to the checksum field. If the values do not match, the router discards the packet. Errors in the data field must be handled by the encapsulated protocol. When a packet arrives at a router, the router decreases the TTL field. Consequently, the router must calculate a new checksum.
OPM 26
Destination address: This field is the IPv4 address of the receiver of the packet. As with the source address, this may be changed in transit by a Network Address Translation device.
OPM
27
Copy : Set to 1 if the options need to be copied into all fragments of a fragmented packet. Option Class : options category. 0 is for datagram or network control" options, and 2 is for "debugging and measurement". 1, and 3 are reserved.
Option Number : value 0 for end of option list, 3 for loose source route, 7 for record route, 9 for strict source route, 11 for MTU probe, 18 for traceroute program to find routers along a path etc.
OPM
28
Address spoofing
Sender can put any source address in packets he sends:
Can be used to send undesired return traffic to the spoofed address Can be used to bypass filters to send undesired traffic to the destination
Reverse Path verification can be used by routers to broadly catch some spoofers using option field.
OPM
29
Fragmentation
May need to fragment an IP packet if one data link along the way cannot handle the packet size
Perhaps path is a mix of different Hardwares. Perhaps unexpected encapsulation makes the packet larger than the source expected Hosts try to understand Maximum Transmission Unit (MTU) to avoid the need for fragmentation (which causes a performance hit)
Any device along the way can fragment (in IPv4 only)
Identification field identifies all elements of the same fragment Fragmentation stored in the MF (more fragments) and fragment offset fields Devices can reassemble too But generally the destination does the reassembly
OPM
30
May have routing table per incoming interface To route a packet, take the destination address and find the best match network in the table. In case of a tie look at the metric
Use the corresponding next hop address and interface to send the packet on. The next hop address is on the same link as this device, so you use the next hops data-link address, e.g. ethernet MAC address
Decrement time to live field in IP header at each hop . Drop packet when it reaches 0
Attempt to avoid routing loops TTL fields maximum value is 255.
OPM
31
OPM
32
OPM
33