== IPv4 Protocol Notes == Back to ComputerTerms https://www.scotnpatti.com/unl/images/ipv4.jpg === Version === Only 4 bits, this field determines the how the rest of the packet is treated '''Default Value''': None === HLen === HLen is the header length and is specified as the number of '''32 bit words'''. Thus the header is at most 480 bits (2^4 - 1) * 32. '''Default Value''': '''5''', because we don't specify any options varibles. === TOS === This field has had a number of different definitions over the years and is generally used to define the values used on routers etc. '''Default Value''': None === Length === This field gives the length of the entire datagram in '''bytes''' rather than words. Thus the '''maximum length''' of a IP datagram is 65535 ----- '''''NOTE: THE NEXT WORD DEALS WITH FRAGMENTATION''''' ----- === Ident === Strictly an ID chosen by the sender meant to be unique among all the datagrams that might arrive at the destination from this source (in a reasonable amount of time - the time it takes to wrap around this number). === Flags === Three bits long: 1. '''Reserved bit''' 2. '''Don't Fragment''' set to 1 if you don't want routers to fragment this packet 3. '''M(ore) Bit''' set to 1 means that there are more fragments. Therefore the last datagram will not have the M(ore) bit set === Offset === Offset is the number of 8-byte data chunks that should be before this one. If the value of this field is X then X*8 is the number of bytes before the data in this fragmented datagram. Therefore the first fragment will always have a value of 0. '''Default''': 0 === TTL === The intent is to limit the time (in seconds) a packet can wander around an internet in loops before it is discarded. Since most routers do not synchronize their clocks, each router just decrements the value by one and discards it when it gets to 0. '''Default Value''': 64 === Protocol === This field defines a multiplexing key that determines which higher level protocol to pass the data to. On Linux systems see /etc/protocols. TCP = 6, UDP = 17. === Checksum === The checksum is calculated by considering the entire IP header as a sequence of 16-bit words added using one's complement arithmetic, and taking the ones complemnt result. The checksum is calculated using the IpCheckSum algorithm. This is not as good as the CyclicRedundancyCheck (CRC), but it's faster and easier to implement. === SourceAddr === IP Address of the source === DestinationAddr === IP Address of the destination === Options(Variable) === The presence or absence of options may be determined by examining the HLen field. While these are rare a complete IP implmentation must handle them all. === Pad (Variable) === Padding to fill out the length of the header. === Data === Payload of the IP datagram. Back to ComputerTerms