IP Addresses What are IP Addresses? IP addresses are an essential item in the world of networking, no matter whether it is a small home network, a local area network in a company, or a global network such as the Internet. A network is a number of computers that are physically connected to be able to communicate with each other and exchange data. But in order for them to be able to communicate, they need to speak a common language in order to bridge the gap between different operating systems etc. It enables a web server running UNIX to send data to your PC running Windows in a format that Windows can understand and use. This common language ensures that the data sent by one computer, and the form it was sent in, can be understood and used by the receiving computer. The common language used is called a protocol. There are several protocols available, but one of the most important and most common ones is TCP/IP, which stands for Transmission Control Protocol/Internet Protocol. But speaking a common language is not enough. In addition, each computer on a network has to be uniquely identifiable for the single reason that the computer who sends data knows where to send it to and vice versa the computer who requests data, needs to know where it is coming from so it knows where to request data from. For that purpose, every computer on a network is assigned a unique number, which is called an IP address. Think of it as your phone number. In order to talk to your friend on the phone, you both have to have a physical connection, the phone company's network. But to be able to connect to your friend on the phone, you need to identify to the network who you want to talk to. This is done by a unique number, your friend's phone number that is unique to his phone. Same thing with IP addresses and computers. An IP address is a 32-bit number, divided by periods into 4 groups. Each group is called either an octet because it consists of 8 bits, or a byte because one byte equals 8 bits. An IP address could look like this: 192.168.0.1 An IP address actually contains two pieces of information. The first part of the IP address contains the network ID. It uniquely identifies a network within a group of different networks. The second part of the IP address contains the host ID. It uniquely identifies a computer within a group of computers on the same network. An easy way to find out your current IP address is to go to Start/Run, type winipcfg and click OK. In the resulting window you'll see your IP address listed. If you have more than one adapter installed on your system, e.g. a network card and a modem, then you can select from the drop-down menu to see the different IPs. Who assigns IP addresses? In order for IP addresses to remain unique, somebody has to assign them and keep track of them. For the Internet, this is the Internet Assigned Numbers Authority (IANA) that assigns blocks of IP addresses to organizations such as ISPs. For your company network, it would be your network administrator who has a block of IP addresses that he assigns to every computer in the company. For your Internet access, it would be your ISP that has a pool of IP's that they assign to their customers. For your home network, if you set up a small home network, you would assign an IP address to your computers. For the specific purpose of home networking, IANA has reserved several blocks of numbers as private IP numbers that can be used in private networks only but not on the Internet. These blocks are: 10.0.0.0 - 10.255.255.255 172.16.0.0 - 172.31.255.255 192.168.0.0 - 192.168.255.255 There is a reason that there are three blocks of numbers, and not just one big block. IP addresses are separated into 3 classes, simply called Class A, B, and C. Class A addresses are used for systems with a small number of networks, but a large number of computers (hosts). They use only the first byte/octet of the IP as network ID, and the remaining 3 bytes as host ID. Class B addresses are used for systems with a roughly equal number of hosts and networks, They use the first two bytes/octets of the IP as network ID, and the remaining two bytes as host ID. Class C addresses are used for systems with a large number of networks, but a small number of computers (hosts) on each network. They use the first 3 bytes/octets as network ID, and the remaining byte as host ID. In order to identify which class is used, something called a subnet mask is used. If a byte is used for network ID, that byte of the subnet mask will be 255. If a byte is not used for the network ID but for the host ID instead, that byte of the subnet mask will be 0. The following table should make this a little clearer: Class IP Example Network ID Host ID Subnet Mask Class A 10.5.67.15 10 5.67.15 255.0.0.0 Class B 172.27.95.14 172.27 95.14 255.255.0.0 Class C 192.168.0.1 192.168.0 1 255.255.255.0 How are IP Addresses assigned? As we mentioned earlier, IP addresses are assigned by the IANA, network administrators, ISPs, or yourself. What we didn't mention is that there are different ways of assigning IP addresses. Static IP addresses A static IP address is a number that is permanently assigned to a certain computer and does not change. Once a computer has been assigned its IP address, it will keep it indefinitely. The advantage of a static IP is that the computer will always have the same IP address on the network and will be easy to identify in the future once its IP address is known. The disadvantage is that the party that assigns the IP has to do this manually and keep good track of them to make sure that it does not get assigned to another computer as well by accident. You will find static IP addresses used by some cable modem providers, in small company networks, and of course on the Internet where every site has its own unique permanent IP address until it is removed or moved to another web server and assigned a new IP. Dynamic IP addresses A dynamic IP address is a number that is assigned to different computers at different times. This means that every time a computer is connected to a network, it is assigned a random IP address from a pool of IP addresses depending on whatever IP is available and is not currently in use. For example if your company network uses dynamic IP addresses, it means that when you start your computer and it wants to log into the network, it will get a new IP address. Or every time you connect to the Internet using a dial-up connection through your modem to your ISP, the ISP will assign an available IP address to your computer for the time of your online session. When you disconnect your computer from your ISP and connect again the next time, you'll be assigned a different IP address depending on what IP's are available at that time. This is done with a technology called Dynamic Host Configuration (DHCP). The server for the network has a number of IP's available to assign to hosts on the network and distributes them to computers as needed as they connect to the network. The advantage of dynamic IP's is that the server automatically keeps track of them and makes sure that each computer has a unique address. There is no need to keep track of them manually. Another advantage is that it allows computers to move between subnets and always have a valid IP without manual reconfiguration. A lease time can be assigned to a dynamic IP for automatic expiration to disconnect a computer from the network after a certain time. To find out whether your computer has a dynamic or static IP, go to Start/Settings/Control Panel and double-click the Network icon. In the resulting window, make sure the Configuration tab is selected and double- click the TCP/IP protocol entry to see the TCP/IP properties. Select the IP address tab. If "Obtain an IP address automatically" is selected, you're set up with a dynamic IP. If "Specify an IP address is selected" then you'll see your IP address displayed in the field below and it means you have a static IP address. IP addresses on the Internet IP addresses are essential on the Internet as the TCP/IP protocol is the main protocol used to connect to the Internet. To connect to the Internet and for your computer to be seen on the Internet you need an IP address. If you use a modem and a dial-up connection to get online, your ISP assigns you a dynamic IP address for the time you're online. If you have a DSL connection or cable modem, you most likely have a static IP address (though there are exceptions depending on the provider). In addition, every web site on the Internet has its own IP address. This IP is static so that the site is always found on the same spot on the web. Otherwise it would be difficult to find the site. Imagine your friend randomly changing phone numbers. It would make it hard for you to call if you didn't know the number and had to look it up every time. This IP address is assigned to the site by the web host or the web administrator since web sites are hosted on computers that are connected to the network of the Internet. You can assign multiple IP addresses to one computer which allows web hosts to host multiple sites on one and the same computer. For example, Yahoo's site has the IP address 204.71.200.74 which identifies it uniquely on the Internet. If you open your browser and type in the IP 204.71.200.74 and hit Enter, Yahoo will show up. Wait a second, you are probably saying right now, I never use that number to go to Yahoo. That's true, you most likely just type in www.yahoo.com and your browser brings up the correct site. Yahoo is a lot easier to remember than 204.71.200.74. This is where domain names come into play. Think about our example with phone numbers again. In order to call your friend, you have to dial a phone number which can be hard to remember. To make this easier, you keep address books that have your friend's names and phone numbers listed. Same reason phone books exist. You look up the name, find the right number, then dial it. In a simplified manner, this is exactly like your browser works. When you type in www.yahoo.com, your browser has no clue what to do. So it first talks to another computer called a Domain Name System server, or DNS server for short. This DNS server is maintained by your ISP and updated on a frequent basis. Your browser asks now the DNS server what www.yahoo.com means. The DNS server will look it up in its list of web sites and, if it finds a listing that matches, pull up the correct IP address for that site, in our example 204.71.200.74, so that now your computer knows what computer to connect to and request retrieval of the desired web page. You can easily find out what IP address a site has by using one of several commands. You can either do a WhoIs lookup at one of many sites that offer this service for free, such as WhoIs.Net, or you can open a DOS window and type ping www.yahoo.com. This actually sends a small packet of data to the site and measures in milliseconds how fast the reply comes back, but it also displays the IP address of the site at the top. On NT and UNIX machines you can use the NSLOOKUP command to get this information. How does a new web site get an IP address? When you set up a web site, the first thing you usually do is register a domain name with a registrar. These organizations keep track of domain names in a database. When you register your new domain name, they will ask you where your site is hosted and what DNS server your site is listed on. If you use a web host for example, you would tell them the name and IP address of your web host's DNS server (usually web hosts do this for you). Your web host will make an entry in its DNS server with your site's domain name and the IP address they assigned to it which then points to whatever computer the site resides on. As soon as your ISP has added the name and IP address for your site to its DNS server's database, it will know where to go to retrieve the web page you asked for when you typed in the domain name. Another thing that could happen is that a site changes its IP address, either because the web administrator moves it to a different computer, or maybe because the site was moved to a different web host. This requires the domain name being removed from the old DNS server and added to the new DNS server as well as informing the registrar's database about the change. In addition, every ISP has to update their DNS server to know what the new IP for that site is. But in contrast to phone books that get updated only once a year, DNS servers are being updated from every few hours (major ISPs update their DNS servers constantly) up to every week or two (usually only small ISPs are that slow). In the short time period it takes to update DNS servers around the world, it can happen that your ISP still directs you to the old web server. If you know the new IP address for the site, you can beat the system by typing in the IP in your browser instead of the domain name. This will save your ISP the trouble of looking it up, it will assume that you want to go to that computer and take you there directly, bypassing the DNS server lookup procedure. Stale Information Some ISPs are trying to limit the amount of work they have to do in order to relieve the load on their systems and work more efficiently. For that reason, they cache DNS information. This means that they keep information that is requested frequently in a temporary storage location that is easier and faster to access than looking up the same information over and over again. This means that when you request to go to www.yahoo.com, the ISP might look in the cache first, see that somebody else requested earlier to go to www.yahoo.com and that they already looked up that IP address, so they will just give you the IP address that they have stored in their cache instead of looking it up again, assuming that the information is still the same. This works most of the time and can be more efficient, but if the IP address has changed, you of course have a problem since you will be directed to the wrong web server. Your ISP will empty the cache on a regular basis and eventually look up the information again so that you then get directed to the correct web server. Another thing that can happen is that an ISP keeps a file called HOSTS on your computer. In this small text file they will store a list of domain names for sites you go to frequently with the corresponding IP addresses. When you type in the web site address, the browser actually checks first if such a HOSTS file exists before it talks to your ISP's domain name server. If it finds the information it needs in there, it will take the IP address from this file and use it to go to the site. This eliminates again the need to check with the ISP's DNS server first and shaves off valuable milliseconds of your browsing time. Again, this works most of the time and can be more efficient, but if the IP address for the site has changed, you of course have a problem since you will be directed to the wrong web server. The only way to remedy this problem is by editing the HOSTS file and replacing the old IP with the new one, or removing the entry for that site completely, or by renaming or removing the HOSTS file so that the browser now is forced to inquire with the DNS server to find out the correct IP address. Some of these explanations here are simplified for the purpose of keeping this article to a manageable size. The purpose of this article is to make you a little more familiar with IP addresses, what they're good for and what goes on behind the scenes. If you are interested in knowing a lot more about IP addresses, check out 3com's excellent article on the topic at http://www.3com.com/nsc/501302.html http://www.PCNineOneOne.com