Sub Netting and Routing
Sub Netting and Routing
IP Addressing
IP addressing
Introduction to IP addressing Classes of IP addressing Why Subnet Masks are necessary? How to create subnet masks
How do IP addresses make it possible for data sent via the Internet to find its destination?
It is because each network connected to the Internet has a unique network number. To ensure that each network number on the Internet will always be unique and unlike that of any other number, an organization called the International Network Information Center, or InterNIC
10
11
IP addressing
Classes of Networks
1 Byte Class A: Class B: Class C: 1 Byte 1 Byte 1 Byte
N N N
H N N
H H N
H H H
IP addressing
IP Address Bit Patterns
Bit # Class A: 1 2-8 9 32 (24 bits)
Network # 16 24
Host #
32
Class A address range 1.0.0.0 126.0.0.0 (127.0.0.0 is for loopback) Private Class A address: 10.0.0.0 Number of hosts: 224 -2 = 16,777,214
Subnet & Routing 14
IP addressing
IP Address Bit Patterns
Bit # Class B: 1 2 3 - 16 17 32 (16 bits)
Network #
Host #
16
24
32
Class B address range 128.0.0.0 191.255.0.0 Private Class B : 172.16.0.0 172.31.0.0 Number of hosts: 216 - 2 = 65,534
Subnet & Routing 15
IP addressing
IP Address Bit Patterns
Bit # Class C: 1 2 3 4 - 24 25 32 (8 bits)
0 Network #
Host #
16
24
32
Class C address range 192.0.0.0 233.255.255.0 Private Class C : 192.168.0.0 Number of hosts: 28 - 2 = 254
Subnet & Routing 16
17
18
What IP addresses are reserved for multicast purposes and experimental purposes?
The highest number listed was 223. You may have wondered why the highest value was only 223 and not 255, since there are 255 possible values for an octet. in IP addresses the values 224 through 255 are not used in the first octet for networking purposes.
Subnet & Routing 19
20
21
22
23
24
115 0 0
& =
10000011 10110101 01110011 0000000 11111111 11111111 0 Subnet & Routing 0000000 10000011 10110101
IP addressing Subnetting
Subnetting
Is the act of borrowing bits from the host portion to create smaller networks (called subnetworks) Minimum bits that can be borrowed is 2 why? Subnetting is used to reduce the number of broadcast domains Communication between these subnetworks is achieved through a router
Subnet & Routing 26
27
30
31
How many bits can be borrowed from the host number in class "B" and class "C" networks to create subnets?
Because there are only two octets in the host field of a class "B network, up to fourteen bits can be borrowed to create subnetworks. A class "C" network has only one octet in the host field. Therefore, only up to six bits can be borrowed in class "C networks to create subnetworks.
32
What happens to the subnet mask address if only some of the bits in an octet are borrowed?
Imagine that you have a class "B network. This time however, instead of borrowing all eight bits of the third octet, only seven bits are borrowed to create subnetworks. Using binary representation, in this example, the subnet mask would be 11111111.11111111.11111110.00000000. Therefore, 255.255.255.0 can no longer be used as the subnet mask.
33
If only seven bits are borrowed in a class "B" network, what would the subnet mask be in dotted decimal notation?
HINT: To convert any eight bit binary number into a decimal number, total the powers of 2 that occur in the number.
34
What determines how many subnetworks can be created by borrowing bits from the host field?
Can you figure out all of the possible combinations of 0s and 1s if four bits are borrowed from the host field to create subnetworks? 16 from 0000 to 1111. However, you know that 1111 is reserved for broadcast and 0000 means this network.
35
How many subnetworks can be created by borrowing five bits from the host field? Answer: Thirty-two subnetworks or 25 =32 subnetworks can be created by borrowing five bits from the host field.
36
37
For IP address 197.15.22.160 on the same class "C network. How would this be expressed in a binary numbering scheme?
Answer: If 197.15.22.160 is converted to binary format, it becomes 110001010.00001111.00010110. 10100000. The first three bits in the last octet, 101, indicate that this is the sixth subnetwork. As before the remaining bits are all binary 0s. This means that the IP address197.15.22.160 must be one that is reserved for a subnetwork address.
Subnet & Routing 38
Subnet mask
How do we determine how many bits to borrow for a subnet? Determine the number of sub networks required Work from the MOST significant (LHS) bits of the first octet after the network number and calculate the number of bits needed to create the required number of subnetworks
Subnet & Routing 39
Subnet mask
Example: You are given a class B address and you are required to create 1000 subnetworks. By working from the LHS of the (first octet after the network number) 3rd octet, calculate the number of bits to equal or slightly exceed 1000. (ie 2x = > 1000) This would equate to 210 or 1024-2 networks Hence you will need to borrow 10 bits from the host portion to create 1000 subnetworks
40
Subnet mask
Example:
The subnetmask in this instance would be 10 Bits Borrowed 6 bits left 255.255.255.192 Natural Class B netmask for hosts
(subnetmask)
11111111
11111111
11111111
11 000000
How many host per network can you obtain from this addressing scheme?
Subnet & Routing 41
Subnet mask
How do we determine how many bits to borrow for a subnet given the number of hosts required? Determine the number of hosts required Work from the LEAST significant (RHS) bits of the last octet and calculate the number of bits needed to create the required number of subnetworks
42
Subnet mask
Example: You are given a class B address and you require 1000 nodes per subnet By working from the RHS (last octet) of the 4th octet, calculate the number of bits to equal or slightly exceed 1000. (ie 2x = > 1000) This would equate to 210 or 1024-2 networks Hence you will need to borrow 6 bits from the host portion to create subnetworks with 1000 hosts each
43
Subnet mask
Example: The subnetmask in this instance would be 255.255.252.0 6 Bits Borrowed 10 bits required
Natural Class B netmask
(subnetmask)
for hosts
11111111 11111111 111111 00 00000000 How many subnetworks per network can you obtain from this addressing scheme? Note: Do you recognise this address as the student supernet address? Subnet & Routing 44
For example
Company A has about 1000 nodes to address. A class B address would be too big (or may not be available). Solution Supernetting using 4 contiguous class C addresses 203.10.112.0 203.10.113.0 203.10.114.0 203.10.115.0 (All netmasked to 255.255.255.0) Subnet & Routing
45
46
Host portion
011100 00 011100 01 011100 10 011100 11 111111 00 0000000 0 0000000 0 0000000 0 1111111 1 0000000 0
47
1100101 00001010 1 1100101 00001010 1 1100101 00001010 1 1100101 00001010 1 1111111 11111111 1
49
50
131 & =
Network Address
11[2,3,4,5]
x 255 Host ID
0000000 0 xxxxxxx x 51 1111111 1
131 131
115 SN + H
SN
011100 00
Network Portion
1000001 10110101 1
Host portion
Host
Broadcast Address
Network Address
VS
Broadcast address
Remember A Network address has all the host bits set to 0 A Broadcast address has all the host bits set to 1 Therefore
131.181.112.0 is the network address 131.181.115.255 is the broadcast address Subnet & Routing 53
Network Address
VS
Broadcast address
This is important when you are doing ifconfig and routing commands For example, if a host has an address 131.181.114.10/22
The ifconfig & route commands would be
ifconfig eth<x> inet 131.181.114.10 netmask 255.255.252.0 broadcast 131.181.115.255 route add net 131.181.112.0 netmask 255.255.252.0 dev eth<x>
Subnet & Routing 54
SN Host portion
0110 0100 1111 0000 0110 0000 0110 1111
0000000 10101000 0
59
The number of allowable networks [24]16 - 2 = 14 ( ie 4 bits used. If a class B address with the last bit subnet, then add another 8 bits to give you 212 2 allowable subnet)
60
62
63
64
65
when the router performs this ANDing" operation, the host portion falls through.
66
The router looks at what is left which is the network number including the subnetwork.
67
The router then looks in its routing table and tries to match the network number including the subnet with an interface.
68
How does the "Anding operation change with different subnet masks?
Imagine that you have a class "B network with the network number 172.16.0.0. After assessing the needs of his network, the network administrator has decided to borrow eight bits in order to create subnetworks. When eight bits are borrowed to create subnets, the subnet mask is 255.255.255.0. Someone outside the network sends data to the IP address 172.16.2.120.
69
70
71
Exercise
Exercise
You are given an IP address for a host 172.168.35.10/20
72
Exercise
Exercise
Your organisation has been assigned a class B IP address of 130.10.0.0 You require about 2000 subnetworks
ROUTING
Routing
Routing describes a process where packets are forwarded from one network to another. Routing can be performed by devices such as :
dedicated routers servers with more than one network interface: multihomed hosts switches incorporating a route function. 75 Subnet & Routing
Routers
Routing devices typically have more than one network interface, each called a port. Routers process datagrams individually, making routing a processing-intensive operation. Dedicated routers offer better performance characteristics compared with multi-homed hosts. Subnet & Routing
76
Routing Tables
To determining the proper destination network for datagrams, routers consult an internal table. The table consists of records, one per line, each representing a known network. Each record includes a set of associated characteristics such as netmask Subnet & Routing
77
78
Configuring Routers
Before IP routers can perform the route function and use routing protocols to exchange route tables, each interface (port) must be correctly numbered with a valid host IP address and netmask. The IP address must be selected from within the range for the particular network address. Typically local gateways are located the first address in the valid host range.
Subnet & Routing 79
Routing Protocols
Routing protocols are used by routers to: learn the location of destination networks. determine the best route to reach networks. Examples of routing protocols include: RIP, Routing Information Protocol OSPF, Open Shortest Path First BGP, Border Gateway Protocol
80
Routing Protocols - 2
Routing protocols differ in:
the way in which they exchange route tables determine the route to the destination the information that is communicated
81
Distance Vector
Distance Vector routing protocols broadcast the entire route table on a regular basis. RIP2 typically defaults at once every 30 seconds.This creates considerable network traffic. They determine the best route path on the basis of the least number number of hops to reach a destination network.& Routing Subnet 82
Link State
Link state protocols only broadcast changes to route information after an initial entire table has been sent. When determining the best path, other factors such as policies (e.g. preferred path) and cost ( time taken, available bandwidth) can influence the choice when multiple paths are available. & Routing Subnet
83
IP Routing
Before a routing device can forward an IP datagram it must:
examine the Destination Address in the datagram use the netmask to identify the network portion of the packets destination address find a corresponding network address in the route table and forward the packet to the gateway or interface specified
Subnet & Routing 84
85
Destination
This field lists the networks which are known to the router. Addresses may have been entered by an administrator, or dynamically learned from the transmissions of other routers. Address entries concerned with routing between network addresses will be of the format {<netid>, 0}
Subnet & Routing 86
Netmask
The netmask field provides the router with the ability to determine the network address of packets being examined. A logical AND is performed using the netmask and the destination address. This logically removes the host portion allowing the router to identify the destination Subnet & Routing 87
Gateway
The Gateway field lists the IP addresses of the interface where the datagram should be sent (forwarded) to reach the specified Destination. This field may contain :
An IP interface address corresponding to an adjacent router 0.0.0.0 The address of a interface
Subnet & Routing 88
Destination Hop=0.0.0.0
A Destination of 0.0.0.0 indicates a directly connected network. Hosts located on this network can be reached using the local network method. If the network is Ethernet, the ARP protocol is used to find the physical address of the node.
Subnet & Routing 89