LAN IP Addresses
Ranges
Internet IP addresses (apart from the experimental
ones) run from 1.0.0.0 to 223.255.255.255 with a few
holes for special reasons. Whilst it is nice to have
Internet access on a LAN, there are usually a few devices
that do not need to see the Internet - printer servers
and so on - so it would no only be wasteful if everything
that was on your LAN has its own Internet IP address, it
would also be an immense security risk.
Supposing you had 12 IP addresses - a few servers that
were only for LAN use, a few network printers and so on
amongst a population of computers. If you had Internet
addressable IP addresses for each when only a few of the
computers actually needed to venture onto the Internet,
then people from anywhere on the planet would be able to
interrogate your network server or your printer and so
on. It would also use up the available IP addresses very
quickly. With this in mind, this is where local
addressing for LANs comes into its own.
If your gateway knows that a certain range of
addresses are never going to be found on a particular
connection it can then keep that traffic away from that
connection. In this way, a local addressing scheme is
used so that machines that can function perfectly well
without any interaction from the Internet can do so.
For a class 'A' LAN, you can start your network with
10 in the first octet (eight bits) of the address and the
gateway will not pass connections to these machines out
onto the Internet (ie 10.x.x.x). For a class 'B' LAN, use
the range 172.16.x.x to 172.31.x.x and for a class C
network, use addresses in the range 192.168.x.x. This is
why LAN cards for domestic use say use the IP address
192.168.0.1 or 192.168.1.1 for the machine (usully
because the person installing it is doing it for the
first time so there won't be any other addresses on the
network at that point and when there is, they will have
figured out enough of what is meant by then to experiment
a bit and get it right).
There is nothing (usually) to stop you from using
class B addresses on your LAN if you really want to.
Subnet Masks
You will notice that the IP addresses for class B and
C LANs both change in the third octet but the subnet
masks are not the same. For a class B network the subnet
mask is 255.255.0.0 and a class C is 255.255.255.0. This
means that on the face of it, you can have a network
range of, say for a given network, 172.21.0.0 to
172.21.255.255 for a class B and 192.168.15.0 to
192.168.15.255 for a class C. You can see that for a
given LAN, you have 256 times more addresses to play with
on the class B network.
Of course, you don't get all 256 addresses to play
with as 0 (as in 172.21.0.0 or 192.168.15.0 in the above
examples) is the network address and is used in a
particular way by the system and, there is also the
broadcast address which normally has all of the network
address, non-subnet mask bits set to 1 so for a class C,
that is 255 and for a class B, that is 255.255 (as in
172.21.255.255 or 192.168.15.255 in the above examples).
To get the network address, you need to take the IP
address and AND it with the subnet mask. Thus the example
of 192.168.15.26 ANDed with the subnet mask of
255.255.255.0 will give 192.168.15.0 as the network
address. If the gateway ANDs the IP address with the
Subnet mask and gets your internal LAN network address,
it will not pass the traffic out onto the Internet or
into the next network.
It is also useful in some instances, such as where you
have a busy internal network, to have such a gateway or
packet filter (first generation firewall) next to the
firewall so that the firewall does not have to bother
investigating internal traffic and can concentrate on
looking at the traffic you bought it for.
Looking at it all graphically
To make all of this clearer, lets look at it
graphically...
| Finding the network address
using a subnet mask (24 bit) |
| |
|
|
| Typical host
address |
192 |
 |
168 |
 |
1 |
 |
15 |
| AND |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| Subnet Mask |
255 |
 |
255 |
 |
255 |
 |
0 |
| Gives... |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| Network Address |
192 |
 |
168 |
 |
1 |
 |
0 |
| |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| |
|
A host address such as this is
sometimes written as 192.168.1.15/24
You don't have to use a whole octet of 0s for your
subnet mask. You could have 255.255.255.240 which would
give you a network with 13 hosts and a gateway like
this...
| A 28 bit subnet mask |
| |
|
|
| Typical host
address |
192 |
 |
168 |
 |
123 |
 |
150 |
| AND |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| Subnet Mask |
255 |
 |
255 |
 |
255 |
 |
240 |
| Gives... |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| Network Address |
192 |
 |
168 |
 |
123 |
 |
144 |
| |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| |
|
This host address could be as
192.168.123.150/28
You can make this interesting because, you might find
that you do not have to have the end of the subnet mask
as a contiguous block of zeros. If you still need around
a dozen (or 13) machines and the network needs a network
address, a broadcast address and a gateway address (ie 16
addresses in all which, being binary, can be represented
by 4 bits) you might find that it doesn't matter if they
are contiguous. If there are 4 bit-sized holes in the
subnet mask, you can have your 16 addresses as long as
the first section of the address remains intact.
Supposing your subnet mask was 255.255.255.149...
| A 28 bit non-contiguous subnet
mask |
| |
|
|
| Typical host
address |
192 |
 |
168 |
 |
15 |
 |
115 |
| AND |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| Subnet Mask |
255 |
 |
255 |
 |
255 |
 |
149 |
| Gives... |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| Network Address |
192 |
 |
168 |
 |
15 |
 |
17 |
| With |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| Broadcast Address |
192 |
 |
168 |
 |
15 |
 |
123 |
| |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| |
|
So, the valid numbers in the last octet
for this hypothetical network are:
Forget about using the slash notation
with this as it becomes nonsensical.
Note that where a subnet mask bit is set, the network
address bit stays the same in the host address.
If you are going to have a go at setting up a small
network like this, make sure that you have plenty of time
to get it working again should there turn out to be a
problem with it for some reason.
Also, note that DHCP servers like to have contiguous
IP address blocks to assign numbers to so you might find
that it does not work with your DHCP server. It could be
that your DHCP server uses the subnet mask to check for
valid suggestions but it might well not. Remember, you
will never know unless you have a go.
|