IP Addressing and Subnetting
High Performance Switching and Routing
Telecom Center Workshop: Sept 4, 1997.
Topic
IP Addressing Subnetting
IP Addresses
32 bits
version (4 bits) header length Type of Service/TOS (8 bits) flags (3 bits) Total Length (in bytes) (16 bits) Fragment Offset (13 bits) Header Checksum (16 bits) Identification (16 bits) TTL Time-to-Live (8 bits) Protocol (8 bits)
Source IP address (32 bits) Destination IP address (32 bits)
Ethernet Header
IP Header
TCP Header
Application data
Ethernet Trailer
Ethernet frame
3
IP Addresses
32 bits
0x4 0x5 9d08 12810 0x06 128.143.137.144 128.143.71.21 0x00 0102 4410 00000000000002 8bff
Ethernet Header
IP Header
TCP Header
Application data
Ethernet Trailer
Ethernet frame
4
Hosts, Networks, and Routers
Host 7
Host 1
Network A
Host 2 Host 1 Router Network B
Network C
Unique IP Address = Network Number + Host Number Host 12 Host 2
5
The Most Common Routing Protocols
BGP RIP
Cisco proprietary
TCP
UDP
OSPF IS-IS EIGRP (and ICMP)
IP
Routing protocols exchange network reachability information between routers.
6
Classful Addresses
Class A
0nnnnnnn hhhhhhhh hhhhhhhh hhhhhhhh
10nnnnnn nnnnnnnn hhhhhhhh hhhhhhhh 110nnnnn nnnnnnnn nnnnnnnn hhhhhhhh
Class B
Class C
n = network address bit
h = host identifier bit
7
The Classful Address Space
Class A B C Networks Hosts 127 Share of IP address space 16,777,214 1/2 1/4 1/8
16,384 65,534 2,097,152 254
Leads to very inefficient allocation of addresses
Subnets
The idea is to share the same IP network number among multiple subnets Subnets of a network should reside in the same general locale (e.g., college campus, corporate location, ) Routers on an IP network know their local subnets Remote routers need to know only the network address
9
Subnetting
Problem: Organizations have multiple networks which are independently managed
University Network
Engineering School Library Medical School
Solution 1: Allocate a separate network address for each network
Difficult to manage From the outside of the organization, each network must be addressable.
Solution 2: Add another level of hierarchy to the IP addressing structure
Subnetting
10
Address assignment with subnetting
Each part of the organization is allocated a range of IP addresses (subnets or subnetworks) Addresses in each subnet can be administered locally
128.143.0.0/16
University Network
128.143.71.0/24 128.143.136.0/24
Engineering School
Medical School
128.143.56.0/24
Library
128.143.121.0/24
11
Basic Idea of Subnetting
Split the host number portion of an IP address into a subnet number and a (smaller) host number. Result is a 3-layer hierarchy network prefix host number
network prefix
subnet number
host number
Then:
extended network prefix
Subnets can be freely assigned within the organization Internally, subnets are treated as separate networks Subnet structure is not visible outside the organization
12
Subnetmask
Routers and hosts use an extended network prefix (subnetmask) to identify the start of the host numbers
128.143
network prefix
137.144
host number
128.143
network prefix extended network prefix
137
subnet number
144
host number
1111111111111111 1111111100000000 subnetmask
13
Advantages of Subnetting
With subnetting, IP addresses use a 3-layer hierarchy:
Network Subnet Host
Reduces router complexity. Since external routers do not know about subnetting, the complexity of routing tables at external routers is reduced.
Note: Length of the subnet mask need not be identical at all subnetworks.
14
No Subnetting
All hosts think that the other hosts are on the same network
128.143.137.32/16
subnetmask: 255.255.0.0
128.143.137.144/16 subnetmask: 255.255.0.0
128.143.71.21/16 subnetmask: 255.255.0.0
128.143.71.201/16
subnetmask: 255.255.0.0
128.143.70.0/16
15
With Subnetting
Hosts with same extended network prefix belong to the same network
128.143.137.32/24 128.143.137.144/24
subnetmask: 255.255.255.0
128.143.71.21/24
subnetmask: 255.255.255.0
128.143.71.201/24
subnetmask: 255.255.255.0
subnetmask: 255.255.255.0
128.143.137.0/24 Subnet 128.143.0.0/16
128.143.71.0/24 Subnet
16
With Subnetting
Different subnetmasks lead to different views of the size of the scope of the network
128.143.137.32/26 128.143.137.144/26 128.143.71.21/24
subnetmask: 255.255.255.0
128.143.71.201/16
subnetmask: 255.255.0.0
subnetmask: 255.255.255.192 subnetmask: 255.255.255.192
128.143.137.0/26 Subnet
128.143.137.128/26 Subnet
128.143.71.0/24 Subnet
128.143.0.0/16
17
Optimizing the Allocation of IP Addresses
After Subnetting Before After Supernetting: Supernetting:
220.78.168.0 220.78.168.64 220.78.168.128 220.78.168.192
220.78.168.0
220.78.169.0 220.78.170.0
220.78.169.0
220.78.168.0 220.78.169.0 220.78.170.0 220.78.168.0 220.78.171.0 220.78.172.0 220.78.173.0 220.78.174.0 220.78.175.0
Routing Routing Table Table for for Router Router BB 220.78.168.0 255.255.255.0 220.78.168.1 Routing Table for Router B
255.255.255.0 255.255.255.0 255.255.255.0 255.255.255.0 255.255.255.0 255.255.255.0 255.255.255.0 255.255.255.0 220.78.168.1 220.78.168.1 220.78.168.1 220.78.168.1 220.78.168.1 220.78.168.1 220.78.168.1 220.78.168.1
220.78.171.0 220.78.168.0 220.78.169.64
220.78.169.128
220.78.169.192
220.78.172.0
220.78.173.0 220.78.174.0 220.78.170.0 220.78.175.0 220.78.170.64
Router Router A Route A rA
Router B Router B Router B
18
END.
19