Skip to main content

Convert an IP address to an IP Number

IP address (IPv4 / IPv6) is divided into 4 sub-blocks. Each sub-block has a different weight number each powered by 256.

IP number is being used in the database because it is efficient to search between a range of number in database.

Beginning IP number and Ending IP Number are calculated based on following formula: IP Number = 16777216*w + 65536*x + 256*y + z

(Formula 1) where IP Address = w.x.y.z

For example, if IP address is "202.186.13.4", then its IP Number "3401190660" is based on the Formula 1.

IP Address = 202.186.13.4

So, w = 202, x = 186, y = 13 and z = 4

IP Number = 16777216*202 + 65536*186 + 256*13 + 4

= 3388997632 + 12189696 + 3328 + 4 = 3401190660

To reverse IP number to IP address,

w = int ( IP Number / 16777216 ) % 256

x = int ( IP Number / 65536 ) % 256

y = int ( IP Number / 256 ) % 256

z = int ( IP Number ) % 256

IP Address = w.x.y.z

where % is the mod operator and int is return the integer part of the division.

In Microsoft Excel you can easily find out computation of  above formula for calculating answer of w by typing formula =MOD(int ( IP Number / 16777216 ),256) same method is applicable for x,y & z.

Comments

Popular posts from this blog

INSTALL CISCO VPN CLIENT ON WINDOWS 10 (32 & 64 BIT). FIX REASON 442

This article shows how correctly install Cisco VPN Client (32 & 64 bit) on Windows 10 (32 & 64 bit) using simple steps, overcome the ‘ This app can’t run on this PC ’ installation error , plus fix the Reason 442: Failed to enable Virtual Adapter error message . The article applies to New Windows 10 installations or Upgrades from earlier Windows versions and all versions before or after Windows 10 build 1511 .  To simplify the article, we’ve broken it into the following two sections: How to Install Cisco VPN client on Windows 10 (clean installation or upgrade from previous Windows), including Windows 10 build prior or after build 1511 . How to Fix Reason 442: Failed to enable Virtual Adapter on Windows 10 Figure 1. The Cisco VPN Client Reason 442: Failed to enable Virtual Adapter error on Windows 10 HOW TO INSTALL CISCO VPN CLIENT ON WINDOWS 10 (NEW INSTALLATIONS OR O/S UPGRADES) The instructions below are for new or clean Windows 10 inst...

How to create a Hirens Boot CD 15.2 USB Disk

Hiren’s BootCD (HBCD) is a bootable CD that contains a set of tools that can help users to fix their computer if their system fails to boot. More specifically, HBCD contains hardware diagnostic programs, partition tools, data recovery utilities, antivirus tools and many other tools to fix your computer problems.  I write this article because I use Hiren’s BootCD frequently to troubleshoot computer problems, specially when a computer doesn’t boot anymore due to a virus attack or due to a corrupted file system. In this article you will find instructions on how to put Hiren’s BootCD on a USB flash drive (stick) in order to troubleshoot computer problems in the future.

Internet Connection Sharing has been disabled by the Network Administrator. (Solved)

Problem: Logged in to computer with domain account has administrator privileges, and wanted to share my computer’s wifi to my mobile phone. When open the network sharing dialog, the dialog says: Internet Connection Sharing has been disabled by the Network Administrator.