What is an IP address?

 

An IP address is simply a 32-bit numeric address by which a computer is known.

It is akin to a phone number.

 

An IP address can theoretically be any numeric address between 0 and 4,294,967,295 (232-1).

 

Nb: The range is actually less than this, as certain addresses are reserved for special use, but we’ll come back to that later

 

To make IP addresses easier to work with, and in particular to break-up the total address pool into manageable chunks, IP addresses are typically represented as four 8-bit numbers (e.g. 192.168.1.1).

 

Hence this would equal 192 x 2563 + 168 x 2562 + 1 x 256 + 1 =  3,232,235,777.

 

Often, it is easier to visualise this conversion if you consider the binary representation of the number:

 

192

 

168

 

1

 

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1

1

0

0

0

0

0

0

 

1

0

1

0

1

0

0

0

 

0

0

0

0

0

0

0

1

 

0

0

0

0

0

0

0

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The decimal equivalent of 11000000101010000000000100000001 is 3,232,235,777.

 

 


What is a subnet mask? What is a default gateway?

 

To properly understand subnet masks and default gateways, it is easiest to consider the two together.

 

Both subnet masks and default gateways are used to determine how data traffic is routed.

 

The default gateway is the default device by which your PC should route traffic to access other networks. Typically for a home PC this will be the IP address of your ADSL router or cable modem. In an office environment it will typically be your company’s private router, or possibly their firewall.

 

The subnet mask is used to determine what traffic needs to be routed via the gateway, and what devices are available on the local network directly.

 

The subnet mask is derived by stating which bits (in binary) of the IP address remain constant for devices on the local network.

 

A typical subnet mask might be 255.255.0.0,
or expressed in binary 11111111  11111111   00000000   00000000

(This is also known as a “16 bit” mask, as the first 16 bits are set to 1)

 

If we overlay this on our IP address shown above

(192.168.1.1 = 11000000  10101000  00000001  00000001 )

This means that any IP addresses starting in 192.168.x.x are regarded as being local, and any others will be routed via the device listed as the default gateway.

 

Similarly if we had a subnet mask of 255.255.255.0 (known as a “24 bit” mask) then any devices starting 192.168.1.x would be regarded as local.

 

The same principle applies for subnet masks which are not multiples of 8 bits in length, albeit these are harder to visualise in their decimal form.

 

For example 255.255.252.0 (a “22 bit” mask) would mean that any IP addresses starting in 11000000  10101000  000000xx  xxxxxxxx would be regarded as local.  In decimal this gives a range from 192.168.0.0 to 192.168.3.255

 

On a more complex network – or for computers such as email servers and proxy servers which span two networks (the Internet, and the private internal network), you may route via more than one device to access different networks. In these scenarios you can no longer rely on simply a default gateway, and need to specify which destinations are accessed via which gateway (or router).

 

In windows, this can be controlled from the command prompt using the “route” command. For example

 

Route add –p 192.168.0.0 mask 255.255.128.0 192.168.1.1

Route add –p 0.0.0.0 mask 0.0.0.0 192.168.1.2

 

In this example the “default route” is routed via 192.168.1.2, and traffic to 192.168.0.0 to 192.168.128.255 is routed via 192.168.1.1.

This would be a typical scenario for a network which has a pair of connections, one to a corporate network and one directly to the Internet (e.g. a corporate email server).

 

Other ways of representing a subnet mask:

A subnet mask is typically denoted in one of two ways, either as a bit count (e.g. a “18 bit mask”) or as a four-octet string (e.g. 255.255.192.0 )

 

Often an IP address and subnet mask are written as a combination. For example 192.168.1.15/24 means an IP address of 192.168.1.15 with a subnet mask of 255.255.255.0.

This is sometimes written as 192.168.1.15/255.255.255.0.

 

192.168.1.* and 192.168.1.x should be avoided as these are ambiguous, particularly if the subnet mask is not a multiple of 8-bit length.

 

What is a default route?

A default route is simply a route for traffic where no more specific route is in place. It is typically the route used to access the Internet.

 

What is a “network address”?

A network address is simply the first address in an address range. It should never be assigned to a specific device and is used for system purposes (for example 192.168.1.0 is the network address for 192.168.1.0/24).

 

What is a broadcast address?

The broadcast address is simply the last address in an address range. It should never be assigned to a specific device and is used for system purposes (for example 192.168.1.255 is the broadcast address for 192.168.1.0/24).

 

What does Class A, Class B, Class C mean?

This is old terminology, which simply means:

            Class A = has an 8-bit subnet mask

            Class B = has a 16-bit subnet mask

            Class C = has a 24-bit subnet mask

 

What IP addresses can I use?

In theory you can use any IP addresses you like. However, if you plan to interact with other networks, such as the Internet or other companies then there are some important conventions to use.

 

For Internet IP addresses you should only use the IP addresses allocated to you by your Internet service provider. (Other addresses are highly unlikely to work anyway).

For private IP addresses (i.e. those you use on your own private network) should be allocated from the ranges defined in RFC1918, these are:

                        10.0.0.0/8                 (i.e. 10.0.0.1 to 10.255.255.254)

                        192.168.0.0/16         (i.e. 192.168.0.1 to 192.168.255.254)

                        172.16.0.0/12           (i.e. 172.16.0.1 to 172.31.255.254)

 

Addresses from 224.0.0.0 upwards are reserved for special use.

 

How should I decide what address range to use?

 

If you are planning a new corporate network there are a couple of key rules to follow when deciding on which address range to use:

-         firstly check with any suppliers or customers who you are likely to implement direct network connections to, and avoid using any address ranges that they currently use, or are likely to use;

-         secondly, don’t make an obvious choice (for example 10.1.1.0/24).  It is highly likely that at some point in the future that you may need to connect to a third party network (either as a result of a merger, take-over, or simply a new customer/supplier). The more obscure your address range, the less likely you are to have a clash with the other company. (e.g. 10.92.50.0/24 is much less likely to be used by someone else than 10.1.1.0/24, and if at all possible avoid 192.168.1.0/24 as this appears to be the most popular private address range in use.)

-         thirdly, keep you IP addresses to a sensible size range (most small/medium companies could easily manage with a 16-bit (“class B”) range. Again, the main reason as it makes any future interaction with third parties easier if you have a clear address range policy.

-         Finally, think about future growth. If your company currently has 20 sites, allocate ranges such as 10.92.0.0/24, 10.92.4.0/24, 10.92.8.0/24, etc. Ensure the third octet is divisible by 4, and leave space between the allocated ranges: - this way if a site ever gets more than 254 devices, you can simply enlarge the subnet to a /23 or /22 bit mask, without allocating all new IP addresses. However, at the same time, if you ever got more than 63 sites you would still have spare ranges to allocate without needing to use a new class B range.

 

A typical simple network diagram: