CIT 384: Network Administration Slide #1
CIT 384: Network Administration
Subnetting
CIT 384: Network Administration Slide #2
Topics
1. IP Addresses
2. Classful and classless addressing
3. Subnet Masks and Prefixes
4. Subnet Math
5. Subnet Problems
CIT 384: Network Administration Slide #3
IP Addresses
32-bit integersOne for each network interface.Dotted decimal notation: ii.jj.kk.ll
172 . 16 . 254 . 1
10101100 00010000 11111110 00000001
1 byte
32 bits = 4 bytes
CIT 384: Network Administration Slide #4
Grouping IP Addresses
Groups of consecutive IP addrs are called networks.
Routing table would only need 3 entries below.
CIT 384: Network Administration Slide #5
Network and Host Parts
IP addresses are divided into two parts– Network ID (like zip code)– Host ID (like street address)
Network ID Host ID
Two special IP addresses– Network address (e.g. 130.4.0.0)– Broadcast address (e.g. 130.4.255.255)
CIT 384: Network Administration Slide #6
Address ClassesClass A: 0.0.0.0-127.255.255.255
8-bit net ID, 24-bit host ID224 – 2 hosts per network; 126 networks
Class B: 128.0.0.0-191.255.255.25516-bit net ID, 16-bit host ID216 – 2 hosts per network; 16,384 networks
Class C: 192.0.0.0-223.255.255.25524-bit net ID, 8-bit host ID(28 – 2) = 254 hosts per network; 2,097,152 networks
Class D: 224.0.0.0-239.255.255.25528-bit multicast group ID
Class E: 240.0.0.0-255.255.255.255Reserved for future use
CIT 384: Network Administration Slide #7
CIDR
Classless Inter-Domain Routing– Classful routing wastes most IP addresses.– Allocate addresses on bit boundaries instead of
byte boundaries.– Allow ISPs/users to decide on boundaries
instead of basing on IP addresses.
Prefix notation– /x indicates that first x bits are shared.– 192.168.0.0/16 = 192.168.0.0 – 192.168.255.255
CIT 384: Network Administration Slide #8
Public IP Addresses
ICANN assigns network numbers.– Internet Corporation for Assigned Network
Numbers.– ICANN gives authority to regional orgs, e.g.
ARIN (American Registry for Internet Numbers)– Typically to ISPs, universities, corporations.
ISP assigns IP addresses within network
CIT 384: Network Administration Slide #9
Private RFC1918 IP Addresses
Private IP Networks Network Class Count of Networks
10.0.0.0 A 1
172.16.0.0 through
172.31.0.0
B 16
192.168.0.0 through 192.168.255.0
C 256
CIT 384: Network Administration Slide #10
IPv4 vs IPv6 Addresses
Feature IPv4 IPv6
Size of Address 32 bits 128 bits
Example Address 10.1.1.1 0000:0000:0000:0000:FFFF:FFFF:0A01:0101
Abbreviated Address
- ::FFFF:FFFF:0A01:0101
Localhost 127.0.0.1 ::1/128
Possible Addresses
232 (~4 billion) 2128 (~3.4 x 1038)
CIT 384: Network Administration Slide #11
Network Mask
How do we list subnets in routing table?– Ex: addresses 150.150.4.0 – 150.150.4.255
– Table: 155.155.4.0 netmask 255.255.255.0
Subnet mask indicates range– Binary 1s indicate network part of address.
– Binary 0s indicate host part of address.
– Always consists of 1s followed by 0s.
Prefix notation– Humanly readable form of subnet mask.
– Just counts the number of binary 1s in mask.
CIT 384: Network Administration Slide #12
Classful Address Ranges and Masks
Class ANNNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH
Class BNNNNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH
Class CNNNNNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH
Class Leading Bits
Start End Subnet Mask CIDR
A 0 0.0.0.0 126.255.255.255 255.0.0.0 /8
B 10 128.0.0.0 191.255.255.255 255.255.0.0 /16
C 110 192.0.0.0 231.255.255.255 255.255.255.0 /24
D 1110 224.0.0.0 239.255.255.255 N/A N/A
E 1111 240.0.0.0 255.255.255.0 N/A N/A
CIT 384: Network Administration Slide #13
Example
• IP Address: 137.201.18.42
• Address Class: B since 128 < 137 < 191
• Default Netmask: 255.255.0.0
• Network Address Part: 137.201.0.0
• Host Address Part: 0.0.18.42
• Broadcast Address: 137.201.255.255
• Host Address Range for Network:– 137.201.18.1 through 137.201.255.254
CIT 384: Network Administration Slide #14
Why Subnet?
Allows admin to create more networks for:1. Address conservation.
2. Organization of hosts.
3. Different physical media.
4. Security.
5. Performance (smaller broadcast domains.)
CIT 384: Network Administration Slide #15
IP Addresses with Subnets
Route on network + subnet part of address.
CIT 384: Network Administration Slide #16
Subnet Math
Binary <-> Decimal Conversion– Convert each byte of dotted quad into binary.
– Convert binary byte into 4 decimal values.
Boolean AND operation– 0 AND 0 = 0
– 0 AND 1 = 0
– 1 AND 0 = 0
– 1 AND 1 = 1
Convert between dotted quad and prefix.– 255.255.255.0 netmask is identical to /24
CIT 384: Network Administration Slide #17
How to find network address?
(IP Address) AND (Subnet Mask)
137.201.18.42 10001001.11001001.00010010.00101010
AND
255.255.0.0 11111111.11111111.00000000.00000000
---------------------------------------------------
10001001.11001001.00000000.00000000
(convert from binary to decimal)
137.201.0.0
CIT 384: Network Administration Slide #18
How to find number of networks?
Address divided between network and host.– If there are s subnet bits and h host bits, then
– Number of subnets = 2s
– Number of hosts = 2h – 2
Subnet zero– Classful routing reserves 2 subnets so only have 2s – 2.
• Lowest and highest subnet numbers.
– For Class B network 150.150.0.0 reserves• 150.150.0.0 (ambiguity with address of whole B)
• 150.150.255.0/24 (ambiguous broadcast 150.150.255.255)
CIT 384: Network Administration Slide #19
Choosing Subnet Mask to meet Design Requirements
Requirements– Class B network 130.1.0.0– Number of subnets: 200– Max hosts per subnet: 200
Problem 1: how many host bits?– Find h, # of host bits, such that 2h >= 200.– 27 = 128, 28 = 256, therefore h = 8.
Problem 2: how many subnet bits?– Find s, # of subnet bits, such that 2s >= 200, yields s = 8.– NNNNNNNN.NNNNNNNN.SSSSSSSS.HHHHHHHH
Problem 3: find subnet mask– 11111111 11111111 11111111 00000000– 255.255.255.0
CIT 384: Network Administration Slide #20
Multiple Possible Subnet MasksIn some problems, many subnet masks exist.Ex: change # of subnets from 200 to 50.
– Find s, # of subnet bits, such that 2s >= 50, yields s = 6.– NNNNNNNN.NNNNNNNN.SSSSSSxx.HHHHHHHH– How many possible subnets exist?
• 11111111 11111111 11111100 (6 subnet bits, 10 host bits)• 11111111 11111111 11111110 (7 subnet bits, 9 host bits)• 11111111 11111111 11111111 (8 subnet bits, 8 host bits)• 11111111 11111111 11111101 (impossible)
– Subnet masks• /22 255.255.252.0 (6 subnet bits, 10 host bits, 1022 hosts/sub)• /23 255.255.254.0 (7 subnet bits, 9 host bits, 510 hosts/sub)• /24 255.255.255.0 (8 subnet bits, 8 host bits, 254 hosts/sub)
Do you want to maximize # subnets or # hosts/subnet?
CIT 384: Network Administration Slide #21
References
1. James Boney, Cisco IOS in a Nutshell, 2nd edition, O’Reilly, 2005.
2. Cisco, Cisco Connection Documentation, http://www.cisco.com/univercd/home/home.htm
3. Cisco, Internetworking Basics, http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/introint.htm
4. Matthew Gast, 802.11 Wireless Networks: The Definitive Guide, O’Reilly, 2005.
5. Wendell Odom, CCNA Official Exam Certification Library, 3rd edition, Cisco Press, 2007.