The Internet Assigned Numbers Authority (IANA) has reserved the

advertisement
The Internet Assigned Numbers Authority (IANA) has reserved the
following three blocks of the IP address space for private
internets:
10.0.0.0
172.16.0.0
192.168.0.0
-
10.255.255.255 (10/8 prefix)
172.31.255.255 (172.16/12 prefix)
192.168.255.255 (192.168/16 prefix)
We will refer to
the first block as "24-bit block",
the second as "20-bit block", and to
the third as "16-bit" block.
Note that (in pre-CIDR notation)
the first block is nothing but a single class A network number,
the second is a set of 16 contiguous class B network numbers,
and the third is a set of 256 contiguous class C network numbers.
Subnetting
Example A campus network
Here each of the ethernets has his own router
connected to the main router
How does it work
• When a packet comes into the main router, how
does this know which subnet (Ethernet) to give it
to?
• Having a host table with 65K entries each with the
responsable router is impractical
• A better way is that of devoting a part of the host
address to the specification of the router address
Fixed Length Mask Subnetting
In practice some bits are taken away from the host number to
create a subnet number
This adds another level of hierarchy to the IP addressing structure.
Instead of the classful two-level hierarchy, subnetting supports a threelevel hierarchy.
Subnet Mask
To implement subnetting the main router needs a subnet mask that indicates
the split between the network+subnetwork number and host: the subnet mask
tells the net router where the host addresses starts. The bits of the subnet
mask are set to 1 if the system examining the address should treat the
corresponding bit in the IP address as part of the extended-network- prefix.
The bits in the mask are set to 0 if the system should treat the bit as part of
the host-number.
Extended-Network-Prefix Length
The standards describing modern routing protocols often refer to
the extended-network-prefix- length rather than the subnet mask.
The prefix length is equal to the number of contiguous
one-bits in the traditional subnet mask.
However, it is important to note that modern routing protocols
still carry the subnet mask. There are no Internet standard routing
protocols that have a one-byte field in their header that contains
the number of bits in the extended-network prefix. Rather,
each routing protocol is still required to carry the complete four-octet subnet mask.
How does it work?
Address:
Subnet Mask:
AND
Network ID:
11000000
11111111
-------11000000
10101000
11111111
-------10101000
00010010
11111111
-------00010010
10110111
11000000
-------10000000
In order to route an incoming packet
the main router uses the mask by performing
a logical AND operation, so as to extract the
network address from the overall address, and hands
the packet to the corresponding router.
In the last column of the above example
we have a class C address with a mask of length 26
which tells us that the host portion of the address
10110111 must be split into
the subnet prefix
10
and the host address
110111
How it works without subnetting
• Each router has a table listing
some number of (network, 0) IP addresses and
some number of (this-network, host) IP addresses:
associated with each table is the network interface
to use to reach the destination.The first table is for distant
networks, the second for local hosts.
• When an IP packet arrives its destination address is looked up
in the routing table: if it is for a distant network it is
forwarded to the router indicated in the table; if it is for a
local host (e.g. on the touter LAN) it is sent directly to dht
destination.
How it works with subnetting
• When subnetting is introduced the routing tables are
changed, adding entries of the form
(this-network, subnet, 0) and
(this-network, this-subnet, host)
• The first is used to reach other subnets,
the second to reach the hosts of the local subnet.
• Notice that in this way the router does not have to know
the details about the hosts on other subnets: the router will
- take the IP address
- perform an AND with the subnet mask
getting rid of the host number
- look up the resulting subnet number in the routing table.
Benefits
The size of the global Internet routing table does not grow
because the site administrator does not need to obtain additional
address space and the routing advertisements for
all of the subnets are combined into a single routing table entry.
The local administrator has the flexibility to deploy
additional subnets without obtaining a new network
number from the Internet.
Route flapping (i.e., the rapid changing of routes)
within the private network does not affect the
Internet routing table since Internet routers
do not know about the reachability of the individual
subnets - they just know about the reachability
of the parent network number.
Subnet Design Considerations
The deployment of an addressing plan requires careful thought on the part of the network
administrator. There are four key questions that must be answered before any design
should be undertaken:
1) How many total subnets does the organization need today?
2) How many total subnets will the organization need in the future?
3) How many hosts are there on the organization's largest subnet today?
4) How many hosts will there be on the organization's largest subnet in the future?
All Zero and all one hosts
Recall that according to Internet practices,
the host-number field of an IP address
cannot contain all 0-bits or all 1-bits:
- the all-0s host-number identifies the base network
(or subnetwork) number,
-the all-1s host-number represents the broadcast address
for the network (or subnetwork).
In practice with n bits one will be able to address 2^n-2 hosts
How to subnet a network
To subnet a network, extend the natural mask using some of the bits
from the host ID portion of the address to create a subnetwork ID.
For example, given a Class C network of 204.15.5.0 which has a
natural mask of 255.255.255.0, you can create subnets in this manner:
204.15.5.0 11001100.00001111.00000101.00000000
255.255.255.224 - 11111111.11111111.11111111.11100000
--------------------------|sub|---By extending the mask to be 255.255.255.224, you have taken
three bits (indicated by "sub") from the original host portion
of the address and used them to make subnets. With these three bits,
it is possible to create eight subnets.
With the remaining five host ID bits, each subnet can have
up to 32 host addresses, 30 of which can actually
be assigned to a device since host ids of all zeros or all ones
are not allowed. So, with this in mind, these subnets have been created.
204.15.5.0
204.15.5.32
204.15.5.64
204.15.5.96
204.15.5.128
204.15.5.160
204.15.5.192
204.15.5.224
255.255.255.224
255.255.255.224
255.255.255.224
255.255.255.224
255.255.255.224
255.255.255.224
255.255.255.224
255.255.255.224
host
host
host
host
host
host
host
host
address
address
address
address
address
address
address
address
range
range
range
range
range
range
range
range
1
33
65
97
129
161
193
225
to
to
to
to
to
to
to
to
30
62
94
126
158
190
222
254
Example
Subnetting a class C network
Three bits are reserved for the subnet addresses
Five bits are reserved for the host addresses
This means that there is going to be room
for 2^3 = 8 subnets each with at most
2^5-2 = 30 hosts
More subnets => less hosts
This brings up an interesting point.
The more host bits you use for a subnet mask,
the more subnets you have available.
However, the more subnets available,
the less host addresses available per subnet.
For example, a Class C network of 204.17.5.0
and a mask of 255.255.255.224 (/27) allows you
to have eight subnets, each with 32 host addresses
(30 of which could be assigned to devices).
If you use a mask of 255.255.255.240 (/28),
the break down is:
204.15.5.0 11001100.00001111.00000101.00000000
255.255.255.240 - 11111111.11111111.11111111.11110000
--------------------------|sub |--Since you now have four bits
you only have four bits left
So in this case you can have
each of which can have up to
(14 of which can be assigned
to make subnets with,
for host addresses.
up to 16 subnets,
16 host addresses
to devices).
Class C Host/Subnet Table
Class C
Bits
------1
2
3
4
5
6
7
Subnet
Mask
--------------255.255.255.128
255.255.255.192
255.255.255.224
255.255.255.240
255.255.255.248
255.255.255.252
255.255.255.254
Effective
Subnets
--------2
4
8
16
32
64
128
Effective
Hosts
--------126
62
30
14
6
2
2*
Number of Subnet
Mask Bits
-------------/25
/26
/27
/28
/29
/30
/31
Notice that an exception to the 2^n-2 rule is 31-bit prefixes,
marked with an asterisk ( * ).
Subnetting a Class B network
Take a look at how a Class B network might be subnetted.
If you have network 172.16.0.0 ,then you know that its natural
mask is 255.255.0.0 or 172.16.0.0/16. Extending the mask
to anything beyond 255.255.0.0 means you are subnetting.
You can quickly see that you have the ability to create
a lot more subnets than with the Class C network.
If you use a mask of 255.255.248.0 (/21), how many subnets
and hosts per subnet does this allow for?
172.16.0.0 10101100.00010000.00000000.00000000
255.255.248.0 - 11111111.11111111.11111000.00000000
-----------------| sub |----------You are using five bits from the original host bits for subnets.
This will allow you to have 32 subnets (25). After using
the five bits for subnetting, you are left with 11 bits
for host addresses. This will allow each subnet
so have 2048 host addresses (211), 2046 of which
could be assigned to devices.
Example
Subnetting a class B network
Nine bits are reserved for the subnet addresses
Seven bits are reserved for the host addresses
This means that there is going to be room
for 2^9 = 512 subnets each with at most
2^7-2 = 126 hosts
Class B Host/Subnet Table
Class B
Bits
------1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Subnet
Mask
--------------255.255.128.0
255.255.192.0
255.255.224.0
255.255.240.0
255.255.248.0
255.255.252.0
255.255.254.0
255.255.255.0
255.255.255.128
255.255.255.192
255.255.255.224
255.255.255.240
255.255.255.248
255.255.255.252
255.255.255.254
Effective
Subnets
--------2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
Effective
Hosts
--------32766
16382
8190
4094
2046
1022
510
254
126
62
30
14
6
2
2*
Number of Subnet
Mask Bits
------------/17
/18
/19
/20
/21
/22
/23
/24
/25
/26
/27
/28
/29
/30
/31
Class A Host/Subnet Table
Class A
Number of
Bits Borrowed
from Host Portion
------1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Subnet
Mask
--------------255.128.0.0
255.192.0.0
255.224.0.0
255.240.0.0
255.248.0.0
255.252.0.0
255.254.0.0
255.255.0.0
255.255.128.0
255.255.192.0
255.255.224.0
255.255.240.0
255.255.248.0
255.255.252.0
255.255.254.0
255.255.255.0
255.255.255.128
255.255.255.192
255.255.255.224
255.255.255.240
255.255.255.248
255.255.255.252
255.255.255.254
Effective
Subnets
--------2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
131072
262144
524288
1048576
2097152
4194304
8388608
Number of
Hosts/Subnet
------------8388606
4194302
2097150
1048574
524286
262142
131070
65534
32766
16382
8190
4094
2046
1022
510
254
126
62
30
14
6
2
2*
Number of Subnet
Mask Bits
------------/9
/10
/11
/12
/13
/14
/15
/16
/17
/18
/19
/20
/21
/22
/23
/24
/25
/26
/27
/28
/29
/30
/31
Subnetting Example
The first entry in the Class A table (/10 subnet mask) borrows two bits (the leftmost bits)
from the host portion of the network for subnetting, then with two bits you have
four (22) combinations, 00, 01, 10, and 11. Each of these will represent a subnet.
Binary Notation
-------------------------------------------------xxxx xxxx. 0000 0000.0000 0000.0000 0000/10
------>
xxxx xxxx. 0100 0000.0000 0000.0000 0000/10
------>
xxxx xxxx. 1000 0000.0000 0000.0000 0000/10
------>
xxxx xxxx. 1100 0000.0000 0000.0000 0000/10
------>
Decimal Notation
----------------X.0.0.0/10
X.64.0.0/10
X.128.0.0/10
X.192.0.0/10
Note: The subnet zero and all-ones subnet are included in the effective number of subnets
as shown in the third column.
Download