Saturday, 20 February 2010

How to: Understand IP addresses (re-post)

Original Article: 03/04/2008
You've got Ubuntu; you've got broadband and a router; you've got at least one PC on-line. Congratulations. Now change whatever Ubuntu set up for you and hey -  you're now a network administrator! On top of that surprise, you need to know some things about networks and addresses, otherwise getting and staying on-line becomes a hit-and-miss affair. Put a machine on any network using TCP/IP and it will need an IP address, otherwise it can't send or receive network traffic.
There goes the first alert – too many acronyms...
Better than the Pony Express
TCP/IP stands for Transmission Control Protocol/Internet Protocol. A protocol is a set of common rules by which something is done. Back in the days of early telegraphy, there were dozens of telegraph protocols, which was fine for private messaging, but useless for commercial and international purposes. Eventually, Morse Code was adopted as a standard. Then the telegraph companies wrapped some further rules around the basic code, like the to-from, start-stop conventions. Think of the internet is an evolution of telegraphy, where every packet of data sent is a next-generation telegram. It's all made possible with the use of TCP/IP.
When you type a location name into your browser, say www.fullcirclemagzine.org, the request is out through to a domain name server (DNS) which looks up the name and provides the IP address 208.113.173.217 of the server that it's on. All your browser requests operate on IP addresses in the background.

Ipso facto
Every machine on the the Internet has a unique number assigned to it, called an IP address, like a telephone number. IP addresses conform to a set of basic rules:
  • consisting of four numbers separated by periods (a formation called a dotted-quad!);
  • each number having a possible range of 0 through 255 (which gives us a maximum of 4,294,967,296 possible IP addresses);
  • some of the values are reserved for special purposes.
An example of an IP address is: 192.168.0.1, which is probably the address your home router uses. See, I'm psychic. Stick with it, I'll tell you how it's done...

Special Reserve
Certain address ranges are reserved for special purposes:
  • 0.0.0.0 refers to the default network
  • 255.255.255.255 is called the broadcast address.
These addresses are used for routing, we'll leave them.
  • the range 127.0.0.1 through 172.255.255.255, is reserved for loopback addresses referring to your machine. If you enter http://127.0.0.1 into a browser, unless you have a web-server running, you will get a connection error because you are actually trying to connect to your own computer.
IP addresses must be unique for each computer connected to a network, otherwise you get an 'IP conflict' wherein one or both machines will be unable to communicate with the rest of the network.

Attention, Class
IP addresses can further be broken down into classes, each class having a valid range of addresses:
Class    Start address     Finish address
  A    0.0.0.0            126.255.255.255
  B    128.0.0.0        191.255.255.255
  C    192.0.0.0        223.255.255.255
  D    224.0.0.0        239.255.255.255
  E    240.0.0.0        255.255.255.255

The class addresses aren't continuous - note the gap in the range at 127.0.0.0-127.255.255.255 where the reserved loopback addresses live.
Class addresses are allocated to companies and organizations based on the quantity of IP addresses that they need to run networks and websites.
  • Class A: The 126-range provides for 16,777,214 possible IP addresses, generally given to very large networks users such as multi-national companies.
  • Class B: Provides for 16,384 individual networks, each allocation consisting of 65,534 possible IP addresses. These blocks are generally allocated to Internet Service Providers and large networks, such as colleges, government departments and the like.
  • Class C: Provides for 2,097,152 networks, each consisting of 255 individual IP addresses and typically allocated to small or medium-size companies.
  • Class D: Really another reserved range for a service called Multicast.
  • Class E: Think of 'e' for 'experimental' are they are used for research and development.
Home on the Range
Finally, this applies to us!

Some ranges of IP addresses reserved for internal private use on company and home networks, machines that communicate through TCP/IP but should not be visible on the public Internet. These IP addresses are not intended to be routed through the Internet and Internet Service Providers mostly block any attempt.

Class     Start Address     End Address
  A     10.0.0.0         10.255.255.255
  B    172.16.0.0         172.31.255.255
  C    192.168.0.0         192.168.255.255

If you are on a home or office private network, only your firewall/router should be visible to the Internet using a public IP address. Usually your service provider allocates one IP address to your internet connection using DCHP (see below) which generally lasts as long as you are connected. Everything else on the network sits behind this and should be assigned IP addresses from the private range.

Are You Static or Dynamic?
You have two options when setting up your home network:
  • Static addressing: this way is down to you to manually choose and assign IP addresses for each device on your network.
  • Dynamic addressing: this uses a service called DHCP (Dynamic Host Configuration Protocol)  built into most routers. This will assign IP addresses automatically, ensuring everything device on your network is unique. You can specify rules as to which address ranges to use, just not individually per device.
Which to use? DCHP is undoubtedly the easy option, as long as you don't need fixed addresses for shared folders or certain network drives. If you want the certainty of a fixed address in order to ensure connections, you may have to specify static addresses.

There is another consideration which applies to certain network devices or virtual machines and that is the addressing mode used to connect to the Internet through a network host. You get to choose Bridged networking - in which case each machine gets to connect under its own address - or NAT, which is Network Address Translation. Here, the network device connects under the same address as its host - its own internal address gets translated. Which also means certain traffic it wants can't see it. You need to understand which you're using if you want webservers or virtual machines to connect to the internet through your network host.

Return to Sender
So there you have it, the indispensable IP address. Now you can go to System > Administration > Network and look over the settings in Network Manager with a better idea what all those acronyms and number mean.

And the psychic side-show with the router address? 192.168.0.1 is generally the factory default setting for home routers, as the first convenient address in the private address class!

Oops!
Among the  most common problems with IP addressing are:
Duplicates: accidentally assigning two machines on the network the same IP address. You should get an 'IP Conflict' warning; you will certainly get strange behaviour across the network.
  • Solution 1: if you are manually addressing machines on the network, keep a note of the addresses you use and avoid duplicates!
  • Solution 2: switch to DCHP so you don't have to worry about it. Bear in mind the dynamic part of DCHP; an IP address may not remain constant even within one session.
Network Drives and servers not visible: when you try to connect to Shared Folders, network drives, perhaps a virtual machine in VMware or Virtualbox.
  • Solution 1: check your addressing for constant IP addresses from session to session and if its changing, revert to static addressing.
  • Solution 2: perhaps the IP address isn't the problem. Have you updated your firewall rules to allow all your devices to talk to each other?

1 comment:

  1. It nice information...I got the ip address here http://www.ip-details.com/ It provides ip address,ip search,domain host search,get ip details....

    ReplyDelete

At least try to be nice, it won't kill you...