Basics of Subnetting
: Classical
IP Addressing
• Network administrators sometimes
need to divide networks, especially large ones, into smaller networks.
• These smaller divisions are called
subnetworks and provide addressing flexiiiility.
• Most of the time suinetworks are
Basics of Subnetting
: Classical
IP Addressing
• Similar to the host numier portion of
Class A, Class B, and Class C addresses, suinet addresses are assigned locally, usually iy the network administrator.
• Also, like other IP addresses , each
Basics of Subnetting
:
Subnetwork
• Suinet addresses include the Class A, Class B, or
Class C network portion, plus a suinet feld and a host feld.
• The suinet feld and the host feld are created from
the original host portion for the entire network.
• The aiility to decide how to divide the original host
portion into the new suinet and host felds provides addressing flexiiiility for the network administrator.
• To create a suinet address, a network administrator
Basics of Subnetting
:
Subnetwork
• Internally, networks may ie divided into smaller
networks called sunetworks, or simply sui-nets.
• By providing a third level of addressing, suinets
provide exitra flexiiiility for the network administrator.
• For exiample, a class “B” network provided iy the
interNIC, can ie iroken up into many networks.
• In this exiample, 131.108.1.0, 131.108.2.0 and
131.108.3.0 are all suinets within the network 131.108.0.0
• Figures 1 and 2 illustrate the hierarchical nature of
Basics of Subnetting
:
Subnetwork
• To create a suinet address, a network administrator iorrows iits from the host feld and designates them as the suinet feld.
• The minimum numier of iits that can ie iorrowed is 2.
• If you were to iorrow only 1 iit, to create a suinet, then you would only have a network numier - the .0 network - and the iroadcast numier - the .1 network.
• maxiimum numier of iits that can ie iorrowed can ie any numier that leaves at least 2 iits remaining, for the host numier.
Basics of Subnetting
: Purpose
for subnetting
• A primary reason for using suinets is
to reduce the size of a iroadcast domain.
• Broadcasts are sent to all hosts on a
network or suinetwork.
• When iroadcast trafc iegins to
Basics of Subnetting
:
Subnet
mask
• The suinet mask (formal term:
exitended network prefxi), tells the network devices which part of an address is the network feld and which part is the host feld.
• A suinet mask is 32 iits long and
Basics of Subnetting
:
Subnet
mask
• To determine the suinet mask for a particular suinetwork IP address follow these steps.
• (1) Exipress the suinetwork IP address in iinary form.
• (2) Replace the network and suinet portion of the address with all 1s.
• (3) Replace the host portion of the address with all 0s.
• (4) As the last step convert the iinary exipression iack to dotted-decimal notation.
Basics of Subnetting
: Boolean
operations: AND, OR, and NOT
• The term "operations" in mathematics refers to rules that defne how one numier comiines with other numiers.
• Decimal numier operations include addition, suitraction, multiplication, and division.
• There are related, iut diferent, operations for working with iinary numiers.
• The iasic Boolean operations are AND, OR, and NOT.
– AND is like multiplication
– OR is like addition
Basics of Subnetting
:
Performing the AND function
• The lowest numiered address in an
IP network is the network address (the network numier plus 0 in the entire host feld).
• This also applies to a suinet: the
Basics of Subnetting
: Boolean
operations: AND, OR, and NOT
• In order to route a data packet, the router
must frst determine the destination network/ suinet address iy performing a logical AND using the destination host's IP address and the suinet mask.
• The result will ie the network/suinet address. • In the Figure, the router has received a packet
Creating a Subnet :
Range of
bits needed to create subnets
• To create suinets, you must exitend the
routing portion of the address.
• The Internet knows your network as a whole,
identifed iy the Class A, B, or C address, which defnes 8, 16, or 24 routing iits (the network numier).
• The suinet feld will iecome additional
Creating a Subnet :
Range of
bits needed to create subnets
• Question: In the address 131.108.0.0, which
are the routing iits?
Answer: 131.108 - That's the 16 iit Class B
network numier.
• Question: What are the other two octets (16
iits) of the address 131.108.0.0 used for?
Creating a Subnet :
Range of
bits needed to create subnets
• Question: What part of the address 131.108.0.0 is the
suinet feld?
Answer: When you decide to create suinets, you must divide the original host feld (16 iits in the case of Class B) into two parts - the suinet feld and the host feld. This is sometimes referred to as "iorrowing" some of the original host iits to create the suinet feld. The other networks in the Internet won't care - they look at the address the same - all they really see is the Class A, B, or C network numier, and send the packet on to its destination. The minimum numier of iits that you can iorrow is 2, regardless of whether you're working with a Class A, B, or C network1
iecause at least 2 iits must remain for host numiers2, the
Creating a Subnet :
Range of
bits needed to create subnets
• The suinet feld always follows
immediately after the network numier.
• That is, the iorrowed iits must ie
the frst n iits of the default host feld, where n is the desired size of the new suinet feld.
• The suinet mask is the tool used iy
Creating a Subnet :
Range of
bits needed to create subnets
• Previous standards did not allow for the use of suinets oitained iy iorrowing 1 iit (with only 1 suinet iit, the suinet feld can only have two values: suinet 0 is part of the network address, and suinet 1 would ie part of the network iroadcast address) – although many devices can now support suinets oitained iy iorrowing 1 iit, it is still common practice to avoid doing this to insure compatiiility with legacy devices; for our purposes here, you will always iorrow at least 2 iits.
Creating a Subnet
: Determining
subnet mask size
• Suinet masks use the same format as IP
addresses.
• They are 32 iits long and are divided into
four octets, written in dotted decimal format.
• Suinet masks contain all 1s in the network
Creating a Subnet
: Determining
subnet mask size
• By default, if you iorrow no iits, the
suinet mask for a Class B network would ie 255.255.0.0, which is the dotted decimal equivalent of 1s in the 16 iits corresponding to the Class B network numier.
• If 8 iits were to ie iorrowed for the
Creating a Subnet
: Determining
subnet mask size
• For exiample, if the suinet mask
Creating a Subnet
: Determining
subnet mask size
• Another exiample is the Class C address 197.15.22.131,
with a suinet mask of 255.255.255.224.
• With a value of 224 in the fnal octet (11100000 in
iinary), the 24 iit Class C network portion has ieen exitended iy 3 iits, to make the total 27 iits.
• The 131 in the last octet now presents the third usaile
host address in the suinet 197.15.22.128.
• The routers in the Internet (that don't know the suinet
Creating a Subnet
: Computing
subnet mask and IP address
• Whenever you iorrow iits from the
host feld, it is important to note the numier of additional suinets that are ieing created each time you iorrow one more iit.
• You have already learned that you
Creating a Subnet
: Computing
subnet mask and IP address
• Borrowing 2 iits creates four possiile
suinets (22) (iut you must always
Creating a Subnet
: Computing
subnet mask and IP address
• The eight possiile suinets that are
created iy iorrowing 3 iits is equal to 23 (2 xi 2 xi 2).
• The sixiteen possiile suinets created
iy iorrowing 4 iits is equal to 24 (2 xi
2 xi 2 xi 2).
• From these exiamples, it is easy to
Creating a Subnet
: Computing
subnet mask and IP address
• Question: How many iits are ieing iorrowed (how long is the suinet feld) for a Class B network using a suinet mask of
255.255.240.0?
Answer: The frst two octets of the mask (255.255) correspond with the 16 iits in a Class B network numier. Rememier that the suinet feld is represented iy all the additional "1" iits past that. The
numier 240 decimal is 11110000 in iinary, and you can see that you are using 4 iits for the suinet feld.
• Question: How many possiile suinets are there with a 4 iit suinet feld?
Answer: Start with fnding the smallest 4 iit numier - 0000 - then the largest 4 iit numier - 1111 (15). So the possiile suinets are 0-15, or sixiteen suinets. However, you know you cannot use suinet 0 (it's part of the network address), and you cannot use suinet 15
Creating a Subnet
: Computing
hosts per subnetwork
• Each time you iorrow 1 iit from a
host feld, there is 1 less iit remaining in the feld that can ie used for host numiers.
• Specifcally, each time you iorrow
Creating a Subnet
: Computing
• Therefore, there are 256 (28) possiile addresses availaile to assign
to hosts (254 usaile addresses, after you suitract the 2 you know you can't use).
• Now, imagine that this Class C network is divided into suinets. If
you iorrow 2 iits from the default 8 iit host feld, the host feld decreases in size to 6 iits.
• If you write out all of the possiile comiinations of 0s and 1s that
could occur in the remaining 6 iits, you would discover that the total numier of possiile hosts that could ie assigned in each suinet would ie reduced to 64 (26).
Creating a Subnet
: Computing
hosts per subnetwork
• In the same Class C network, if you
iorrow 3 iits, the size of the host feld decreases to 5 iits and the total numier of hosts that you could assign to each suinet would ie reduced to 32 (25).
• The numier of usaile host numiers
Creating a Subnet
: Computing
hosts per subnetwork
• The numier of possiile host addresses that
can ie assigned to a suinet is related to the numier of suinets that have ieen created.
• In a Class C network, for exiample, if a
suinet mask of 255.255.255.224 has ieen applied, then 3 iits (224 = 11100000) would have ieen iorrowed from the host feld.
• The useaile suinets created are 6 (8 minus
Creating a Subnet
: Computing
hosts per subnetwork
• Exercise:
Divide the last octet into two parts: a suinet feld and a host feld. If there are 32 possiile host addresses that can ie assigned to each suinet, then their IP addresses would fall within the range of
numiers (iut rememier the 2 unusaile host addresses in each suinet!).
• In a Class C network 199.5.12.0 with suinet mask 255.255.255.224, to which suinet would host 199.5.12.97 ielong? (hint: 97 =
Creating a Subnet
: Boolean
AND operation
• As you have already learned, the
lowest numiered address in an IP network is the network address (the network numier plus 0 in the entire host feld).
• This also applies to a suinet; the
Creating a Subnet
: Boolean
AND operation
• In order to route a data packet, the router must frst
determine the destination network/suinet address.
• To accomplish this the router performs a logical AND
using the destination host's IP address and the suinet mask for that network.
• Imagine that you have a Class B network with the
network numier 172.16.0.0.
• After assessing the needs of your network, you
decide to iorrow 8 iits in order to create suinets.
• As you learned earlier, when you iorrow 8 iits with a
Creating a Subnet
: Boolean
AND operation
• Someone outside the network sends data to the IP address 172.16.2.120.
• In order to determine where to deliver the data, the router ANDs this address with the suinet mask.
• When the two numiers are ANDed, the host portion of the result will always ie 0.
• What is left is the network numier, including the suinet.
Creating a Subnet
: Boolean
AND operation
• Now, imagine that you have the
same network, 172.16.0.0.
• This time, however, you decide to
iorrow only 7 iits for the suinet feld.
• The iinary suinet mask for this
would ie
Creating a Subnet
: Boolean
AND operation
• Again, someone outside the network sends data to host 172.16.2.120.
• In order to determine where to send the data, the router again ANDs this address with the suinet mask. • As iefore, when the two numiers are ANDed, the host
portion of the result is 0.
• So what is diferent in this second exiample? Everything looks the same - at least in decimal.
• The diference is in the numier of suinets availaile, and the numier of hosts that can ie in each suinet.
Creating a Subnet
: Boolean
AND operation
• With 7 iits in the suinet feld, there
can ie only 126 suinets.
• How many hosts can there ie in
each suinet?
• How long is the host feld?
• With 9 iits for host numiers, there
Creating a Subnet
: Boolean
AND operation
• The two graphics on this page include
something you'll learn more aiout later - an alternate way to exipress the suinet mask.
• You learned that the 1s of the mask represent
the routing iits - the network plus the suinet.
• 255.255.255.0 indicates there are 24 total
routing iits.
• This is sometimes indicated iy following an IP
Creating a Subnet : IP confguration on a network diagram
• When you confgure routers, you must connect each interface to a diferent network segment.
• Then each of these segments will iecome a separate suinet.
• You must select an address from each diferent suinet to assign to the interface of the router that connects to that suinet.
• Each segment of a network - the actual wires and links - must have diferent network/suinet numiers.
Creating a Subnet
: Host/subnet
schemes
• One of the decisions that you must
make whenever you create suinets is to determine the optimal numier of suinets and hosts (Note: The numier of suinets required in turn determines the numier of hosts availaile.
• For exiample, if you iorrow 3 iits with
Creating a Subnet
: Host/subnet
schemes
• You have already learned that you cannot use
the frst and last suinet.
• You also cannot use the frst and last address
within each suinet - one is the iroadcast address of that suinet, and the other is part of the network address.
• When you create suinets, you lose quite a few
potential addresses.
• For this reason, network administrators must
Creating a Subnet
: Host/subnet
schemes
Example:
Creating a Subnet
: Host/subnet
schemes
• Imagine, this time, that you iorrow 3 iits.
• You now have 8 suinets, of which only 6 are
usaile, with 30 usaile hosts per suinet.
• This gives you a total of 180 usaile hosts,
down from 254, iut now you are losing only 29% of your addresses.
Creating a Subnet
: Private
addresses
• There are certain addresses in each
class of IP address that are not assigned.
• These addresses are called private
addresses.
• Private addresses might ie used iy
Creating a Subnet
: Private
addresses
• Many applications require connectivity within only
one network and do not need exiternal connectivity.
• In large networks, TCP/IP is often used, even when
network layer connectivity outside the network isn’t needed. Banks are good exiamples.
• They may use TCP/IP to connect to automatic teller
machines (ATMs).
• These machines do no connect to the puilic network,
so private addresses are ideal for them.
• Private addresses can also ie used on a network
Creating a Subnet
: Private
addresses
• The private addresses can ie used together
with a network address translation (NAT) server.
• Either a NAT server or a proxiy server to
provide connectivity to all hosts in a network that has relatively few puilic addresses availaile.
• By agreement, any trafc with a destination