Internet Protocol Addresses




An important system in computing is the binary system. Binary is the only language computers understand, and is considered a Base 2 system. Base 2 means that it uses only two characters, a 0 and a 1. 0 symbolizes off, and 1 symbolizes on. When there is a 1, that means that a small amount of voltage is activated, and a 0 means none. Each individual number (0 or 1), is called a bit. Eight bits make up a byte, and each byte converts to one character. Another system is the system we use in daily life, the decimal system, a base 10 system (uses 0-9). Binary is usually converted to decimal for easy reading. But what does binary look like? Here is an example: 10010111. You may be wondering, what does that convert to? From left to right, each number is really this: 20, 21, 22, 23… So, let's evaluate that number, 10010111. Since the first number (starting from the left) is turned on, we have 1 (20 = 1). The next number is also turned on, so we have 2 (21 = 2, and I think you have it now). 1 + 2 = 3, therefore the number as of now is 3. The next number is also on, and it is 4, so now the number is 7 (3 + 4 = 7). Since the next number, which would be 8, is not on, it is not added. The next number is 16, and that's on, so the number becomes 23. 32 and 64 are both off, but the final number, 128, is on, so 128 + 23 = 151. 151 = 10010111. All binary numbers are converted like this.

To convert a decimal to binary, you do it the opposite way, going right to left. Here's how it works, let's say you want to convert 50 to binary. Start from the right, and say, "Is 128 less than 50?" Since it is not, the 128 spot stays off, and since 64 is also more than 50, that is off too. However, 32 is less than 50, so that gets turned on. 50-32 is 18, so that is what we are working with now. So far, the binary code is 001. 16 is less than 18, so that gets turned on, and we now have 2 (and the binary code is 0011). 8 and 4 are both greater then 2, so those are turned off, and 2=2, so that is turned on. 1 is then turned off, since it is not less than 0. Thus, the final code is 00110010. Easy, aye?

When computers are in a network, they are given an IP address. An IP address is a 32-bit, or 4 byte, code. IP address stands for Internet Protocol address, and is part of the TCP/IP protocol suite. IP addresses are in binary, but like everything else, are converted into "dotted-decimal" form for easy reading. An example IP (I'll make it low), could be 10.4.9.1 (although they are usually something like 149.156.48.71, much higher). The binary equivalent of that is 00001010.00000100.00001001.00000001. Part of that address is the address of the network the host (essentially the computer) is connected to, and the other part is the host itself. To designate what part of the IP address is the network and what part is the host, a subnet mask is used (doesn't that sound so cool?) A subnet mask is very simple, each byte is either 11111111 or 00000000. Yet again, I will use an example to show how a subnet mask works. Let's say that only the 10, in the 10.4.9.1, is the network address. The subnet mask would be 255.0.0.0 (11111111 = 255). 255.0.0.0 is ANDed with 10.4.9.1. Basically, the 11111111.00000000.00000000.00000000 is multiplied with 00001010.00000100.00001001.00000001 to make the network address, which comes out to be 00001010.00000000.00000000.00000000, (10.0.0.0), after multiplication, or "ANDing". Of course, the network address might also be the 10 and 4, in which case the subnet mask would be 255.255.0.0, and the network address would come out to be 10.4.0.0.

Yet ANOTHER system is the hexadecimal system (almost sounds as cool as subnet mask), which is a Base 16 system. It uses 0-9, but also uses A-F. 0-9 equal 0-9 respectively, but 10, 11, 12, 13, 14, and 15 are represented by A-F (respectively). Hexadecimal is a way to simply binary, even more so than decimal. Hexadecimal can represent an 8-bit binary number in just TWO characters. Let's say we have A9, a hexadecimal number. A represents 10 and 9 represents 9. Converting that to binary is VERY simple. Each hexadecimal digit represents four bits. 10 in binary is 1010, and 9 is 1001. Combine them together, and you have 10101001, which when converted to decimal is 169. To convert hexadecimal directly to binary, you have to multiply the first number by 16 and the next number by 1, and then add them together. Like with A9, you multiply A, which is 10, by 16. Now you have 160. Then you multiply 9 by 1, which is 9. Add 160 and 9 together, and you have 169. Same as when the binary equivalent is converted! Interesting, aye? And here's a little trick if you don't like going through long conversions. If you are on a Windows Operating System, open up the calculator. On the left side on the top, you'll see "Hex, Dec, Oct, and Bin". Let's use the hexadecimal number A9 again. If you click "Hex", you'll see the letters on the bottom light up. If you click A and 9, then click "Dec" (for decimal), it will convert into decimal, which is 169. You can also convert Bin (binary) in decimal or hex, hex to decimal or binary, or any other combination. Even if you don't plan to go into any computing career, this is some good stuff to know. Why? Just because.





© 2007 W4T3R.com. All Rights Reserved. Please don't steal from me.