IPv4 Addresses, Datagram and Encapsulation

When a new device connects to a network, it is assigned an IP address automatically by Dynamic Host Configuration Protocol

  • Dynamic IP address
  • Static IP address, which must be configured on a node manually

In most cases, static IP addresses are reserved for servers and network devices, while dynamic IP addresses are reserved for clients

Under IP protocol, a packet is usually referred to as an IP datagram

IP Datagram - highly structured series of fields that are strictly defined Pasted image 20260526183834 32 bits including 0

IPv4 - most common version of IP

Header length field - almost always 20 bytes in length when dealing with IPv4

Service type field - 8 bits can be used to specify details about quality of service, or QoS, technologies

Total length field - indicates the total length of the IP datagram its attached to

*if the total amount of data that needs to be sent is larger than what can fit in a single datagram, the IP layer needs to split this data up into many individual packets

Flag field - used to indicate if datagram is allowed to be fragmented, or to indicate that the datagram has already been fragmented

Fragmentation - process of taking a single IP datagram and splitting it up into several smaller datagrams

Time to live (TTL) field - an 8-bit field that indicates how many router hops a datagram can traverse before its thrown away

  • Main purpose: to make sure that when there’s a misconfiguration in routing that causes an endless loop, datagrams don’t spend eternity trying to reach their destination
  • every time a datagram reaches a new router, that router decrements the TTL field by 1
  • once it reaches 0, a router knows it doesn’t have to forward the datagram any further

Protocol field - another 8-bit field that contains data about what transport layer protocol is being used

  • TCP
  • UDP

Header checksum field - checksum of the contents of the entire IP datagram header

IP options field - an optional field and is used to set special characteristics for datagrams primarily used for testing purposes

The entire contents of an IP datagram are encapsulated as the payload of an ethernet frame

IP addresses can be split into 2 sections:

  • Network ID
  • Host ID

Address class system - a way of defining how the global IP address space is split up

  • Class A - first octet is used for network ID, last 3 octets used for host ID
  • Class B - first 2 octets used for network ID, last 2 octets used for host ID
  • Class C - first 3 octets used for network ID, last octet used for host ID