or subnet - Chabot College

Download Report

Transcript or subnet - Chabot College

Chabot College
ELEC 99.05
Subnet Masking
CISCO NETWORKING ACADEMY
Logical Address Composition
Though the exact length and format of a
logical (layer 3) address differs
depending on the protocol, all logical
addresses share this basic formula:
NETWORK
NUMBER
CISCO NETWORKING ACADEMY
HOST NUMBER
Logical Address Composition
IP address may have an additional field,
the subnet field, that is used to identify
smaller networks within a larger network.
NETWORK
NUMBER
CISCO NETWORKING ACADEMY
SUBNET
NUMBER
HOST
NUMBER
Address Classes
1st octet
Class A (0 - 127) Network
2nd octet
3rd octet
4th octet
Host
Host
Host
Host
Host
Class B (128-191) Network Network
Class C (192-223) Network Network Network
CISCO NETWORKING ACADEMY
Host
Address Classes
Class A
85
45
31
158
Class B
168
65
114
201
Class C
210
144
235
56
Network
Host
CISCO NETWORKING ACADEMY
The Subnet Mask
• The solution to the IP address shortage
was thought to be the subnet mask.
• Formalized in 1985, the subnet mask
breaks a single class A, B or C network
in to smaller pieces.
CISCO NETWORKING ACADEMY
Subnetting
What’s happened to the host fields?
Network Network
Subnet
Host
8 bits
8 bits
8 bits are now used to represent subnets. Only 8 bits
remain for possible hosts.
CISCO NETWORKING ACADEMY
Subnetting
What’s happened to the host fields?
Network Network
Subnet
Host
8 bits
8 bits
8-bit subnet field = 28 subnets = 256 subnets.
8-bit host field = 28 hosts = 256 hosts.
Remember, we started with 65,536 hosts!
CISCO NETWORKING ACADEMY
The Subnet Mask
• The Subnet Mask is a 32-bit number.
• Its job is to tell routers (and humans)
which bits are network number and
which bits are used to represent hosts.
CISCO NETWORKING ACADEMY
The Subnet Mask
• The Subnet Mask corresponds to the IP
address.
• A “1” bit in the subnet mask means that
the corresponding bit in the IP address
should be read as a network number
• A “0” bit in the subnet mask means that
the corresponding bit in the IP address
should be read as a host bit.
CISCO NETWORKING ACADEMY
The Subnet Mask
Address
Mask
10101001
11000111
01000101
10001001
11111111
11111111
00000000
00000000
Here, the first 16 bits of the mask are set to “1.”
Thus, the first 16 bits (2 octets) of the IP
address are network number.
CISCO NETWORKING ACADEMY
The Subnet Mask
Address
Mask
Network
10101001
Network
11000111
Host
01000101
Host
10001001
11111111
11111111
00000000
00000000
The mask shows that the first two octets refer
to the network number.
CISCO NETWORKING ACADEMY
The Subnet Mask
Address
Mask
Network
10101001
Network
11000111
Host
01000101
Host
10001001
11111111
11111111
00000000
00000000
255
255
0
0
The mask shows that the first two octets refer
to the network number.
CISCO NETWORKING ACADEMY
The Subnet Mask
Address
Mask
Network
10101001
Network
11000111
Network
01000101
Host
10001001
11111111
11111111
11111111
00000000
Here, the first 24 bits are set to “1” in the
subnet mask. Thus, the first 24 bits (3 octets)
of the IP address are network number.
CISCO NETWORKING ACADEMY
The Subnet Mask
Address
Mask
Network
10101001
Network
11000111
Network
01000101
Host
10001001
11111111
11111111
11111111
00000000
255
255
255
0
Here, the first 24 bits are set to “1” in the
subnet mask. Thus, the first 24 bits (3 octets)
of the IP address are network number.
CISCO NETWORKING ACADEMY
The Subnet Mask
Address
Mask
Network
10101001
Network
11000111
Network
01000101
Host
10001001
11111111
11111111
11111111
11100000
Here, the first 27 bits of the subnet mask are
set to “1.” Thus, the first 27 bits of the IP
address refer to network number.
CISCO NETWORKING ACADEMY
The Subnet Mask
Address
Mask
Network
10101001
Network
11000111
Network
01000101
Host
10001001
11111111
11111111
11111111
11100000
255
255
255
224
Here, the first 27 bits of the subnet mask are
set to “1.” Thus, the first 27 bits of the IP
address refer to network number.
CISCO NETWORKING ACADEMY
The Default Subnet Masks
Class A or /8
255
0
0
0
Class B or /16
255
255
0
0
Class C or /24
255
255
255
0
If any additional bits in the subnet mask are set
to “1,” then subnets have been created.
CISCO NETWORKING ACADEMY
The Subnet Mask
Address
Mask
Network
207
Network
21
Network
54
Host
0
255
255
255
0
CISCO NETWORKING ACADEMY
The Subnet Mask
Address
Mask
Network
207
Network
21
Network
54
Host
0
11001111
00010101
00110110
11111111
11111111
11111111
00000000
00000000
255
255
255
0
CISCO NETWORKING ACADEMY
Class C : 1-bit Mask (/25)
Address
Mask
Network
207
Network
21
Network
54
Host
0
11001111
00010101
00110110
11111111
11111111
11111111
00000000
10000000
255
255
255
128
Masks can be written different ways. When the
phrase “1-bit” mask is used, that means 1 more bit
than the default. This example can also be called a
25-bit mask, or /25 (there are 25 network bits).
CISCO NETWORKING ACADEMY
Class C: 2-bit Mask (/26)
Address
Mask
Network
207
Network
21
Network
54
11001111
00010101
00110110
11111111
11111111
11111111
00000000
11000000
255
255
255
192
CISCO NETWORKING ACADEMY
Host
0
Class C: 3-bit Mask (/27)
Address
Mask
Network
207
Network
21
Network
54
11001111
00010101
00110110
11111111
11111111
11111111
00000000
11100000
255
255
255
224
CISCO NETWORKING ACADEMY
Host
0
Class C: 4-bit Mask (/28)
Address
Mask
Network
207
Network
21
Network
54
11001111
00010101
00110110
11111111
11111111
11111111
00000000
11110000
255
255
255
240
CISCO NETWORKING ACADEMY
Host
0
Class C: 5-bit Mask (/29)
Address
Mask
Network
207
Network
21
Network
54
11001111
00010101
00110110
11111111
11111111
11111111
00000000
11111000
255
255
255
248
CISCO NETWORKING ACADEMY
Host
0
Class C: 6-bit Mask (/30)
Address
Mask
Network
207
Network
21
Network
54
11001111
00010101
00110110
11111111
11111111
11111111
00000000
11111100
255
255
255
252
CISCO NETWORKING ACADEMY
Host
0
Class C: 7-bit Mask (/31)
Address
Mask
Network
207
Network
21
Network
54
11001111
00010101
00110110
11111111
11111111
11111111
00000000
11111110
255
255
255
254
CISCO NETWORKING ACADEMY
Host
0
Class C: 8-bit Mask (/32)
Address
Mask
Network
207
Network
21
Network
54
11001111
00010101
00110110
11111111
11111111
11111111
00000000
11111111
255
255
255
255
CISCO NETWORKING ACADEMY
0
Class C : 1-bit Mask (/25)
Address
Mask
Network
207
Network
21
Network
54
Host
0
11001111
00010101
00110110
11111111
11111111
11111111
00000000
10000000
255
255
255
128
Because this is a class C, all nodes on this
network will share the first three octets. Those
numbers are not an issue.
CISCO NETWORKING ACADEMY
Last Octet
1-bit Mask (/25)
Host
0
Address
Mask
00000000
10000000
128
How many subnet possibilities with 1 bit?
21 = 2 different possibilities
CISCO NETWORKING ACADEMY
Last Octet
1-bit Mask (/25)
Decimal
0=
127 =
Binary
00000000
01111111
128 =
10000000
255 =
11111111
Subnet #0
Subnet #1
The last octet can be any value from 0 - 255.
CISCO NETWORKING ACADEMY
Last Octet
1-bit Mask (/25)
Decimal
0=
127 =
Binary
00000000
01111111
128 =
10000000
255 =
11111111
Subnet #0
Subnet #1
7 bits
How many hosts can be on each subnet?
27 = 128 different possibilities MINUS TWO.
CISCO NETWORKING ACADEMY
Why “Minus Two”?
• Two special host addresses are “reserved”:
– the address of the subnet itself
(all zeros)
– the broadcast address for the subnet
(all ones)
Subnet addr.
Broadcast addr.
Decimal
0=
127 =
Binary
00000000
01111111
Subnet addr.
Broadcast addr.
128 =
255 =
10000000
11111111
CISCO NETWORKING ACADEMY
Subnet #0
Subnet #1
Network #, Broadcast Address
Decimal
0=
1=
36 =
127 =
Binary
00000000
00000001
00100100
01111111
128 =
255 =
10000000
11111111
All zeros in the HOST portion of the address is
reserved for network (or subnet) number.
All ones is reserved for the network (or subnet)
BROADCAST address.
CISCO NETWORKING ACADEMY
Last Octet
Decimal
0=
127 =
Binary
00000000
01111111
128 =
10000000
255 =
11111111
So, which subnet is this host on?
207.21.54.35
255.255.255.128
CISCO NETWORKING ACADEMY
Subnet #0
Subnet #0
Subnet #1
Last Octet
Decimal
0=
127 =
Binary
00000000
01111111
128 =
10000000
255 =
11111111
Subnet #0
Subnet #1
Are these two hosts on the same subnet?
207.21.54.115
255.255.255.128
CISCO NETWORKING ACADEMY
207.21.54.129
255.255.255.128
No.
Last Octet
Decimal
0=
127 =
Binary
00000000
01111111
128 =
10000000
255 =
11111111
Subnet #0
Subnet #1
Unfortunately, older TCP/IP software cannot
handle subnets with all zeros in the subnet
field.
CISCO NETWORKING ACADEMY
Last Octet
Decimal
0=
127 =
Binary
00000000
01111111
128 =
10000000
255 =
11111111
Subnet #0
Subnet #1
More bad news, older TCP/IP software cannot
handle subnets with all ones in the subnet
field.
CISCO NETWORKING ACADEMY
Last Octet
Decimal
0=
127 =
Binary
00000000
01111111
128 =
10000000
255 =
11111111
Subnet #0
Subnet #1
For now, using subnets that have all zeros or
all ones in the subnet field should be
considered illegal. (It’s not really, but….)
CISCO NETWORKING ACADEMY
Last Octet
Decimal
0=
127 =
Binary
00000000
01111111
128 =
10000000
255 =
11111111
Subnet #0
Subnet #1
Bottom line, a 1-bit mask results in no usable
addresses.
CISCO NETWORKING ACADEMY
Class C : 2-bit Mask (/26)
Address
Mask
Network
207
Network
21
Network
54
Host
0
11001111
00010101
00110110
11111111
11111111
11111111
00000000
11000000
255
255
255
192
Because this is a class C, all nodes on this
network will share the first three octets. Those
numbers are not an issue.
CISCO NETWORKING ACADEMY
Class C : 2-bit Mask (/26)
Host
0
Address
00000000
11000000
Mask
192
How many subnet possibilities with 2 bits?
22 = 4 different possibilities:
00
01
CISCO NETWORKING ACADEMY
10
11
Last Octet
CISCO NETWORKING ACADEMY
Decimal
0=
63 =
Binary
00000000
00111111
64 =
01000000
127 =
01111111
128 =
191 =
10000000
10111111
Subnet #2
192 =
255 =
11000000
11111111
Subnet #3
Subnet #0
Subnet #1
Last Octet
Decimal
0=
63 =
Binary
00000000
00111111
64 =
01000000
128 =
01111111
Subnet #0
Subnet #1
6 bits
How many hosts can be on each subnet?
26 = 64 different possibilities MINUS TWO.
CISCO NETWORKING ACADEMY
Which subnets can be used?
CISCO NETWORKING ACADEMY
Decimal
0=
63 =
Binary
00000000
00111111
64 =
01000000
127 =
01111111
128 =
191 =
10000000
10111111
Subnet #2
192 =
255 =
11000000
11111111
Subnet #3
Subnet #0
Subnet #1
Putting it together
Assuming the mask: 255.255.255.192, which addresses are
legal for hosts?
1) 207.21.54.35
2) 207.21.54.63
3) 207.21.54.65
4) 207.21.54.190
5) 207.21.54.195
CISCO NETWORKING ACADEMY
Class C : 3-bit Mask (/27)
Address
Mask
Network
207
Network
21
Network
54
Host
0
11001111
00010101
00110110
11111111
11111111
11111111
00000000
11100000
255
255
255
224
Because this is a class C, all nodes on this
network will share the first three octets. Those
numbers are not an issue.
CISCO NETWORKING ACADEMY
Class C : 3-bit Mask (/27)
Host
0
Address
Mask
00000000
11100000
224
How many subnet possibilities with 3 bits?
23 = 8 different possibilities:
000 001 010
CISCO NETWORKING ACADEMY
011 100 101 110
111
Last Octet
Decimal
0=
31 =
Binary
00000000
00011111
Decimal
128 =
Binary
10000000
159 =
10011111
32 =
00100000
63 =
00111111
160 =
191 =
10100000
10111111
64 =
95 =
01000000
01011111
192 =
223 =
11000000
11011111
96 =
127 =
01100000
01111111
224 =
255 =
11100000
11111111
CISCO NETWORKING ACADEMY
Last Octet
Decimal
0=
31 =
Binary
00000000
00011111
32 =
00100000
64 =
00111111
Subnet #0
Subnet #1
5 bits
How many hosts can be on each subnet?
25 = 32 different possibilities MINUS TWO.
CISCO NETWORKING ACADEMY
Which subnets can be used?
Decimal
0=
31 =
Binary
00000000
00011111
Decimal
128 =
Binary
10000000
159 =
10011111
32 =
00100000
63 =
00111111
160 =
191 =
10100000
10111111
64 =
95 =
01000000
01011111
192 =
223 =
11000000
11011111
96 =
127 =
01100000
01111111
224 =
255 =
11100000
11111111
CISCO NETWORKING ACADEMY