Вы находитесь на странице: 1из 7

Understanding Understanding

IP addressing & Sub-netting


Lecture 4
th
class
Session 2009/2010
Communication Engineering
Communication Engineering
Dept.
Dept.
Electronics Engineering
Electronics Engineering
College
College
University of Mosul
University of Mosul
IP Addressing
An IP (Internet Protocol) address is a unique identifier for a node or host connection on an IP
network. An IP address is a 32 bit binary number usually represented as 4 decimal alues! each
representin" # bits! in the ran"e $ to 2%% (known as octets) separated by decimal points. &his is
known as 'dotted decimal' notation.
()ample* +4$.+,-.22$.2$$
It is sometimes useful to iew the alues in their binary form.
140 .179 .220 .200
10001100.10110011.11011100.11001000
(ery IP address consists of two parts! one identifyin" the network and one identifyin" the node.
&he .lass of the address and the subnet mask determine which part belon"s to the network
address and which part belon"s to the node address.
Address Classes
&here are % different address classes. /ou can determine which class any IP address is in by
e)aminin" the first 4 bits of the IP address.
Class A addresses be"in with 0xxx! or 1 to 126 decimal.
Class B addresses be"in with 10xx! or 128 to 191 decimal.
Class C addresses be"in with 110x! or 192 to 223 decimal.
Class D addresses be"in with 1110! or 224 to 239 decimal.
Class E addresses be"in with 1111! or 240 to 254 decimal.
Addresses be"innin" with 01111111! or 127 decimal! are resered for loopback and for internal
testin" on a local machine0 1/ou can test this* you should always be able to pin" 127.0.0.1! which
points to yourself2 .lass 3 addresses are resered for multicastin"0 .lass ( addresses are
resered for future use. &hey should not be used for host addresses.
4ow we can see how the .lass determines! by default! which part of the IP address belon"s to
the network (4! in blue) and which part belon"s to the node (n! in red).
.lass A 55 44444444.nnnnnnnn.nnnnnnnn.nnnnnnnn
.lass 6 55 44444444.44444444.nnnnnnnn.nnnnnnnn
.lass . 55 44444444.44444444.44444444.nnnnnnnn
In the e)ample! +4$.+,-.22$.2$$ is a .lass 6 address so by default the 4etwork part of the
address (also known as the Network Address) is defined by the first two octets (+4$.+,-.).)) and
the node part is defined by the last 2 octets ().).22$.2$$).
In order to specify the network address for a "ien IP address! the node section is set to all '$'s.
In our e)ample! +4$.+,-.$.$ specifies the network address for +4$.+,-.22$.2$$. 7hen the node
section is set to all '+'s! it specifies a broadcast that is sent to all hosts on the network.
+4$.+,-.2%%.2%% specifies the e)ample broadcast address. 4ote that this is true re"ardless of the
len"th of the node section.
Priate S!"nets
&here are three IP network addresses resered for priate networks. &he addresses are 10.0.0.0#
S!"net $as% 255.0.0.0! 172.16.0.0# S!"net $as% 255.240.0.0! and 192.168.0.0# S!"net $as%
255.255.0.0. &hese addresses are also notated 10.0.0.0/8! 172.16.0.0/12! and 192.168.0.0/160 this
notation will be e)plained later in this tutorial. &hey can be used by anyone settin" up internal IP
networks! such as a lab or home 8A4 behind a 4A& or pro)y serer or a router. It is always safe
to use these because routers on the Internet by default will neer forward packets comin" from
these addresses. &hese addresses are defined in 9:. +-+#.
Subnetting
;ubnettin" an IP 4etwork can be done for a ariety of reasons! includin" or"ani<ation! use of
different physical media (such as (thernet! :33I! 7A4! etc.)! preseration of address space! and
security. &he most common reason is to control network traffic. In an (thernet network! all nodes
on a se"ment see all the packets transmitted by all the other nodes on that se"ment. Performance
can be adersely affected under heay traffic loads! due to collisions and the resultin"
retransmissions. A router is used to connect IP networks to minimi<e the amount of traffic each
se"ment must receie.
S!"net $as%in&
Applyin" a subnet mask to an IP address allows you to identify the network and node parts of the
address. &he network bits are represented by the +s in the mask! and the node bits are represented
by the $s. Performin" a bitwise lo"ical A43 operation between the IP address and the subnet
mask results in the Network Address or 4umber.
:or e)ample! usin" our test IP address and the default .lass 6 subnet mask! we "et*
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
3efault subnet masks*
Class A 5 2%%.$.$.$ 5 ++++++++.$$$$$$$$.$$$$$$$$.$$$$$$$$
Class B 5 2%%.2%%.$.$ 5 ++++++++.++++++++.$$$$$$$$.$$$$$$$$
Class C 5 2%%.2%%.2%%.$ 5 ++++++++.++++++++.++++++++.$$$$$$$$
More Restrictive Subnet Masks
Additional bits can be added to the default subnet mask for a "ien .lass to further subnet! or
break down! a network. 7hen a bitwise lo"ical A43 operation is performed between the subnet
mask and IP address! the result defines the Subnet Address (also called the Network Address or
Network Number). &here are some restrictions on the subnet address. 4ode addresses of all '$'s
and all '+'s are resered for specifyin" the local network (when a host does not know its network
address) and all hosts on the network (broadcast address)! respectiely. &his also applies to
subnets. A subnet address cannot be all '$'s or all '+'s. &his also implies that a + bit subnet mask
is not allowed. &his restriction is required because older standards enforced this restriction.
9ecent standards that allow use of these subnets hae superseded these standards! but many
'le"acy' deices do not support the newer standards. If you are operatin" in a controlled
enironment! such as a lab! you can safely use these restricted subnets.
&o calculate the number of subnets or nodes! use the formula (2
n
52) where n = number of bits in
either field! and 2
n
represents 2 raised to the nth power. >ultiplyin" the number of subnets by the
number of nodes aailable per subnet "ies you the total number of nodes aailable for your
class and subnet mask. Also! note that althou"h subnet masks with non5conti"uous mask bits are
allowed! they are not recommended.
()ample*
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 e)ample a 3 "it s!"net 'as% was used. &here are ? (2
3
52) subnets aailable with this si<e
mask (remember that subnets with all $@s and all +@s are not allowed). (ach subnet has #+-$ (2
+3
5
2) nodes. (ach subnet can hae nodes assi"ned to any address between the ;ubnet address and
the 6roadcast address. &his "ies a total of 4-!+4$ nodes for the entire class 6 address subnetted
this way. 4otice that this is less than the ?%!%34 nodes an unsubnetted class 6 address would
hae.
/ou can calculate the ;ubnet Address by performin" a bitwise lo"ical A43 operation between
the IP address and the subnet mask! then settin" all the host bits to 0s. ;imilarly! you can
calculate the Broadcast Address for a subnet by performin" the same lo"ical A43 between the
IP address and the subnet mask! then settin" all the host bits to 1s. &hat is how these numbers are
deried in the e)ample aboe.
;ubnettin" always reduces the number of possible nodes for a "ien network. &here are complete
subnet tables aailable here for .lass A! .lass 6 and .lass .. &hese tables list all the possible
subnet masks for each class! alon" with calculations of the number of networks! nodes and total
hosts for each subnet.
An Example
Aere is another! more detailed! e)ample. ;ay you are assi"ned a .lass . network number of
2$$.+33.+,%.$ (apolo"ies to anyone who may actually own this domain address). /ou want to
utili<e this network across multiple small "roups within an or"ani<ation. /ou can do this by
subnettin" that network with a subnet address.
7e will break this network into +4 subnets of +4 nodes each. &his will limit us to +-? nodes on
the network instead of the 2%4 we would hae without subnettin"! but "ies us the adanta"es of
traffic isolation and security. &o accomplish this! we need to use a subnet mask 4 bits lon".
9ecall that the default .lass . subnet mask is
255.255.255.0 $11111111.11111111.11111111.00000000 b%nar&'
()tendin" this by 4 bits yields a mask of
255.255.255.240 $11111111.11111111.11111111.11110000 b%nar&'
&his "ies us +? possible network numbers! 2 of which cannot be used*
S!"net "its (et)or% (!'"er (ode Addresses Broad*ast Address
$$$$ 2$$.+33.+,%.$ 9esered 4one
$$$+ 2$$.+33.+,%.+? .+, thru .3$ 2$$.+33.+,%.3+
$$+$ 2$$.+33.+,%.32 .33 thru .4? 2$$.+33.+,%.4,
$$++ 2$$.+33.+,%.4# .4- thru .?2 2$$.+33.+,%.?3
$+$$ 2$$.+33.+,%.?4 .?% thru .,# 2$$.+33.+,%.,-
$+$+ 2$$.+33.+,%.#$ .#+ thru .-4 2$$.+33.+,%.-%
$++$ 2$$.+33.+,%.-? .-, thru .++$ 2$$.+33.+,%.+++
$+++ 2$$.+33.+,%.++2 .++3 thru .+2? 2$$.+33.+,%.+2,
+$$$ 2$$.+33.+,%.+2# .+2- thru .+42 2$$.+33.+,%.+43
+$$+ 2$$.+33.+,%.+44 .+4% thru .+%# 2$$.+33.+,%.+%-
+$+$ 2$$.+33.+,%.+?$ .+?+ thru .+,4 2$$.+33.+,%.+,%
+$++ 2$$.+33.+,%.+,? .+,, thru .+-$ 2$$.+33.+,%.+-+
++$$ 2$$.+33.+,%.+-2 .+-3 thru .2$? 2$$.+33.+,%.2$,
++$+ 2$$.+33.+,%.2$# .2$- thru .222 2$$.+33.+,%.223
+++$ 2$$.+33.+,%.224 .22% thru .23# 2$$.+33.+,%.23-
++++ 2$$.+33.+,%.24$ 9esered 4one
CIDR -- Classless InterDomain Routing
4ow that you understand 'classful' IP ;ubnettin" principals! you can for"et them 0). &he reason
is C+D, 55 Classless +nterDomain ,outin". .I39 was inented seeral years a"o to keep the
internet from runnin" out of IP addresses. &he 'classful' system of allocatin" IP addresses can be
ery wasteful0 anyone who could reasonably show a need for more that 2%4 host addresses was
"ien a .lass 6 address block of ?%%33 host addresses. (en more wasteful were companies and
or"ani<ations that were allocated .lass A address blocks! which contain oer +? >illion host
addressesB Cnly a tiny percenta"e of the allocated .lass A and .lass 6 address space has eer
been actually assi"ned to a host computer on the Internet.
People reali<ed that addresses could be consered if the class system was eliminated. 6y
accurately allocatin" only the amount of address space that was actually needed! the address
space crisis could be aoided for many years. &his was first proposed in +--2 as a scheme called
S!-ernettin&. Dnder supernettin"! the classful subnet masks are e)tended so that a network
address and subnet mask could! for e)ample! specify multiple .lass . subnets with one address.
:or e)ample! If I needed about +$$$ addresses! I could supernet 4 .lass . networks to"ether*
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 e)ample! the subnet +-2.?$.+2#.$ includes all the addresses from +-2.?$.+2#.$ to
+-2.?$.+3+.2%%. As you can see in the binary representation of the subnet mask! the 4etwork
portion of the address is 22 bits lon"! and the host portion is +$ bits lon".
Dnder .I39! the subnet mask notation is reduced to a simplified shorthand. Instead of spellin"
out the bits of the subnet mask! it is simply listed as the number of +s bits that start the mask. In
the aboe e)ample! instead of writin" the address and subnet mask as
192.(0.12).0+ Subnet Mask 255.255.252.0
the network address would be written simply as*
192.(0.12).0,22
which indicates startin" address of the network! and number of +s bits (22) in the network
portion of the address. If you look at the subnet mask in binary
(11111111.11111111.111111$$.$$$$$$$$)! you can easily see how this notation works.
&he use of a .I39 notated address is the same as for a .lassful address. .lassful addresses can
easily be written in .I39 notation (.lass A = E#! .lass 6 = E+?! and .lass . = E24)
It is currently almost impossible for an indiidual or company to be allocated their own IP
address blocks. /ou will simply be told to "et them from your I;P. &he reason for this is the
eer5"rowin" si<e of the internet routin" table. Fust +$ years a"o! there were less than %$$$
network routes in the entire Internet. &oday! there are oer +$$!$$$. Dsin" .I39! the bi""est
I;Ps are allocated lar"e chunks of address space (usually with a subnet mask of E+- or een
smaller)0 the I;P@s customers (often other! smaller I;Ps) are then allocated networks from the bi"
I;P@s pool. &hat way! all the bi" I;P@s customers (and their customers! and so on) are accessible
ia + network route on the Internet. 6ut I di"ress.
It is e)pected that .I39 will keep the Internet happily in IP addresses for the ne)t few years at
least. After that! IP?! with +2# bit addresses! will be needed. Dnder IP?! een sloppy address
allocation would comfortably allow a billion unique IP addresses for eery person on earthB &he
complete and "ory details of .I39 are documented in 9:.+%+-! which was released in
;eptember of +--3.
Allo)ed Class A S!"net and .ost +P addresses
/ "its S!"net $as% C+D, / S!"nets / .osts
2 2%%.+-2.$.$ E+$ 2 4+-43$2
3 2%%.224.$.$ E++ ? 2$-,+%$
4 2%%.24$.$.$ E+2 +4 +$4#%,4
% 2%%.24#.$.$ E+3 3$ %242#?
? 2%%.2%2.$.$ E+4 ?2 2?2+42
, 2%%.2%4.$.$ E+% +2? +3+$,$
# 2%%.2%%.$.$ E+? 2%4 ?%%34
- 2%%.2%%.+2#.$ E+, %+$ 32,??
+$ 2%%.2%%.+-2.$ E+# +$22 +?3#2
++ 2%%.2%%.224.$ E+- 2$4? #+-$
+2 2%%.2%%.24$.$ E2$ 4$-4 4$-4
+3 2%%.2%%.24#.$ E2+ #+-$ 2$4?
+4 2%%.2%%.2%2.$ E22 +?3#2 +$22
+% 2%%.2%%.2%4.$ E23 32,?? %+$
+? 2%%.2%%.2%%.$ E24 ?%%34 2%4
+, 2%%.2%%.2%%.+2# E2% +3+$,$ +2?
+# 2%%.2%%.2%%.+-2 E2? 2?2+42 ?2
+- 2%%.2%%.2%%.224 E2, %242#? 3$
2$ 2%%.2%%.2%%.24$ E2# +$4#%,4 +4
2+ 2%%.2%%.2%%.24# E2- 2$-,+%$ ?
22 2%%.2%%.2%%.2%2 E3$ 4+-43$2 2

Вам также может понравиться