On Mon, 3 Dec 2001 13:41:19 -0330 "R. Toma" <[EMAIL PROTECTED]> wrote:
> > > I have an idea on how to convert from hex to dec and viceversa. I > can use a > simple calculator, too. I have tried to understand the hex dump and > there > are some points that I don't understand. For example: 45 (hex) = 69 > (dec) > and NOT 20. There is something that I don't understand there... Look > at my > "??????????????????????????????" in the dump. I also counted the > bits and > bytes to see if they correspond to the protocol specifications. And > I have > it no cleared yet, but that's not the mysth. The mysth is how to > obtain 20 > (dec) from 45 (hex) and so on... > Hi, the 4 from 45 is the version of IP. The version number coded on 4 bits (the first 4 bit of the IP datagram). The 5 is the number of 32 bits words that makes the IP headers, and 5 32 bits words are 20 bytes long (5 x 4 bytes, cause one 32 bits word is 4 bytes). So, the minimum the IP header can be is 20 bytes (5 words), and the maximum is 64 bytes (16 words). Maximum sized headers are made of 5 words for IP headers, and 11 optionnal words, for IP options. The reason for IP headers (with IP option headers) to not be grater than 64 bytes is that IP header length is coded on 4 bits. Now, ASCII art time ;), from RFC791. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Version| IHL |Type of Service| Total Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identification |Flags| Fragment Offset | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Time to Live | Protocol | Header Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Options | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ====================================================================== FreeBSD Network - http://www.gomor.org/ Security Engineer Junior ====================================================================== =-----=> root is the only God I believe in <=-----=