Decimal IP address is a form of internal representation for the IP address. It's formed by taking the four numbers of IP in dotted quad form, interpreting them as binary numbers, putting them into 4 bytes and interpreting them as 4-byte integer (in network byte order, I guess).

For example, the decimal IP of 255.255.255.255 is 354267876296.

IRC uses these internally, as do some other protocols, and naturally some people store IPs this way.

Also, spammers seem to favor this representation of IP addresses (never mind that some browsers can't hack decimal IPs at all as part of URLs because the Specifications don't require it).

In UNIX, these are handled with inet_ntoa() and inet_aton().

To convert decimal IPs to normal dotted quad form (for example, to spoil spammers' joy), use this Perl hack:

perl -MSocket -e "print inet_ntoa(pack('N','354267876296'));"

Replace number accordingly.

Let me clarify this further:

Let's take the URL http://www.everything2.com/ by way of example.

Using whichever tool you like, determine the IP address of this site. You'll find that this maps to the address 206.170.14.131.

206.170.14.131 is stored internally by a computer in binary format. 206.170.14.131 converted to binary looks like this:

11001110 "." 10101010 "." 00001110 "." 10000011

(Note the padding of the third octet, "14", to eight digits by adding extra zeroes. By definition each octet must contain eight bits of information . The maximum number you can have represented with 8 bits of information in binary is 11111111 or 255 in decimal.)

Dotted quad notation is confusing. The dots simply separate the four octets but this tends to hide the fact that the address itself is stored as one value inside the computer, not four. You can also represent the same values in hexadecimal as:

CE "." AA "." 0E "." 83

(Note here also that "14" is again padded - this time to 2 digits - with a zero. Hexadecimal or base 16 needs only two digits to represent the maximum of 255 - FF)

Now let's drop the dots, since they're really confusing the issue a lot here. The proper way to represent the address 206.170.14.131 is:

11001110101010100000111010000011 (binary)
Or CEAA0E83 (Hexadecimal).

The binary version is the computer's internal representaion of that address. CEAA0E83 is also a handy way of storing the data.

Convert either of those to their decimal values, and you have the decimal IP address. Observe:

110011101010101000001110100000112
= CEAA0E8316
= 346725133110

So, try typing http://3467251331/ into your browser, and see what happens!

(Disclaimer: Your browser may not support this type of addressing)

Here's a simple C++ program for converting IPs from dotted quad notation to decimal notation. I wrote this program for work to test a proxy we're setting up for public internet terminals.


#include <iostream.h>

main()
{
	// Initialize the variables
	unsigned long a,b,c,d,base10IP;

	// Get the IP address from user
	cout << "\nEnter an IP address in dotted quad notation (x.x.x.x)";
	cout << "\nwith each section seperated by a space: ";
	cin >> a >> b >> c >> d;

	// Do calculations to covert IP to base 10
	a *= 16777216;
	b *= 65536;
	c *= 256;
	base10IP = a + b + c + d;

	// Output new IP address
	cout << "\nThe converted address is: " << base10IP << '\n';
}

If you need a C++ compiler...

  • Windows: http://www.borland.com/bcppbuilder/freecompiler/
  • Linux: http://www.gnu.org/software/gcc/gcc.html
  • Mac OS X: http://developer.apple.com
  • An IP address is a 32 bit number. It is generally written in the "dotted quad" notation: w.x.y.z. To convert an IP address to base 10, calculate w*16777216+x*65536+y*256+z. Or use the following Perl code, which takes as an argument as a string in dotted quad form:

    sub dqtoint {
    return hex ('0x' .
    join '',
    (map {
    sprintf '%lx', $_
    }
    split (/\./, shift)));
    }

    m_turner suggests using bc to convert back:
    obase=256;
    < Enter your number here >

    The output will be your ip address in dotted quad for (but without dots). m_turner further suggests to do the equivalent of my Perl above:
    ibase=256;
    < enter your number here in dotted quad form without dots >

    as seen in the Fall 2000 issue of 2600; props to ASM_dood

    even though it's been published elsewhere, it's simple, elegant, and accessible, so i felt it belonged on e2. So, without further ado:


    Cyberpatrol, Websense, SurfWatch, NetNanny - we all know these pieces of software either by reputation or having personally been blocked by one of them while trying to surf the web during work, school, or at home. I'm not certain that it need to be said that this software often classifies web sites incorrectly or leans heavily towards one end of the political spectrum.

    Having laid the groundwork, here is a way to defeat that URL blocker that your parents, school, or corporation have put into place to keep you from browsing what they deem to be "unacceptable."

    Take the URL that you are being blocked from going to, such as http://www.2600.com (which is defined as Hacking, Illegal, or Crime depending on the URL filter)

    Do an nslookup on the URL and you will get the IP address 207.99.30.230 which is just the dotted octet of its 32 bit number.

    Take the individual octet and convert it to its binary equivalent:
    207 = 11001111
    99 = 01100011
    30 = 00011110
    230 = 11100110

    If any of the numbers are less than eight digits, be sure to pad them out with leading zeroes. Next, string the numbers together:

    11001111011000110001111011100110

    Plug them into your scientific calculator (or your HP ;) ) and convert to its decimal equivalent.

    In our case:

    11001111011000110001111011100110 = 3479379686

    So now you can just surf over to: http://3479379686 and, presto, you are now at www.2600.com

    I'm sure someone else can come up with a script to do the calculations instead of someone having to do them by hand, but I don't have the time or inclination.

    Binary? Ecch!

    Here's an easier way to do this (with a normal pocket calculator) that doesn't require any conversions to or from binary:
    1. Do an nslookup on a non-filtered box to get a dotted decimal IP address. (In Windows 9x, use ping instead of nslookup.) For example, slashdot.org used to be 66.35.250.150 until it moved from Exodus East to Exodus West.
    2. Key into the calculator, replacing each . with = * 2 5 6 +
    3. Press = to see the IP address. Now key it into your web browser: http://1109654166

    Caveats

    Because an nslookup is involved, it won't work on sites that use NameVirtualHost (such as goatse.cx or Pin Eight), dynamic IP addressing (anything on cjb.net), or free hosting services (GeoCities, Tripod, FortuneCity, etc.). It also doesn't work with censorware products that do a reverse nslookup, cache IP addresses of blocked sites, or do regexp matching on the path portion of the URI. One surefire way to defeat client-side URL filtering is to use the Peacefire package.

    The source code for a Python program (The language not the snake.)  that will fetch the
    dotted decimal IP address of a website of your choice and convert it in to a valid 32 bit  
    one as show in the other write-ups. You will need Python and the module found at  
    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/111286 to get it to run. I hope you
     find this useful (This may not be the best way to do it Im still learning python. :-)
    
    There may be are formatting errors sorry about that, Im new to Everything. 
    
    
    


    #Written by Hexice hectorDOTdearmanATgoogleDotcom
    #Note nslookup
    #Note http://everything2.com/index.pl?node=IP%20address
    #Note http://everything2.com/index.pl?node_id=951857&lastnode_id=0

    #For converting from decimal to binary and back.
    import BaseConvert
    #For geting the IP address.
    from socket import gethostbyname

    #The help text.
    DotDecto32bithelp = """ This was written mainly to see if I could however
    it does have a practical application, it converts
    dotted decimal IP address's (64.233.183.103) in
    to 32-bit decimal format (1089058663) which can
    be used as a valid internet address (In this case Google).

    The main reason you would want to do this would
    be to get past censorship programs on school,
    library or workplace computers.

    For more information
    go to http://everything2.com/index.pl?node=IP%20address
    or http://everything2.com/index.pl?node_id=951857&lastnode_id=0

    Im am indebted to Drew Perttula for creating the
    module BaseConvert (which funnily enough is used to
    covert between bases.)

    Note: If you wish to find out the IP address of
    a website on a windows operating system go to
    start > all programs > Accessories > Command prompt
    then type: nslookup [web site who’s IP address you want]

    The program will now print out the Google 32-bit
    address run it again to find a diffrent 32-bit
    address, I hope this program is usefull to you.
    By Hexice hectorDOTdearmanATgoogleDotcom

    Update: this program will now (attempt) to fetch the
    IP address from a website you give it, be warned however
    this is far from stable.
    """


    #Variables, shown here for clarity.
    webaddress = 'www.google.com'
    RawIPaddress = '000.000.000.000'
    IPaddress = ['000','000','000','000']
    IPaddressRawbinary = ['00000000','00000000','00000000','00000000']
    IPaddressbinary = ['00000000','00000000','00000000','00000000']
    IPaddressbinarystring = '00000000000000000000000000000000'
    DecimalIPaddress = '0000000000'
    error = ''

    #Print the intro and ask for the web address
    print 'This program will find the 32 bit address for a website.'
    print 'Input a website below or type help for help or type IP,'
    print 'if you wish to cut to the chase and input an IP address'
    print 'you all ready know.'
    print
    webaddress = raw_input('>')

    if webaddress == 'IP':
    #Ask for the dotted decimal IP address.
    print "Please input IP address (Dotted decimal form.) or type help for help"
    RawIPaddress = raw_input('>')

    elif webaddress == 'help':
    print DotDecto32bithelp
    # The Google IP address, the rest of the program will now execute.
    RawIPaddress = '64.233.183.103'

    else:
    #Gets the IP address.
    RawIPaddress = gethostbyname(webaddress)


    #Print the help if thats what the user asked for.
    if RawIPaddress == 'help':
    print DotDecto32bithelp

    # The Google IP address, the rest of the program will now execute.
    RawIPaddress = '64.233.183.103'

    elif RawIPaddress == 'this':
    print
    import this
    print
    RawIPaddress = '64.233.183.103'

    else:
    pass

    #Split the IP address into component parts.
    IPaddress = RawIPaddress.rsplit('.')

    #Convert the decimal numbers to binary.
    try:
    IPaddressRawbinary[0] = BaseConvert.baseconvert(IPaddress[0],BaseConvert.BASE10,BaseConvert.BASE2)
    IPaddressRawbinary[1] = BaseConvert.baseconvert(IPaddress[1],BaseConvert.BASE10,BaseConvert.BASE2)
    IPaddressRawbinary[2] = BaseConvert.baseconvert(IPaddress[2],BaseConvert.BASE10,BaseConvert.BASE2)
    IPaddressRawbinary[3] = BaseConvert.baseconvert(IPaddress[3],BaseConvert.BASE10,BaseConvert.BASE2)

    #See if an index error has occurred.
    except IndexError:
    #If there is an error tell the user.
    print 'An Index Error has occurred,'
    print 'you must input a IP address in dotted decimal form (i.e 64.233.183.103).'

    #Create a second error massage that will be printed out when we get to displaying the address.
    error = '[Index Error (see above)]'

    #See if an value error has occurred.
    except ValueError:
    #If there is an error tell the user.
    print 'A ValueError has occurred,'
    print 'you must input a IP address in dotted decimal form (i.e 64.233.183.103).'

    #Create an error massage that will be printed out when we get to displaying the address.
    error = '[ValueError (see above)]'


    else:
    pass

    #Pad out the binary with extra zeros so that every number is 8 digits long.
    IPaddressbinary[0] = IPaddressRawbinary[0].zfill(8)
    IPaddressbinary[1] = IPaddressRawbinary[1].zfill(8)
    IPaddressbinary[2] = IPaddressRawbinary[2].zfill(8)
    IPaddressbinary[3] = IPaddressRawbinary[3].zfill(8)

    #Create a single string out of the binary IP address's.
    IPaddressbinarystring = IPaddressbinary[0] + IPaddressbinary[1] + IPaddressbinary[2] + IPaddressbinary[3]

    #Convert back to decimal.
    DecimalIPaddress = BaseConvert.baseconvert(IPaddressbinarystring,BaseConvert.BASE2,BaseConvert.BASE10)

    #Display the converted address and the error message (If there is one.).
    print 'http://' + DecimalIPaddress + error


    My place of work Is fairly gestapo when it comes to surfing at work. We're not allowed to do it, even between calls (I work helldesk).

    Now, they were browsing the log files one day, and they must've seen my 10,000 or so hits1 of "Everything2.com", because I came to work one day and Everything2.com, Everything2.org, and Everything2.net were all blocked. Me being the geek I am, this was just a minor irrtitation.

    Here's how to get around it:

    Find the IP address
    E2's IP is: 216.200.201.214
    If you're looking to get to other sites that work has blocked, you'll need to find a website that'll do dns lookups for you. I used the one at http://www.bankes.com/nslookup.htm .

    This worked fine, but it wasn't too long untill they clued in and just blocked the whole IP. What was I to do?

    Convert the IP to decimal (seriously): Take the IP that you just got.
    216.200.201.214
    Seperate it into 4 different numbers.
    216 200 201 214
    Turn each of those numbers into binary, making sure to pad the beginning of it with 0's untill each block has 8 bits
    11011000 11001000 11001001 11010110
    Now string them all together
    11011000110010001100100111010110
    And convert it into decimal
    3637037526
    Tada... Throw that into the address bar of your browser, and unless it's blocked by hardware it should work.
    Apparantly there's also a tool called the "URL Discombobulator" lets you convert back and forth from the IP to the decimal or binary address. It's at http://www.karenware.com/powertools/ptlookup.asp
    -Thanks koreykruse

    1 Exaggeration
    As noted above, the standard ???.???.???.??? form is called the dotted decimal form of an IP address. The address itself is simply a 32 bit number; the dotted decimal form is presumably used for convenience's sake. However, this bit of semi-obscure knowledge provides a (somewhat inconvenient) way of obscuring an address - one obvious application being bypassing URL filters placed on your computer or network.

    To do this, one can express an address simply as a single, 32-bit decimal number, rather than the four octets usually used. The basic method is as follows:

  • Get the dotted decimal form of the IP address of the site you wish to visit. For this example, I will use the IP address of Everything2, 206.170.14.131.

  • Now, convert each number in the above address to binary; Windows' calculator will do this fine -- see below for instructions on how. (I'm assuming that if you aren't using Windows, you will probably know how to do base conversion. If you need instructions, feel free to /msg me.) You want to end up with four eight-bit binary numbers, so make sure there are eight digits for each number - if there are less than eight, place additional zeros in front of the number to make eight digits. From 206.170.14.131, we now get 11001110.10101010.1110.10000011. Remember that we need to make every number eight digits long; after adding zeros where appropriate, we are left with 11001110.10101010.00001110.10000011.

  • Now, put all these binary numbers together in order as one big number: 11001110101010100000111010000011.

  • Dump this number into Windows' calculator (or whatever you happen to be using to do this; if you're doing it by hand, well, that's possible, but I feel for you ;). Convert it back to decimal; this should give you 3467251331. Congratulations, you now have the single 32-bit number for Everything2 in decimal form. It can be used the same way you'd use a normal dotted decimal IP address or hostname -- you can ping it, place it in a URL like http://3467251331/, and so on. It works in every program I've tried, and should get past most URL filters.

    Instructions on converting between bases with the Windows calculator: Open the program, of course. Make sure it's in scientific mode; if not, click on 'scientific' in the 'view' menu. Now, in the top left of the program window, a little below the menus, there are four options arranged horizontally: Hex, Dec, Oct, and Bin. To convert from decimal to binary, select 'Dec', enter the number, and then select 'Bin'; the number will be converted to binary. To convert from binary back to decimal, do the reverse -- select 'Bin', enter the binary number, and then select 'Dec'.



    Below is the source code for a Java program that will take a hostname (e.g. www.everything2.com) and spit out its decimal form. Reader beware, this code is ugly. I wrote this without doing any prior planning one night at Speck's behest. It's completely uncommented and not very clean. I plan to make a nicer version in the future with a couple more features and more efficient/readable code. When I do, I'll remove this code and place the new code in its own node, possibly along with a few programs in other languages that can help find an IP's non-dotted decimal form which were published in the Fall 2000 (?) issue of 2600.

    Use: First, copy it into a file called "URLToDecimal.java" and compile it. I have a Java 2 (1.3) compiler, but as far as I know this should compile in earlier forms of Java - I don't think anything I've used in the program is specific to newer versions. When you run it, use the following syntax:
    (prompt)> java URLToDecimal --hostname host
    Where host is of course the name of the host whose decimal address you wish to find.



    import java.lang.*;
    import java.util.*;
    import java.math.*;
    import java.net.*;
    
    public class URLToDecimal {
    
      public static final boolean DEBUG = true;
    
      public static void main(String[] args) throws Exception {
        /*(if (args.size() != 1) {
          showSyntax();
          System.exit(1);
        }*/
        String IP;
        if (args[0].equals("--hostname") || args[0].equals("-h")) {
          System.out.println("Looking up " + args[1]);
          IP = InetAddress.getByName(args[1]).getHostAddress();
          System.out.println(args[1] + " resolves to IP " + IP);
        } else /*if (args[0].equals("--ip") || args[0].equals("-i"))*/ {
          IP = args[1];
        }
        StringTokenizer tokens = new StringTokenizer(IP, ".");
        int[] n = new int[4];
        String fullBin = "";;
        for (int i=0; i<4; i++) {
          //if (tokens.hasMoreTokens())
          String t = tokens.nextToken();
            n[i] = Integer.parseInt(t);
          if (DEBUG) {
            System.out.println("Token number " + (i+1) + ": " + t);
            System.out.println("n["+i+"]: " + n[i]);
          }
    
          //else { showSyntax(); System.exit(1); }
        }
    
        String[] bin = new String[4];
    
        for (int i=0; i<4; i++) {
          bin[i] = Integer.toBinaryString(n[i]);
          if (DEBUG) System.out.println("bin["+i+"]: " + bin[i]);
    
          while (bin[i].length() < 8)
            bin[i] = "0" + bin[i];
    
          //fullBin = bin[i] + fullBin;
          fullBin += bin[i];
          if (DEBUG) System.out.println("fullBin: " + fullBin);
        }
    
        String dec = binToDec(fullBin);
    
        System.out.println("Decimal equivalent to " + args[1] + " is " + dec);
    
      }
    
      private static void showSyntax() {
        // To do
      }
    
      private static String decToBin(int n) {
        String bin = "";
        int power;
        for (int i=7; i>=0; i--) {
          power = powInt(2, i);
          bin = bin + (n / power);
          n = n % power;
        }
        return bin;
      }
    
      private static String binToDec(String n) {
        BigInteger dec = new BigInteger("0");
        for (int i=0; i<n.length(); i++) {
          //int a = Integer.parseInt(n.substring(i, i+1));
          //int b = powInt(2, n.length()-i);
          //dec += a*b;
          BigInteger a = new BigInteger(n.substring(i, i+1));
          //BigInteger b = new BigInteger("" + powInt(2, n.length()-i));
          BigInteger b = new BigInteger("2").pow(n.length()-i-1);
          dec = dec.add(a.multiply(b));
          if (DEBUG) {
            System.out.println("a = " + a.toString());
            System.out.println("b = " + b.toString());
            System.out.println("dec = " + dec.toString());
          }
        }
        //String a = "" + dec.toString();
        return dec.toString();
      }
    
      private static int powInt(int base, int exp) {
        int pow = base;
        for (int i=1; i<=exp; i++) {
          pow *= base;
        }
        if (base != 0 && exp != 0) {
          return pow;
        } else if (base != 0 && exp == 0) {
          return 1;
        } else return -1;
      }
    }
  • A dotless IP address is a standard xxx.xxx.xxx.xxx IP address represented as either a decimal DWORD, hexadecimal, or octal. Windows internet browsers, such as Microsoft Internet Explorer and Netscape, are able to decode such addresses to their correct IP's. In MSIE 4.x, there was a security vulnerability that would make any dotless IP address apear as if it was on the user's intranet, which was set to the lowest level of security protection within the browser.

    An example of this is as follows:

    E2's address is http://www.everything2.com . Its IP address is http://206.170.14.131 . Its dotless IP address in DWORD is http://3467251331 . All three addresses take you to the same place.

    Log in or register to write something here or to contact authors.