IP addressing by integer

IP addressing by integer

Most people are familiar with the dot-decimal notation used in IPv4 addresses. For example, 70.38.56.57 is the address of www.simwitty.org. Note each of the four numbers in the address can range from 0-255. 255 is the maximum that can be stored in 8 bits. Four numbers, 8 bits, 32 bits in an IPv4 address.

Some network systems store these values as one number.(Technically, the address is stored as a 32-bit uint value.) For example, Snort’s database lists www.simwitty.org as 1176909881. The advantage here is that database joins are significantly faster on numbers than on strings, so representing all the bits as a number has advantages. Where does this number come from? Let’s break a part the bits.

DNS: www.simwitty.org
IPv4 dot-decimal notation: 70.38.56.57
IPv4 binary: 01000110 00100110 00111000 00111001
IPv4 decimal: 1176909881

An interesting bit of trivia. If you run across such a 32-bit number, the quickest way I know of to convert it back to dot-decimal notation is to use the ping command on Windows 7 and Windows 2008. Pinging the number does not work on Linux insofar as I can tell.

C:\>ping 1176909881

Pinging 70.38.56.57 with 32 bytes of data:
Reply from 70.38.56.57: bytes=32 time=36ms TTL=112
Reply from 70.38.56.57: bytes=32 time=36ms TTL=112
Reply from 70.38.56.57: bytes=32 time=36ms TTL=112
Reply from 70.38.56.57: bytes=32 time=36ms TTL=112

Posted by