The Internet Protocol (IP) is the most popular implementation of a hierarchical network addressing scheme. IP is the network protocol the Internet uses at the network layer, the data is encapsulated within packets (also known as datagrams) IP determines the form of the IP packet header (which includes addressing and other control information) but does not concern itself with the actual data — it accepts whatever is passed down from the higher layers.
Network Layer Fields
•Version – indicates the version of IP currently used (4 bits)
•IP header length (HLEN) – indicates the datagram header length in 32 bit words (4 bits)
•type-of-service – specifies the level of importance that has been assigned by a particular upper-layer
protocol (8 bits)
•Total length – specifies the length of the entire IP packet, including data and header, in bytes
•Identification – contains an integer that identifies the current datagram (16 bits)
•Flags – a 3-bit field in which the 2 low-order bits control fragmentation – one bit specifying whether
the packet can be fragmented, and the second whether the packet is the last fragment in a series of
fragmented packets (3 bits)
•Fragment offset – the field that is used to help piece together datagram fragments (13 bits)
•Time-to-live – maintains a counter that gradually decreases, by increments, to zero, at which point
the datagram is discarded, keeping the packets from looping endlessly (8 bits)
•Protocol – indicates which upper-layer protocol receives incoming packets after IP processing has
been completed (8 bits)
•Header checksum – helps ensure IP header integrity (16 bits)
•Source address – specifies the sending node (32 bits)
•Destination address – specifies the receiving node (32 bits)
•Options – allows IP to support various options, such as security (variable length)
•Data – contains upper-layer information (variable length, maximum 64 Kb)
•Padding – extra zeros are added to this field to ensure that the IP header is always a multiple of 32
32 Bit Binary IP Address
An IP address is represented by a 32 bit binary number. The value of the right-most bit (also called the least significant bit) is either 0 or 1 . The corresponding decimal value of each bit doubles as you move left in the binary number .So the decimal value of the 2nd bit from the right is either 0 or 2. The third bit is either 0 or 4, the fourth bit 0 or 8, etc … IP addresses are expressed as dotted-decimal numbers, we break up the 32 bits of the address into four octets (an octet is a group of 8 bits).
The maximum decimal value of each octet is 255 The largest 8 bit binary number is 11111111 Those bits, from left to right, have decimal values of 128, 64, 32, 16, 8, 4, 2, and 1. Added together, they total 255.
The network number of an IP address identifies the network to which a device is attached. The host portion of an IP address identifies the specific device on that network.