This action might not be possible to undo. Are you sure you want to continue?
We are accustomed to using the decimal number system, which uses the digits 0 through 9. Binary is the numbering system that network devices use to process all data. Without binary, computers and networks would not function. All data sent across a network is in binary. Just like we use the decimal numbering system (numbers 0 through 9) for all counting, money, and financial transactions, computers use binary for storage of all data, all data transmissions, and all numerical calculations. You can think of this as a language. For example, all people in Russia use Russian for all communication. If someone in Russia talked to someone in the United States, they would probably talk in English so that we could understand and communicate. That person would be bilingual because they understand two languages. In that sense, you could compare the computer to them because the computer understands two numbering systems, binary and decimal. Humans don't want to have to think or do calculations in binary. We want to convert those binary numbers to decimal. Converting from binary to decimal is not difficult. The numbers 0 and 1 in binary are converted to 0 and 1 in decimal. After that, it gets a little more complicated. Here is an example of counting from zero to ten using binary: Decimal 0 1 2 3 4 5 6 7 8 9 10 Binary 0 1 10 11 100 101 110 111 1000 1001 1010
All binary to decimal or decimal to binary conversions use this chart: 27 26 25 24 23 22 21 20 12864 32 16 8 4 2 1
Let's discuss how to use this chart. First, always start by looking at the chart from right to left, not from left to right. Second, all the numbers on the chart
stay where they are -- you don't change these. These numbers are used to tell you the values of the binary digits you will enter in the blanks. Finally, the top line of 2x numbers tells you what each column represents. The column on the far right is worth 20. The second line, with the decimal numbers, tells you what the answer is to the 20 line. So, if you look at the column on the far right, second line, it tells you that 20 is equal to 1 IF there is a 1 in the blank below it. If you had a one in the fourth column from the right, 23, you would have a value of 8 turned ON. Anywhere that you do not have a 1 in the bottom line, you will fill in with a zero. Think of each of these columns being able to be turned ON and OFF by using a 1 or a 0, respectively. When you are done filling in your 1's and 0's on the bottom line of the chart, you can add all the values that you turned ON, in decimal, from left to right (using the second line of the chart). Thus, if you had put a 1 in the 23 column (8) and a 1 in the 20 column (1), you would add 8 + 1 = 9. That 9 is represented by 1001. These numbers are calculated using this table: 27 26 25 24 23 22 21 20 1286432168 4 2 1 = 9 0 0 0 0 1 0 0 1 = 1001 Let's look at another example... If you look at the number 3, it was calculated by having a 1 in the 20 place and a 2 in the 21 place (starting on the right-hand side of the table). If you add the 1 that you get from the 20 place and the 2 that you get from the 21 place, you get 3. In other words, 1 + 2 = 3. Let's look at another one. The 1000 in binary represents 8 in decimal because you have a 1 in the 23 place and that gives you 8. You have 0's in all the other places. IP addressing and binary The three critical pieces of information that you, the network administrator, provide or a DHCP server provides to network devices (computer, server, router, switch, etc.) are:
• • •
IP Address Subnet mask Default Gateway
The network device immediately converts this information into binary. So, let's pretend that we are that network device and we are given the following information:
IP Address = 22.214.171.124 Subnet Mask = 255.255.255.0
Default Gateway = 126.96.36.199
The computer converts this information into binary and calculates the Network ID. Before we can calculate the Network ID, we first have to convert from decimal to binary. Converting decimal to binary Let's start with converting the IP address to binary. To convert 188.8.131.52 to binary, you take the octets (the numbers between the decimals) one at a time, like this: 1 decimal = 1 binary 1 decimal = 1 binary 1 decimal = 1 binary 1 decimal = 1 binary An IP address is 32 bits in binary, so each octet is 8 bits in binary. Because of this, we need to pad the other bits as 0's. That means that 184.108.40.206 in decimal equals the following number in binary: 00000001 00000001 00000001 00000001 That was easy! To convert the subnet mask of 255.255.255.0, take each octet one at a time, using the table: 27 26 25 24 23 22 21 20 12864 32 16 8 4 2 1 Here is what I get: 255 = 11111111 To do this, I looked at the bottom row of numbers that each binary space represents. I started with 27, which equals 128. So, how many 128's are in 255? The answer is 1. So I write: 256 – 128 = 127 Now, how many 64's (the next binary space) are in 127? The answer is 1, so I write: 127 – 64 = 63 And so on, like this: 63 – 32 = 31 31 – 16 = 15 15 – 8 = 7 7–4=3 3–2=1 1–1=0 So, I used all 8 binary spaces to calculate the 255 in decimal, to be 11111111 in binary. The last octet is a 0, so 0 in binary is 0 but we write 00000000. As
you get more experience you will already know that eight 1's in binary equals 255 in decimal. The total subnet mask in binary is: 11111111 11111111 11111111 00000000 So, here is our IP address and subnet mask in binary: 00000001 00000001 00000001 00000001 11111111 11111111 11111111 00000000 Calculating the Network ID The network device on which you configured this IP addressing information must know what its network ID is. The network ID tells the device what its local network is. If the destination IP address for the network device with which this network device is trying to communicate is not on its local network, that traffic is sent to the default gateway. Thus, the default gateway is used only if the destination for the traffic your device is sending is not on your local network. To calculate the Network ID, start off with the IP address and subnet mask in binary, from above: IP Address 00000001 00000001 00000001 00000001 Subnet Mask 11111111 11111111 11111111 00000000 Perform a logical AND on these. A logical AND is a math function where you look at each row and calculate an answer based on the following rules:
• • •
0 and 0 = 0 0 and 1 = 0 1 and 1 = 1
In our case, this is the answer you get: IP Address 00000001 00000001 00000001 00000001 Subnet Mask 11111111 11111111 11111111 00000000 AND Network ID 00000001 00000001 00000001 00000000 Using the AND rules, I look at the first 0 in the IP address and the first 1 in the subnet mask. I see that, according to the rules, a 0 and a 1 = 0. That is how I calculated the first 0 in the network ID. To continue, I go from left to right, calculating each row. Notice that the only difference between the IP address and network ID is in the last number of the last octet. Now, to get the Network ID in decimal, we convert this back. This is a simple example, so converting it back is easy. The 00000001 in binary is converted to 1 in decimal. In the last octet, the
00000000 is converted to 0. This makes our network ID: 220.127.116.11 So, when the network device wants to communicate with a host that has the IP address of 18.104.22.168, it compares this with its network ID and finds that this host is on the local network. The network device can then communicate directly with it because it is on the 22.214.171.124 network. If the network device wants to communicate with host 126.96.36.199, however, it finds that this is NOT on its local network (the 188.8.131.52 network) and it sends this traffic to the default gateway. These examples are, of course, very simplified, since this topic can get very complex when you begin subnetting networks and using variable-length subnet masks. Article Summary Here is what we have learned:
• • • • •
Binary is a numbering system using only 1 and 0. Use the binary conversion chart to convert from binary to decimal and back. Your network device/computer calculates the Network ID using the IP address and subnet mask it is provided. To calculate the Network ID, the computer performs a math calculation called a "logical AND." A default gateway is not required for a device that will not communicate outside its local network.
About the author: David Davis (CCIE #9369, CWNA, MCSE, CISSP, Linux+, CEH) has been in the IT industry for 15 years. Currently, he manages a group of systems/network administrators for a privately owned retail company and authors IT-related material in his spare time. He has written over fifty articles, eight practice tests and three video courses and has co-authored one book. His website is at www.happyrouter.com.
- Binary describes a numbering scheme in which there are only two possible values for each digit: 0 and 1.� The term also refers to any digital encoding/decoding system in which there are exactly two possible states.� In digital data memory, storage, processing, and communications, the 0 and 1 values are sometimes called "low" and "high," respectively. Binary numbers look strange when they are written out directly.� This is because the digits' weight increases by powers of 2, rather than by powers of 10.� In a digital numeral, the digit furthest to the right is the "ones" digit; the next digit to the left is the "twos" digit; next comes the "fours" digit, then the "eights" digit, then the "16s" digit, then the "32s" digit, and so on.� The decimal equivalent of a binary number can be found by summing all the digits.� For example, the binary 10101 is equivalent to the decimal 1 + 4 + 16 = 21: DECIMAL = 21 64 32 16 8 4 2 1 BINARY = 10101 0 0 1 0 1 0 1 The numbers from decimal 0 through 15 in decimal, binary, octal, and hexadecimal form are listed below. DECIMAL
1. What do you need to know about addresses? You probably know what an IP address is: a number that identifies that device on the network. But what else do you need to know? IP addresses are made up of 32 bits (IPv4 addresses, that is). We normally think of an IP address as something like 184.108.40.206, but really this can be translated into eight binary bits (see Binary-to-Decimal Conversion for more information). Each set of binary bits can represent only the numbers zero through 255. That is why your IP addresses can range only from 0.0.0.0 to 255.255.255.255. By the way, the IP address 255.255.255.255 is called the "all ones" network because in binary it is represented by 32 numeral ones (1s). The all ones address is used to send a packet to all devices on all networks (as long as it isn't stopped by a router first). Traditionally, IP addresses were broken up into classes, but those classes aren't used much any more unless you are taking a certification exam. We will learn more about classes below. Most importantly, IP addresses must be unique on your network. If two devices have the exact same IP address, you have an IP address conflict. When that happens, either device or both devices will not work on the network. Commonly, DHCP is used to dynamically allocate IP addresses in hopes of preventing address duplication and easing the administrative burden of static IP addressing. 2. What is a subnet mask? A subnet mask is what tells your computer (or other network device) what portion of the IP address is used to represent your network and what part is used to represent hosts (other computers) on your network. For example, if you have an IP address of 220.127.116.11 and a subnet mask of 255.255.255.0, the 255s mask off the first three 1s. If you did the logical "AND" (the calculation your computer does -- see Binary-to-Decimal Conversion for more information), you would find out that the network ID for this network is 18.104.22.168. Where the 0 is located, you could fill in hosts numbered 1 to 254. For example, the first host on your network is 22.214.171.124 and the last host is 126.96.36.199. Of special note when looking at the number of hosts in a network is this: The first IP address in a network is the network address and the last IP address is always the broadcast address. That's why I couldn't use IP address 188.8.131.52 and IP address 184.108.40.206. These are special, reserved addresses, but some computers will allow you to use the network address as a real computer address. "Subnetting" is breaking up a single network into smaller networks. To do this, you add more bits (more numbers) to the subnet mask. Traditionally, we are used to seeing subnet masks that look like 255.0.0.0, 255.255.0.0, or 255.255.255.0. However, a subnet mask might also look like 255.255.128.0 or
255.255.255.224. In both of these cases, it is obvious that the network has been subnetted to break a single network into smaller networks. 3. What is the difference between "classful" and "classless" IP addressing? When the concept of IP addressing was first thought up, it was decided that IP addresses would be put into classes. These classes are: Class IP address range Default subnet mask A 220.127.116.11 to 127.255.255.255 255.0.0.0 B 18.104.22.168 to 22.214.171.124 255.255.0.0 C 192.0.0.0 to 126.96.36.199 255.255.255.0 Today, these default subnet masks aren't much used except as a point of reference and trivia. For example, if I said that your IP address was 192.168.1.1 but didn't tell you the subnet mask, it would be safe to assume that your subnet mask is 255.255.255.0 because that IP address falls into the Class C range. This is also important when you take some certification tests. In real life, an IP address today could have any legal subnet mask. For example, you may have an IP address of 188.8.131.52 with a subnet mask of 255.255.255.240. Or you may have an IP address of 184.108.40.206 with a subnet mask of 255.0.0.0. Sometimes, people will say things like "I need an entire Class C block of addresses." This just means that they want 254 contiguous and usable IP addresses. The term "classful" means that the IP address or software is assuming that IP addresses fall into these classes and uses the default subnet mask shown. If a routing protocol, like RIP, is classful, it has trouble with the IP addresses that don't use the default subnet masks. On the other hand, a "classless" routing protocol, like RIP version 2, doesn't assume that IP addresses have their default subnet masks. Today, you should assume that all network devices are classless unless you find that they are not (like routing protocols RIP or IGRP, or a very old computer operating system). 4. What is a default gateway? Contrary to popular belief, a default gateway is not a required piece of IP address configuration on any computer. However, if you want to access devices outside of your local network (such as devices on the Internet), a default gateway is required. A default gateway is where a computer sends requests to IP addresses that are not on its local network. How does the computer know what is and what is not on its local network? As discussed above, the subnet mask is what the computer uses to know what is and what is not on its local network. Say, for example, your IP address is 220.127.116.11 and your subnet mask is 255.255.255.0,
and you make a Web request to 18.104.22.168. Because of your subnet mask, your local area network is the 22.214.171.124 network. Meaning anything that is 126.96.36.199 through 254 is on your local network. Because you are requesting 188.8.131.52, which is not on your local network, that packet would be sent to your default gateway. 5. What are private IP addresses? The private IP address space is defined by RFC1918. In this RFC, it says that no public (take that as "no Internet") devices will use or recognize the following IP addresses:
• • •
10.0.0.0 to 10.255.255.255 (10/8 prefix) 172.16.0.0 to 172.31.255.255 (172.16/12 prefix) 192.168.0.0 to 192.168.255.255 (192.168/16 prefix)
Your IP address may be the same on your PC as someone else's if you have a private IP address. These ranges of IP addresses are available for anyone to use on their own internal (private) network. There is no need to keep them unique. I can have IP address 192.168.1.1 on my home network and so can everyone else in the world! When I go to make a request to the Internet, however, that private IP address must be converted into a public IP address or else the Internet router I make the request to will just throw my request away (because I have a private IP address). Network Address Translation (NAT) is what performs this public-to-private translation (see RFC1631 and RFC2663 for more information on NAT). Private IP addresses are there to reduce the need for more public IP addresses. An unintentional consequence is that they provide a tiny bit of security. So, if I am trying to FTP to your computer on the Internet and you tell me that your IP address is 192.168.3.3, I will tell you "No, I need your public IP address, not your private IP address."
- A subnet (short for "subnetwork") is an identifiably separate part of an organization's network. Typically, a subnet may represent all the machines at one geographic location, in one building, or on the same local area network (LAN). Having an organization's network divided into subnets allows it to be connected to the Internet with a single shared network address. Without subnets, an organization could get multiple connections to the Internet, one for each of its physically separate subnetworks, but this would require an
unnecessary use of the limited number of network numbers the Internet has to assign. It would also require that Internet routing tables on gateways outside the organization would need to know about and have to manage routing that could and should be handled within an organization. The Internet is a collection of networks whose users communicate with each other. Each communication carries the address of the source and destination networks and the particular machine within the network associated with the user or host computer at each end. This address is called the IP address (Internet Protocol address). This 32-bit IP address has two parts: one part identifies the network (with the network number) and the other part identifies the specific machine or host within the network (with the host number). An organization can use some of the bits in the machine or host part of the address to identify a specific subnet. Effectively, the IP address then contains three parts: the network number, the subnet number, and the machine number. The standard procedure for creating and identifying subnets is provided in Internet Request for Comments 950.
The IP Address
The 32-bit IP address (we have a separate definition of it with IP address) is often depicted as a dot address (also called dotted quad notation) - that is, four groups (or quads) of decimal numbers separated by periods. Here's an example:
Each of the decimal numbers represents a string of eight binary digits. Thus, the above IP address really is this string of 0s and 1s:
As you can see, we inserted periods between each eight-digit sequence just as we did for the decimal version of the IP address. Obviously, the decimal version of the IP address is easier to read and that's the form most commonly used. Some portion of the IP address represents the network number or address and some portion represents the local machine address (also known as the host number or address). IP addresses can be one of several classes, each determining how many bits represent the network number and how many represent the host number. The most common class used by large organizations (Class B) allows 16 bits for the network number and 16 for the host number. Using the above example, here's how the IP address is divided: <--Network address--><--Host address--> 130.5 . 5.25
If you wanted to add subnetting to this address, then some portion (in this example, eight bits) of the host address could be used for a subnet address. Thus: <--Network address--><--Subnet address--><--Host address--> 130.5 . 5 . 25
To simplify this explanation, we've divided the subnet into a neat eight bits but an organization could choose some other scheme using only part of the third quad or even part of the fourth quad.
The Subnet Mask
Once a packet has arrived at an organization's gateway or connection point with its unique network number, it can be routed within the organization's internal gateways using the subnet number as well. The router knows which bits to look at (and which not to look at) by looking at a subnet mask. A mask is simply a screen of numbers that tells you which numbers to look at underneath. In a binary mask, a "1" over a number says "Look at the number underneath"; a "0" says "Don't look." Using a mask saves the router having to handle the entire 32 bit address; it can simply look at the bits selected by the mask. Using the previous example (which is a very typical case), the combined network number and subnet number occupy 24 bits or three of the quads. The appropriate subnet mask carried along with the packet would be:
Or a string of all 1's for the first three quads (telling the router to look at these) and 0's for the host number (which the router doesn't need to look at). Subnet masking allows routers to move the packets on more quickly. If you have the job of creating subnets for an organization (an activity called subnetting) and specifying subnet masks, your job may be simple or complicated depending on the size and complexity of your organization and other factors.
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue listening from where you left off, or restart the preview.