Network Addressing
Introduction
- How does a site know how to find your computer? How does your computer know how to find a certain site?
In this chapter you are going to learn how your computer accesses websites and how web servers know which computer to send their data to. They're going to find your machine with two addresses including your IP address and your MAC address.
But why would your computer need two addresses? Well, think of it like your house. When you're giving someone directions to your house, you give them two things. First is the actual address, so that they can look up directions online, and then you give them a description of your house. So you'd say something like this: I live at 1600 Pennsylvania Ave. and it's a small one story brick house with a putting green and a flock of pink plastic flamingos in the front yard. The address that appears on your mail is like your IP address - it changes every time you move machines. And then the description is like your MAC address - it's a lot harder to change, except for those darned flamingos...
Background
In order to more fully understand the material in this chapter you're going to need a little bit of background in binary and hex.
Binary
For people who have never really encountered binary, it can seem a little bit intimidating. It really isn't that bad, trust me. Most people learn math in base 10 in elementary school and learn it through a system that looks something like this (where H is hundreds, T is tens, and O is ones):
| H | T | O |
|---|---|---|
| 1 | 8 | 5 |
Mathematically those columns look something like this:
| 10^2 | 10^1 | 10^0 |
|---|---|---|
| 1 | 8 | 5 |
So: [ (1 * 10^2) + (8 * 10^1) + (5 * 10^0)] = 185
[(1 * 100) + (8 * 10) + (5 * 1)] = 185
Right? If the number in the ones column is more than ten, you simply carry the number over to the number over to the next column like this: if you have 13 in the ones column you move the 10 into the tens column and leave the 3 in the ones column. The concept is very similar in base 2. The biggest difference is that instead of having 10^0, 10^1, and 10^2 you have 2^0, 2^1, and 2^2:
| 2^2 | 2^1 | 2^0 |
|---|---|---|
In binary only two numbers are used: 1 and 0, as opposed to the 0-9 in the base ten system. This is because 1 and 0 are the only numbers that will fit in the columns. In order to write the number 5 in binary you need to break the number down. 5 = 4 +1, both 4 and 1 can be easily converted into base two. 4 = 2^2 and 1 = 2^0, so you put a 1 in the 2^2 and 2^0 columns, and a 0 in any columns between. This results in a chart that looks like this:
| 2^2 | 2^1 | 2^0 |
|---|---|---|
| 1 | 0 | 1 |
So the number 5 in binary is 101.
This is just a quick explanation of how binary works. There are more complete tutorials out there.
For your reference:
- 2^0 = 1
- 2^1 = 2
- 2^2 = 4
- 2^3 = 8
- 2^4 = 16
- 2^5 = 32
- 2^6 = 64
- 2^7 = 128
Hex
Hexadecimal (otherwise known as hex) is the code that is usually used in web design as each color is assigned a hex code. It usually looks something like this: #66CC99. What do the letters mean? The letters are numbers that are 10 and greater. here's the chart:
| Decimal: | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Hex: | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
This next part will be very similar to the binary example above. This time instead of base 2, you're going to use base 16. So if you do something like this:
| 16^2 | 16^1 | 16^0 |
|---|---|---|
| 2 | F | A |
And then crunch the numbers - [(2 * 16^2) + (15 * 16^1) + (10 * 16^0)] - we get 762. And no, the 10 and 15 did not show up out of nowhere. Remember that in hex letters equal numbers. 10 = A and 15 = F.
Sometimes there are hex numbers like 235. Without a symbol in front you can't tell if it's actually 235, or if it's 565. Here's how you can tell the difference: usually there will be either a $ sign, a # sign, or 0x in front of the number. So $235, #235 and 0x235 are the same hexadecimal number.
IP Addresses
An IP address is a number given to a computer (a server or a personal computer) by the ISP. The most commonly used IP address is a 32-bit (4 byte) address. It looks like this in the decimal system: 172.16.0.1 . This number is converted from binary because it tends to be easier for humans to process decimal numbers. In binary the IP address looks something like this: 10101100.00010000.00000000.00000001 - the reason this is a 32-bit address is because in binary there are 32 characters, and it's 4 bytes because there are 4 groups of 8. These bytes are also called octets.
So what exactly does this number mean?
The first octet defines the class of the network. The class determines how big the address space is for the network... in other words, how many computers can be addressed on the network. A class networks are the largest, and are usually reserved for governments. B class networks are second largest, and are used by ISP's, corporations, school systems and the like. C class networks are the smallest
A = 0-123 (last 3 octets available for host addressing) B = 124 - 191 (last 2 octets available for host addressing) C = 192 - 223 (last 1 octet available for host addressing) D/E = 224 - 255 (experimental and testing networks)
EXAMPLE:
If your computer has an address of 158.59.224.135, the address is interpreted as follows: The computer belongs to a class B network, so the first two octets define the network. The last two octets define the specific host on the network, as well as any subnetting.
The first two octets are the IP address assigned by the ISP for all of the computers in that network. The administrator or the user assigns the last two octets to the computer. This means you. If you have a network of, lets say, three computers and your network IP address is 172.16.0.0 you can assign the first computers IP address to be 172.16.0.1 then the second computer's IP address can be 172.16.0.2, and the third can be 172.16.0.3 . This allows you to keep your network a little more organized.
Give them the IP address of a well-known site as an example.
Important IP addresses
- 127.0.0.1
- Private Addresses ( http://en.wikipedia.org/wiki/Private_IP_address )
- 10.0.0.1-10.255.255.254 (10.0.0.0/8)
- 172.16.0.1-172.31.255.254 (172.16.0.0/12)
- 192.168.0.1-192.168.255.254 (192.168.0.0/16)
| Important! | The specific IP addresses still need to be explained more - I think I've got a grasp on the Private IP addresses, but not well enough to explain them Vbnearing 01:14, 13 July 2006 (EDT) |
Dynamic IP Addresses
Dynamic IP addresses are IP addresses that are not necessarily tied down to one machine. They are usually applied to personal computers and other devices that can be taken on an off a network without worrying about disrupting anything other than being suddenly disconnected while trying to send an e-mail. You will usually find a dynamic IP address on your personal computer.
Static IP Addresses
You are more likely to find a static IP address on a server than on a personal machine. This is because if the IP address to a server changes it will disrupt the ability of users to access the site (or sites) hosted on that server.
IPv4
IPv4 is the fourth version of the Internet Protocol. Was there anything before version four? IPv4 is the first, and virtually the only, protocol used on the Internet, thus making it pretty much the most important protocol to know right now. There is really only one issue with IPv4 and that is the number of available addresses. There are 2*10^48 - that's 4,294,967,296 - possible unique addresses available with v4. That may look like a lot, but consider that about 18 million of those addresses are used by private networks and just how many web servers and personal computers are out there - not to mention cell phones and other wireless devices. Then there's the fact that there are 6 billion people on our planet. Suddenly 4,294,967,296 unique addresses aren’t quite as many as it seemed.
Notation
This is what an IP address looks like in numerical form:
- 127.0.0.1
You will probably be using this frequently in network addressing, at least until IPv6 becomes more widely used.
IPv6
Here's where the 'virtually the only protocol used on the internet' bit comes in. Because of the shortage of addresses in IPv4 there was a push to create a newer protocol. With IPv6 there are now 2^128 possible unique addresses. That’s 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses. Now chances are that we wont be running out of those addresses anytime soon.
| Of Note | 340,282,366,920,938,463,463,374,607,431,768,211,456 is "three hundred forty undecillion, two hundred eighty-two decillion, three hundred sixty-six nonillion, nine hundred twenty octillion, nine hundred thirty-eight septillion, four hundred sixty-three sextillion, four hundred sixty-three quintillion, three hundred seventy-four quadrillion, six hundred seven trillion, four hundred thirty-one billion, seven hundred sixty-eight million, two hundred eleven thousand, four hundred fifty-six" |
IPv6 is not yet a widespread protocol. It is the successor to IPv4, and v4 is still the most common protocol on the Internet. Chances are that at sometime in the near future (most government servers should be using IPv6 by 2008) IPv4 and v6 will be operating alongside each other. You may be wondering what happened to v5 if v6 is the successor to v4. IPv5 was an experiment and was never intended to become public. Chances are the only two Internet Protocols you'll be hearing about are v4 and v6.
Notation
The notation for IPv6 is a little more complicated than the notation for IPv4 - but that is to be expected considering how many unique addresses v6 has. This is a full IPv6 address:
- 2001:0db8:0000:0000:0000:0000:1428:57ab
Long, isn't it? Well, there is a nice shortcut that can be used. You can remove all consecutive groups of four zeros and leave two colons. Like this:
- 2001:0db8::148:57ab
| Important! | There can only be one set of double colons in a v6 address or else you invalidate the address |
Gateways
So you've got your computer all hooked up and you want to get online - wirelessly or through a LAN - you just directly connect to the Internet, right? Nope. Usually in order to get to the Internet through your home network you need something called a gateway. This is typically a computer designed specifically act as just that - a gateway to the Internet. A gateway can handle data at any level of the OSI and passes it on to your machine or out onto the Internet.
The gateway has two IP addresses. One is used to connect to the Internet, and one that is used to connect to your machine. This way the only address seen on the WAN is the gateway IP address and not your machine's.
Private Networks
Private networks are commonly used in office networks where they only want limited access of the Internet. Why would they only want limited access? To protect sensitive information such as financial data, unreleased product data, etc. The way they do this is by assigning private IP addresses to their machines and by using a special gateway called a NAT. A NAT basically rewrites IP addresses as they pass through a router so that all of the computers on the private network use only one public IP address. Technically routers are not supposed to be able to do this, the reason it is done is because of the shortage of IPv4 addresses and because network administrators found it more convenient.
| Important! | Using NAT creates complications in communication with certain Internet protocols |
One of the basic ideas behind the Internet is something called end-to-end connectivity. End-to-end connectivity basically means that all nodes on a network can transmit data to any other node on the network without needing any other program or device to interpret the data. While NAT does not disrupt all communications, it does disrupt enough to complicate things when one is used.
[I think this is going to mostly be the difference between a home network and a private network, and how they use gateways and NATs to protect their intranet. Once the reason it's a sub section of Gateways] Vbnearing 12:02, 10 July 2006 (EDT)
MAC Addresses
No, it has nothing to do with Apple products. This is the address of your computer (or any other piece of network hardware) that is similar to the physical description of your house, it is also referred to as the physical address. This is because you MAC address is used at the bottom layer of the OSI - otherwise known as the physical layer since it deals with the actual hardware and cabling used in networks.
And like your house it can be changed, but it's a lot more difficult than changing an IP address. Now I just said that MAC addresses are attached to the physical hardware, which would imply that it's impossible to change. Technically it is. But what you can do is spoof it - flat out fake the MAC address. Why would you want to do this if the address is permanent?
- Some IPs don't want you using another companies hardware - so the service is programmed to shut down when it detects certain MAC addresses. Not all IPs do this.
- To try and hide what kind of machine you're using, privacy.
| Important! | If you do change the MAC address it will revert to the original and true address when the machine is rebooted |
So there was an issue with the number of available IP addresses which has begun to force a new version. Is the same problem happening with MAC addresses? Nope. There are 2*10^48 possible unique addresses. That's 281,474,976,710,656 possible addresses. It's estimated that we're not going to run out of them until after 2100. So we're going to be just fine for a while.
Notation
This is a MAC-48 address:
- 00-16-cb-ba-a4-6c
The MAC address is written in hex. The first three octets (00-16-cb also known as 0-22-203) identify the company that built the machine. In this case the company is Apple Inc. The last three octets (ba-a4-6c also known as 186-164-108) are the serial number attached to the machine.
You can find out what company made your machine by entering your MAC address (or the first three octets of your MAC address) on the ieee.org site using their public OUI listing.






