Subnetting--CISCO IP & Routing Tutorial
Used to partition the given address space into smaller, manageable sizes.
IP networks can be divided into smaller networks called subnetworks (or subnets).
Subnetting provides the network administrator with several benefits, including
extra flexibility, more efficient use of network addresses, and the capability
to contain broadcast traffic (a broadcast will not cross a router).
Due to the explosive growth of the Internet, the principle of assigned IP addresses
became too inflexible to allow easy changes to local network configurations.
Those
changes might occur when:
. A new type of physical network is installed at a location.
. Growth of the number of hosts requires splitting the local network into two
or
more separate networks.
. Growing distances require splitting a network into smaller networks, with
gateways between them.
Without subnetting: The entire network(141.14.0.0) is connected as one LAN--All of the workstations should be connected directly to the router---either directly to the router ports(not feasible since router needs too many ports) or the LAN is connected only through hubs and bridges(not feasible because of bridge broadcast problems)

With subnetting: The LAN can be divided into manageable sizes

Types of Subnetting
There are two types of subnetting: static and variable length. Variable length
is the more flexible of the two.
Which type of subnetting is available depends upon therouting protocol being used; native IP routing supports only static subnetting, as does the widely used RIP protocol. However, RIP Version 2 supports variable length subnetting as well.
Static subnetting
· A portion of host address bits are used as subnetwork address bits
· The "dividing line" between network address and host address
parts is shifted variably to the right

A subnet is defined by applying the subnet mask to the IP address
· if a bits is "on" (set to 1) in the subnet mask, then that
equivalent bit in the address is interpreted as a network bit
· if a bits is "off" (set to 0) in the subnet mask, then that
equivalent bit in the address is interpreted as a host bit
· subnet masks are applied only locally, in the router and the hosts
· subnet masks must be configured in all hosts and routers


Standard subnet masks for the 3 classes of addresses
· for a class A address - 255.0.0.0
· for a class B address - 255.255.0.0
· for a class C address - 255.255.255.0
Examples of Subnet Masks
IP Address Subnet Mask Interpretation
---------------------------------------------------------------------------------------------------
128.66.12.1 255.255.255.0 1st address on subnet 128.66.12.0
130.97.16.132 255.255.255.192 4th on subnet 130.97.16.128
132.241.158.33 255.255.255.224 ?
Sunetting example: Given a class B network address
For example: CSU, Chico is assigned 132.241.0.0 = 10000100 11110001 00000000 00000000
Let's assume that the network administrator of Chico State decided to subnet the address space using 8 bits in the hostid
Subnet mask
(a) Before subnetting
11111111 11111111 00000000 00000000
= 255. 255. 0. 0
(b) After subnetting
11111111 11111111 11111111 00000000
= 255. 255. 255. 0
Assignment of subnets:
132.241.1.0
132.241.2.0
......
132.241.9.0
--------------------- All of the above subnets are assigned to ECST
...
132.241.158.0 --Assigned to IBM Networks Lab in OCNL 340
...
Campus routers are configured to recognize this subnetting, in other words
campus routers have the subnet mask of 255.255.255.0
Now given the above subnetting, let's do the subnetting one more level(subnetting of a subnet)
IBM Networks Lab(OCNL 340) is given the subnet address of 132.241.158.0
The equipments for the LAN in IBM Networks Lab are:
*A router with 4 Ethernet ports
*Three 10/100 BaseT hubs
*About 30 workstations(including servers) currently but need to grow to 50 later
The following is the desired network connections
Given 132.241.158.0, we have the last 8 bits to subdivide
132.241.158. 0 = 10000100 11110001 10011110 00000000
Choices of subnetting:
(a) Use 1 bit--this is not possible because the bit 0 is reserved to designate the subnet's address and the bit 1 is reserved for broadcast address
(b) Use first 2 bits--We have 00, 01, 10, 11--00(reserved for subnet's address) 11(reserved for broadcast)
Using 2 bits, we can have only 2 subnets but we need 3 subnets
(c) Use first 3 bits--We have 000, 001, 010, 011, 100, 101, 110, 111(000 & 111 are reserved)
We can have 6 subnets--this choice can accomodate our needs
(d) Use first 4 bits--We have 14(=2**4 - 2) subnets
This one can be a choice but this will allow only 14 IP addresses on each subnet--this may not be enough because we need to put about 15 workstations on each subnet and also each router port needs an IP address
(e) Use first 5 bits--We have 30(2**5 -2) subnets and 6 IP addresses on each subnet--does not meet our requirement
(f) Use first 6 bits--Try to calculate the # of subnets and # of IP addresses on each subnet
(g) Use frist 7 bits--Try to calculate the # of subnets and # of IP addresses on each subnet
Choice(b) is a reasonable choice--actually the only choice in this example
Resulting addresses using 3 bits:
Static subnetting means that all subnets in the subnetted network use the same subnet mask. This is simple to implement and easy to maintain, but it implies wasted address space for small networks. For example, a network of four hosts that uses a subnet mask of 255.255.255.0 wastes 250 IPaddresses. It also makes the network more difficult to reorganize with a new subnet mask. All hosts and routers are required to support static subnetting.
Variable Length Subnetting:
When variable length subnetting is used, the subnets that make up the network
can use different subnet masks. A small subnet with only a few hosts needs a
subnet mask that accommodates only these few hosts. A subnet with many hosts
attached may need a different subnet mask to accommodate the large number of
hosts. The possibility to assign subnet masks according to the needs of the
individual subnets will help conserve network addresses. Also, a subnet can
be split into two parts by adding another bit to the subnet mask. Other subnets
in the network are unaffected by the change.
Variable length subnetting allows you to divide the network so that it is possible
todefine adequate hosts for each subnet by changing the subnet mask for each
network. This can be achieved by configuring the routers accordingly. Please
note that not every host and router supports variable length subnetting.
CIDR(=Supernetting)
The IP address space will near exhaustion very soon if addresses are assigned as they are requested or as they used to be assigned. IPv6 will easily overcome that problem, but what can be done until IPv6 will be fully deployed?
The solutions are:
(a) For Intranets--NAT(Network Address Translation)
(b) For Internet--CIDR
One idea was to use a range of Class C addresses instead of a single Class
B address. The problem there is that each network must be routed separately
because standard IP routing understands only class A, B and C network addresses.
Within each of these types of network, subnetting can be used to provide better
granularity of the address space within each network, but there is no way to
specify that multiple Class C networks are actually related.. The result of
this is termed the routing table explosion problem:
A Class B network of 3000 hosts requires one routing table entry at each backbone
router, whereas the same network, if addressed as a range of Class C networks,
would require 16 entries.
The solution to this problem is a scheme called Classless Inter-Domain Routing(CIDR).
CIDR is described in RFCs 1518 to 1520.
CIDR does not route according to the class of the network number (hence the
term classless) but solely according to the high order bits of the IP address,
which are termed the IP prefix. Each CIDR routing table entry contains a 32-bit
IP address
and a 32-bit network mask, which together give the length and value of the IP
prefix. This can be represented as <IP_address network_mask>. For example,
to address a block of eight Class C addresses with one single routing table
entry, the following representation would suffice: <192.32.136.0 255.255.248.0>.
This would, from a backbone point of view, refer to the Class C network range
from 192.32.136.0 to 192.32.143.0 as one single network because of the identical
IP prefix.
Classless Inter-Domain Routing - IP Supernetting Example
(a)
11000000 00100000 10001xxx xxxxxxxx = 192.32.136.0(class C address)
11111111 11111111 11111000 00000000--255.255.248.0(network mask)
=================================================== logical_AND
11000000 00100000 10001000 00000000= 192.32.136 (IP prefix)
(b)
11000000 0010000010001111 xxxxxxxx= 192.32.143.0(class C address)
11111111 11111111 11111000 00000000--255.255.248.0(network mask)
=================================================== logical_AND
1100000 00100000 10001000 00000000= 192.32.136 (same IP prefix)