Tuesday, July 8, 2008

IP addresses and subnet masking

An IP address is actually a 32 bit binary number, consisting of 4 x 8bit octets.
The IP address indicates both the subnet to which a host belongs, and the host address within that subnet.
The subnet mask (or netmask) indicates the distinction between the host part and the network part of the address.
The netmask is also a 32 bit binary number. It lines up with the 32bit address and indicates the network part with 1’s and the host part with 0’s
The mask can also be written as a decimal number using 4 x 8it octets. For e.g. a mask of indicates that the host is in a class [C] network. Thus:
11111111 = 255 (1 host), 11111100 = 252 (4 IPs), 11111000 = 248 (8 IPs), 11110000 = 240 (16 IPs), 11100000 = 224 (32 IPs), 11000000 = 192 (64 IPs), 100000000 = 128 (128 IPs) and 00000000 = 0 (255 IPs).
In every IP subnet there one IP is reserved for the network address and one IP is reserved for the broadcast address (all IPs in that subnet). Thus, the number of possible hosts in a subnet is equal the number IPs less 2.
The description of a network lies completely in the IP configuration (address and mask) of the individual hosts. A host will believe itself to be in a particular network based completely on its own address and subnet mask, irrespective of the physical location of the other hosts in that network. Thus, for example, it is possible to have two IP subnets on a single Ethernet network without the one subnet being aware of the other.
Key concepts

Class A: addresses are for large networks with many devices.

Class B: addresses are for medium-sized networks.

Class C: addresses are for small networks (fewer than 256 hosts). Class D: addresses are multicast addresses.

Important commands

ipconfig (Windows NT / Windows 98)

Use ipconfig /all to see the complete IP configuration and the MAC address for any device.

winipcfg (Windows 95)

Use winipcfg to see the complete IP configuration and the MAC address for any device.

ifconfig (UNIX)

Use ifconfig -au to see the complete IP configuration and the MAC address for all devices on the host.

Use ifconfig

netmask to change the IP address of a device in real time.

NOTE: these changes are not permanent.

ping (UNIX and Windows)

Use ping to determine whether a host with a given IP address is active somewhere on the Internet.

Tips and tricks
When dividing a network into subnets, start by dividing in two, then again etc….
To determine how many IP addresses in a given subnet (e.g., subtract the last octet (240) from 256 (e.g. 256-240 = 16). Because two addresses are always used (network and broadcast) subtract another 2 to get the maximum number of hosts (e.g. 16-2 = 14 hosts).
Use Microsoft Calculator (calc.exe) to convert a number from decimal to binary and visa-versa.
See http://www.whatis.com/subnet.htm for a very good description.


Post a Comment


Subscribe in Bloglines Msn bot last visit powered by MyPagerank.Net Yahoo bot last visit powered by MyPagerank.Net
I heart FeedBurner downtime checker The Ubuntu Counter Project - user number # 31290

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Powered by TadPole