You are on page 1of 9

IP Address Subnetting Tutorial

This talk will cover the basics of IP addressing and subnetting.


Topics covered will include:
What is an IP Address?
What are Classes?
What is a Network Address?
What are ubnet !asks and ubnet Addresses?
"ow are ubnet !asks defined and used?
"ow can all this be applied?
What is CI#$?
"ow can I get %ore infor%ation?
An IP &Internet Protocol' address is a uni(ue identifier for a node or host connection on
an IP network. An IP address is a )* bit binar+ nu%ber usuall+ represented as , deci%al
values- each representing . bits- in the range / to *00 &known as octets' separated b+
deci%al points. This is known as 1dotted deci%al1 notation.
23a%ple: 4,/.456.**/.*//
It is so%eti%es useful to view the values in their binar+ for%.
140 .179 .220 .200
10001100.10110011.11011100.11001000
2ver+ IP address consists of two parts- one identif+ing the network and one identif+ing
the node. The Class of the address and the subnet %ask deter%ine which part belongs to
the network address and which part belongs to the node address.
Address Classes
There are 0 different address classes. 7ou can deter%ine which class an+ IP address is in
b+ e3a%ining the first , bits of the IP address.
Class A addresses begin with 0xxx- or 1 to 126 deci%al.
Class B addresses begin with 10xx- or 128 to 191 deci%al.
Class C addresses begin with 110x- or 192 to 223 deci%al.
Class D addresses begin with 1110- or 224 to 239 deci%al.
Class addresses begin with 1111- or 240 to 2!4 deci%al.
Addresses beginning with 01111111- or 12" deci%al- are reserved for loopback and for
internal testing on a local %achine. 87ou can test this: +ou should alwa+s be able to ping
12"#0#0#1- which points to +ourself9 Class # addresses are reserved for %ulticasting.
Class 2 addresses are reserved for future use. The+ should not be used for host addresses.
Now we can see how the Class deter%ines- b+ default- which part of the IP address
belongs to the network &N' and which part belongs to the node &n'.
Class A :: NNNNNNNN.nnnnnnnn.nnnnnnn.nnnnnnn
Class ; :: NNNNNNNN.NNNNNNNN.nnnnnnnn.nnnnnnnn
Class C :: NNNNNNNN.NNNNNNNN.NNNNNNNN.nnnnnnnn
In the e3a%ple- 4,/.456.**/.*// is a Class ; address so b+ default the Network part of
the address &also known as the Network Address' is defined b+ the first two octets
&4,/.456.3.3' and the node part is defined b+ the last * octets &3.3.**/.*//'.
In order to specif+ the network address for a given IP address- the node section is set to
all 1/1s. In our e3a%ple- 4,/.456././ specifies the network address for 4,/.456.**/.*//.
When the node section is set to all 141s- it specifies a broadcast that is sent to all hosts on
the network. 4,/.456.*00.*00 specifies the e3a%ple broadcast address. Note that this is
true regardless of the length of the node section.
Pri$ate Subnets
There are three IP network addresses reserved for private networks. The addresses are
10#0#0#0%8- 1"2#16#0#0%12- and 192#168#0#0%16. The+ can be used b+ an+one setting up
internal IP networks- such as a lab or ho%e <AN behind a NAT or pro3+ server or a
router. It is alwa+s safe to use these because routers on the Internet will never forward
packets co%ing fro% these addresses. These addresses are defined in $=C 464..
ubnetting an IP Network can be done for a variet+ of reasons- including organi>ation-
use of different ph+sical %edia &such as 2thernet- =##I- WAN- etc.'- preservation of
address space- and securit+. The %ost co%%on reason is to control network traffic. In an
2thernet network- all nodes on a seg%ent see all the packets trans%itted b+ all the other
nodes on that seg%ent. Perfor%ance can be adversel+ affected under heav+ traffic loads-
due to collisions and the resulting retrans%issions. A router is used to connect IP
networks to %ini%i>e the a%ount of traffic each seg%ent %ust receive.
Subnet &as'ing
Appl+ing a subnet %ask to an IP address allows +ou to identif+ the network and node
parts of the address. Perfor%ing a bitwise logical AN# operation between the IP address
and the subnet %ask results in the Network Address or Nu%ber.
=or e3a%ple- using our test IP address and the default Class ; subnet %ask- we get:
10001100.10110011.11110000.11001000 140.179.240.200 Class B IP
Address
11111111.11111111.00000000.00000000 255.255.000.000 Default
Class B Subnet Mask
--------------------------------------------------------
10001100.10110011.00000000.00000000 140.179.000.000 Net!rk
Address
#efault subnet %asks:
Class A : *00./././ : 44444444.////////.////////.////////
Class B : *00.*00././ : 44444444.44444444.////////.////////
Class C : *00.*00.*00./ : 44444444.44444444.44444444.////////
Additional bits can be added to the default subnet %ask for a given Class to further
subnet- or break down- a network. When a bitwise logical AN# operation is perfor%ed
between the subnet %ask and IP address- the result defines the Subnet Address. There are
so%e restrictions on the subnet address. Node addresses of all 1/1s and all 141s are
reserved for specif+ing the local network &when a host does not know it?s network
address' and all hosts on the network &broadcast address'- respectivel+. This also applies
to subnets. A subnet address cannot be all 1/1s or all 141s. This also i%plies that a 4 bit
subnet %ask is not allowed. This restriction is re(uired because older standards enforced
this restriction. $ecent standards that allow use of these subnets have superceded these
standards- but %an+ 1legac+1 devices do not support the newer standards. If +ou are
operating in a controlled environ%ent- such as a lab- +ou can safel+ use these restricted
subnets.
To calculate the nu%ber of subnets or nodes- use the for%ula &*@n : *' where n A nu%ber
of bits in either field. !ultipl+ing the nu%ber of subnets b+ the nu%ber of nodes
available per subnet gives +ou the total nu%ber of nodes available for +our class and
subnet %ask. Also- note that although subnet %asks with non:contiguous %ask bits are
allowed the+ are not reco%%ended.
23a%ple:
10001100.10110011.11011100.11001000 140.179.220.200 IP Address
11111111.11111111.11100000.00000000 255.255.224.000 Subnet Mask
--------------------------------------------------------
10001100.10110011.11000000.00000000 140.179.192.000 Subnet
Address
10001100.10110011.11011111.11111111 140.179.22".255 Br!ad#ast
Address
In this e3a%ple a ) bit subnet %ask was used. There are B subnets available with this si>e
%ask &re%e%ber that subnets with all /?s and all 4?s are not allowed'. 2ach subnet has
.46/ nodes. 2ach subnet can have nodes assigned to an+ address between the ubnet
address and the ;roadcast address. This gives a total of ,6-4,/ nodes for the entire class
; address subnetted this wa+. Notice that this is less than the B0-0), nodes an
unsubnetted class ; address would have.
ubnetting alwa+s reduces the nu%ber of possible nodes for a given network. There are
co%plete subnet tables available here for Class A- Class ; and Class C. These tables list
all the possible subnet %asks for each class- along with calculations of the nu%ber of
networks- nodes and total hosts for each subnet.
"ere is another- %ore detailed- e3a%ple. a+ +ou are assigned a Class C network nu%ber
of *//.4)).450./ &apologies to an+one who %a+ actuall+ own this do%ain address'. 7ou
want to utili>e this network across %ultiple s%all groups within an organi>ation. 7ou can
do this b+ subnetting that network with a subnet address.
We will break this network into 4, subnets of 4, nodes each. This will li%it us to 46B
nodes on the network instead of the *0, we would have without subnetting- but gives us
the advantages of traffic isolation and securit+. To acco%plish this- we need to use a
subnet %ask , bits long.
$ecall that the default Class C subnet %ask is
255.255.255.0 $11111111.11111111.11111111.00000000 b%nar&'
23tending this b+ , bits +ields a %ask of
255.255.255.240 $11111111.11111111.11111111.11110000 b%nar&'
This gives us 4B possible network nu%bers- * of which cannot be used:
Subnet bits (et)or' (u*ber (ode Addresses Broad+ast Address
//// *//.4)).450./ $eserved None
///4 *//.4)).450.4B .45 thru .)/ *//.4)).450.)4
//4/ *//.4)).450.)* .)) thru .,B *//.4)).450.,5
//44 *//.4)).450.,. .,6 thru .B* *//.4)).450.B)
/4// *//.4)).450.B, .B0 thru .5. *//.4)).450.56
/4/4 *//.4)).450../ ..4 thru .6, *//.4)).450.60
/44/ *//.4)).450.6B .65 thru .44/ *//.4)).450.444
/444 *//.4)).450.44* .44) thru .4*B *//.4)).450.4*5
4/// *//.4)).450.4*. .4*6 thru .4,* *//.4)).450.4,)
4//4 *//.4)).450.4,, .4,0 thru .40. *//.4)).450.406
4/4/ *//.4)).450.4B/ .4B4 thru .45, *//.4)).450.450
4/44 *//.4)).450.45B .455 thru .46/ *//.4)).450.464
44// *//.4)).450.46* .46) thru .*/B *//.4)).450.*/5
44/4 *//.4)).450.*/. .*/6 thru .*** *//.4)).450.**)
444/ *//.4)).450.**, .**0 thru .*). *//.4)).450.*)6
4444 *//.4)).450.*,/ $eserved None
Now that +ou understand 1classful1 IP ubnetting principals- +ou can forget the% C'. The
reason is CID, :: Classless InterDo%ain ,outing. CI#$ was invented several +ears ago
to keep the internet fro% running out of IP addresses. The 1classful1 s+ste% of allocating
IP addresses can be ver+ wastefulC an+one who could reasonabl+ show a need for %ore
that *0, host addresses was given a Class ; address block of B00)) host addresses. 2ven
%ore wasteful were co%panies and organi>ations that were allocated Class A address
blocks- which contain over 4B !illion host addressesD Enl+ a tin+ percentage of the
allocated Class A and Class ; address space has ever been actuall+ assigned to a host
co%puter on the Internet.
People reali>ed that addresses could be conserved if the class s+ste% was eli%inated. ;+
accuratel+ allocating onl+ the a%ount of address space that was actuall+ needed- the
address space crisis could be avoided for %an+ +ears. This was first proposed in 466* as
a sche%e called Su-ernetting. Fnder supernetting- the classful subnet %asks are
e3tended so that a network address and subnet %ask could- for e3a%ple- specif+ %ultiple
Class C subnets with one address. =or e3a%ple- If I needed about 4/// addresses- I could
supernet , Class C networks together:
192.(0.12).0 $11000000.00111100.10000000.00000000' Class C subnet
address
192.(0.129.0 $11000000.00111100.10000001.00000000' Class C subnet
address
192.(0.1"0.0 $11000000.00111100.10000010.00000000' Class C subnet
address
192.(0.1"1.0 $11000000.00111100.10000011.00000000' Class C subnet
address
--------------------------------------------------------
192.(0.12).0 $11000000.00111100.10000000.00000000' Su*ernetted
Subnet address
255.255.252.0 $11111111.11111111.11111100.00000000' Subnet Mask
192.(0.1"1.255 $11000000.00111100.10000011.11111111' Br!ad#ast address
In this e3a%ple- the subnet 46*.B/.4*../ includes all the addresses fro% 46*.B/.4*../ to
46*.B/.4)4.*00. As +ou can see in the binar+ representation of the subnet %ask- the
Network portion of the address is ** bits long- and the host portion is 4/ bits long.
Fnder CI#$- the subnet %ask notation is reduced to a si%plified shorthand. Instead of
spelling out the bits of the subnet %ask- it is si%pl+ listed as the nu%ber of 4s bits that
start the %ask. In the above e3a%ple- instead of writing the address and subnet %ask as
192.(0.12).0+ Subnet Mask 255.255.252.0
the network address would be written si%pl+ as:
192.(0.12).0,22
which indicates starting address of the network- and nu%ber of 4s bits &**' in the network
portion of the address. If +ou look at the subnet %ask in binar+
&44444444.44444444.444444//.////////'- +ou can easil+ see how this notation works.
The use of a CI#$ notated address is the sa%e as for a Classful address. Classful
addresses can easil+ be written in CI#$ notation &Class A A G.- Class ; A G4B- and Class
C A G*,'
It is currentl+ al%ost i%possible for an individual or co%pan+ to be allocated their own
IP address blocks. 7ou will si%pl+ be told to get the% fro% +our IP. The reason for this
is the ever:growing si>e of the internet routing table. Hust 0 +ears ago- there were less
than 0/// network routes in the entire Internet. Toda+- there are over 6/-///. Fsing
CI#$- the biggest IPs are allocated large chunks of address space &usuall+ with a subnet
%ask of G46 or even s%aller'C the IP?s custo%ers &often other- s%aller IPs' are then
allocated networks fro% the big IP?s pool. That wa+- all the big IP?s custo%ers &and
their custo%ers- and so on' are accessible via 4 network route on the Internet. ;ut I
digress.
It is e3pected that CI#$ will keep the Internet happil+ in IP addresses for the ne3t few
+ears at least. After that- IPvB- with 4*. bit addresses- will be needed. Fnder IPvB- even
slopp+ address allocation would co%fortabl+ allow a billion uni(ue IP addresses for
ever+ person on earthD The co%plete and gor+ details of CI#$ are docu%ented in
$=C4046- which was released in epte%ber of 466).
. bits Subnet &as' CID,
* *00.46*././ G4/
) *00.**,././ G44
, *00.*,/././ G4*
0 *00.*,.././ G4)
B *00.*0*././ G4,
5 *00.*0,././ G40
. *00.*00././ G4B
6 *00.*00.4*../ G45
4/ *00.*00.46*./ G4.
44 *00.*00.**,./ G46
4* *00.*00.*,/./ G*/
4) *00.*00.*,../ G*4
4, *00.*00.*0*./ G**
40 *00.*00.*0,./ G*)
4B *00.*00.*00./ G*,
45 *00.*00.*00.4*. G*0
4. *00.*00.*00.46* G*B
46 *00.*00.*00.**, G*5
*/ *00.*00.*00.*,/ G*.
*4 *00.*00.*00.*,. G*6
** *00.*00.*00.*0* G)/
. bits Subnet &as' CID, . Subnets . /osts
(ets 0
/osts
* *00.*00.46*./ G4. * 4B).* )*5B,
) *00.*00.**,./ G46 B .46/ ,64,/
, *00.*00.*,/./ G*/ 4, ,/6, 05)4B
0 *00.*00.*,../ G*4 )/ */,B B4)./
B *00.*00.*0*./ G** B* 4/** B))B,
5 *00.*00.*0,./ G*) 4*B 04/ B,*B/
. *00.*00.*00./ G*, *0, *0, B,04B
6 *00.*00.*00.4*. G*0 04/ 4*B B,*B/
4/ *00.*00.*00.46* G*B 4/** B* B))B,
44 *00.*00.*00.**, G*5 */,B )/ B4)./
4* *00.*00.*00.*,/ G*. ,/6, 4, 05)4B
4) *00.*00.*00.*,. G*6 .46/ B ,64,/
4, *00.*00.*00.*0* G)/ 4B).* * )*5B,
. bits Subnet &as' CID, . Subnets . /osts
(ets 0
/osts
* *00.*00.*00.46* G*B * B* 4*,
) *00.*00.*00.**, G*5 B )/ 4./
, *00.*00.*00.*,/ G*. 4, 4, 46B
0 *00.*00.*00.*,. G*6 )/ B 4./
B *00.*00.*00.*0* G)/ B* * 4*,
This page will provide a brief review and e3planation of the co%%on logical bitwise
operations AN#- E$- IE$ and NET. <ogical operations are perfor%ed between two
data bits &e3cept for NET'. ;its can be either 141 or 1/1- and these operations are
essential to perfor%ing digital %ath operations.
In the 1truth tables1 below- the input bits are in bold- and the results are plain.
A(D
The logical AN# operation co%pares * bits and if the+ are both 141- then the result is 141-
otherwise- the result is 1/1.
0 1
0 / /
1 / 4
1,
The logical E$ operation co%pares * bits and if either or both bits are 141- then the result
is 141- otherwise- the result is 1/1.
0 1
0 / 4
1 4 4
21,
The logical IE$ &23clusive E$' operation co%pares * bits and if e3actl+ one of the% is
141 &i.e.- if the+ are different values'- then the result is 141C otherwise &if the bits are the
sa%e'- the result is 1/1.
0 1
0 / 4
1 4 /
(1T
The logical NET operation si%pl+ changes the value of a single bit. If it is a 141- the
result is 1/1C if it is a 1/1- the result is 141. Note that this operation is different in that
instead of co%paring two bits- it is acting on a single bit.
0 1
4 /
$e(uests for Co%%ents &$=Cs':
Everall $=C Inde3
$=C 464. : Address Allocation for Private Internets
$=C 4*46 : En the Assign%ent of ubnet Nu%bers
$=C 60/ : Internet standard subnetting procedure
$=C 6,/ : Toward an Internet standard sche%e for subnetting
$=C 6)* : ubnetwork addressing sche%e
$=C 645 : Internet subnets
Newsgroups of interest:
co%p.protocols.tcpip
co%p.protocols.tcpip.do%ains
Ether tuff:
Protocols.co%
Internic
Jen and the Art of the Internet
Klossar+ of Internet Ter%s
http:GGwww.ralphb.netGIPubnetGinde3.ht%l

You might also like