Download as pdf or txt
Download as pdf or txt
You are on page 1of 49

TCP/IP Addressing

Varun Jain

© Tech Mahindra Limited 2008 Tech Mahindra Limited Confidential


Introduction to TCP/IP Addresses

172.18.0.1 172.16.0.1

172.18.0.2 172.16.0.2
HDR SADA DATA
10.13.0.0 192.168.1.0
10.13.0.1 172.17.0.1 172.17.0.2 192.168.1.1

y An IP address is a logical address (S/W Addr)


y The IP Address of a device should be unique in a network
y It’s a 32 bits number (Combination of Network & Host Bits)
y It allow a host on one network to communicate with a host on a
different network
y Hierarchical addressing

2
IP Addressing

32 bits
Dotted
Decimal Network Host

Maximum 255 255 255 255

•The network address uniquely identifies each network.


Every machine on the same network shares that network
address as part of its IP address

•The host address is assigned to, and uniquely identifies,


each machine on a network. This part of the address must
be unique because it identifies a particular machine—an
individual— as opposed to a network, which is a group.
3
IP Addressing (contd.)

32 bits
Dotted
Decimal Network Host

Maximum 255 255 255 255


1 8 9 16 17 24 25 32

Binary 11111111 11111111 11111111 11111111

128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1

4
IP Addressing (contd.)

32 bits
Dotted
Decimal Network Host

Maximum 255 255 255 255


1 8 9 16 17 24 25 32

Binary 11111111111111111111111111111111

128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
128
64
32
16
128
64
32
16
8
4
2
1

8
4
2
1
Example
Decimal
172 16 122 204
Example10101100 000100000111101011001100
Binary
5
IP Address Classes

8 bits 8 bits 8 bits 8 bits


ƒ Class A:
Network Host Host Host

ƒ Class B: Network Network Host Host

ƒ Class C: Network Network Network Host

ƒ Class D: Multicast

ƒ Class E: Research

6
IP Address Classes (contd.)

Bits: 1 8 9 16 17 24 25 32
0NNNNNNN Host Host Host
Class A:
Range (1-126)

Bits: 1 8 9 16 17 24 25 32
10NNNNNN Network Host Host
Class B:
Range (128-191)
1 8 9 16 17 24 25 32
Bits:
110NNNNN Network Network Host
Class C:
Range (192-223)
1 8 9 16 17 24 25 32
Bits:
1110MMMM Multicast
Multicast Group
Group Multicast
Multicast Group
Group Multicast
Multicast Group
Group
Class D:
Range (224-239)
7
Host Addresses

172.16.2.1 10.1.1.1
10.6.24.2
E1
172.16.3.10 E0 10.250.8.11
172.16.2.1

172.16.12.12 10.180.30.118

Routing Table
Network Interface
172.16.0.0 E0
172.16 . 12 . 12
10.0.0.0 E1
Network Host
8
Determining Available Host Addresses

Network Host
172 16 0 0
N

16
15
14
13
12
11
10

8
7
6
5
4
3
2
1
9
10101100 00010000 00000000 00000000 1
00000000 00000001 2
00000000 00000011 3
...

...

...
11111111 11111101 65534
11111111 11111110 65535
11111111 11111111 65536
- 2
2N-2 = 216-2 = 65534 65534
9
Private IP Addresses
Address Class Reserved address space
=======================================================
ƒ Class A 10.0.0.0 through 10.255.255.255

ƒ Class B 172.16.0.0 through 172.31.255.255

ƒ Class C 192.168.0.0 through 192.168.255.255

10
Decimal Equivalent Of Patterns

128 64 32 16 8 4 2 1

1 0 0 0 0 0 0 0 = 128
1 1 0 0 0 0 0 0 = 192
1 1 1 0 0 0 0 0 = 224
1 1 1 1 0 0 0 0 = 240
1 1 1 1 1 0 0 0 = 248
1 1 1 1 1 1 0 0 = 252
1 1 1 1 1 1 1 0 = 254
1 1 1 1 1 1 1 1 = 255

11
Addressing without Subnets

172.16.0.1 172.16.0.2 172.16.0.3 172.16.255.253 172.16.255.254

…...

172.16.0.0

ƒ Network 172.16.0.0
12
Addressing with Subnets

172.16.3.0

172.16.4.0

172.16.1.0 172.16.2.0

ƒ Network 172.16.0.0
13
How to create Subnets

ƒ To create sub-networks, bits should be borrowed form the host


portion of the IP address.
ƒ Minimum numbers of Host Bits borrowed: 2
ƒ Maximum number of Host Bits borrowed:
Host Bits - Borrowed Bits >= 2
ƒ The slash notation (/) means how many bits are turned on (1s).
ƒ The largest subnet mask available (regardless of the class of
address) can only be a /30 because there need at least 2 bits for
host bits

14
Subnet Mask

ƒ Subnet mask: A subnet mask is a 32-bit value that


allows the recipient of IP packets to distinguish the
network ID portion of the IP address from the host ID
portion of the IP address
ƒ Default Subnet Mask
Class Format Default Subnet Mask
A network.node.node.node 255.0.0.0
B network.network.node.node 255.255.0.0
C network.network.network.node 255.255.255.0

15
Subnet Mask (contd.)

Network Host

IP
Address
172 16 0 0
Network Host
Default
Subnet
Mask
255 255 0 0
11111111 11111111 00000000 00000000
Also written as “/16” where 16 represents the number of 1s
in the mask.
Network Subnet Host
8-bit
Subnet 255 255 255 0
Mask
Also written as “/24” where 24 represents the number of 1s
in the mask.
16
Subnet Addressing

172.16.2.200 172.16.3.5
172.16.3.1
E1
172.16.2.2 E0 172.16.3.100
172.16.2.1

172.16.2.160 172.16.3.150

New Routing Table


Network Interface
172.16.0.0 E0
172.16 . 2 . 160
Network Host 172.16.0.0 E1

17
Subnet Addressing (contd.)

172.16.2.200 172.16.3.5
172.16.3.1
E1
172.16.2.2 E0 172.16.3.100
172.16.2.1

172.16.2.160 172.16.3.150

New Routing Table


Network Interface

172.16 . 2 . 160 172.16.2.0 E0


Network Subnet Host 172.16.3.0 E1

18
Subnet Basics

ƒ How many subnets? 2^x – 2 = number of subnets. x is the


number of masked bits, or the 1s.
ƒ How many hosts per subnet? 2^y – 2 = number of hosts per
subnet. y is the number of unmasked bits, or the 0s.
ƒ What are the valid subnets? 256 – subnet mask = block size, or
base number.
ƒ What’s the broadcast address for each subnet? The broadcast
address is the number immediately preceding the next subnet.
ƒ What are the valid hosts? Valid hosts are the numbers between
the subnets, omitting all 0s and all 1s.

19
Subnet Mask Exercise

Class C Address: 192.168.10.0/27


•Network address = ?
•Subnet mask =?
•How many subnets=?
•How many hosts per subnet=?
•What are the valid subnets?
•What’s the broadcast address for each subnet?
• What are the valid hosts?

20
Subnet Mask Exercise (contd.)

Class C Address: 192.168.10.0/27


ƒ Network address = 192.168.10.0
ƒ Subnet mask = 255.255.255.224

21
Subnet Mask Exercise (contd.)

Class C Address: 192.168.10.0/27


ƒ Network address = 192.168.10.0
ƒ Subnet mask = 255.255.255.224
ƒ How many subnets? 2^3 – 2 = 6.
ƒ How many hosts? 2^5 – 2 = 30.

22
Subnet Mask Exercise (contd.)

ƒ What are the valid subnets?


y 256 – 224 = 32.
y 32 + 32 = 64. 64 + 32 = 96. 96 + 32 = 128. 128 + 32 = 160. 160 + 32 =
192. 192 + 32 = 224, which is invalid because it is our subnet mask (all
subnet bits on). Our subnets are 32, 64, 96, 128, 160, and 192.
ƒ What’s the broadcast address for each subnet (always the number
right before the next subnet)?
ƒ What are the valid hosts (the numbers between the subnet number
and the broadcast address)?
The subnet address 32 64 96 128 160 192
The first valid host 33 65 97 129 161 193
The last valid host 62 94 126 158 190 222
The broadcast address 63 95 127 159 191 223

23
Class C Subnet Planning example

IP Host Address: 192.168.5.121


Subnet Mask: 255.255.255.248
Network Network Network Subnet Host

192.168.5.121: 11000000 10101000 00000101 01111001


255.255.255.248: 11111111 11111111 11111111 11111000

Subnet: 11000000 10101000 00000101 01111000


Broadcast: 11000000 10101000 00000101 01111111

ƒ Subnet Address = 192.168.5.120


ƒ Host Addresses = 192.168.5.121–192.168.5.126
ƒ Broadcast Address = 192.168.5.127
ƒ Five Bits of Subnetting

24
Class B Subnet Planning example

IP Host Address: 172.16.2.121


Subnet Mask: 255.255.255.0
Network Network Subnet Host

172.16.2.121: 10101100 00010000 00000010 01111001


255.255.255.0: 11111111 11111111 11111111 00000000

Subnet: 10101100 00010000 00000010 00000000


Broadcast: 10101100 00010000 00000010 11111111

ƒ Subnet Address = 172.16.2.0


ƒ Host Addresses = 172.16.2.1–172.16.2.254
ƒ Broadcast Address = 172.16.2.255
ƒ Eight bits of subnetting

25
Subnet Planning

20
20 subnets
subnets
55 hosts
hosts per
per subnet
subnet
Class
Class C
C address:
address:
192.168.5.0
192.168.5.0

192.168.5.16
Other
subnets

192.168.5.32 192.168.5.48

26
Broadcast Address Exercise

Address Subnet Mask Class Subnet Broadcast

201.222.10.60 255.255.255.248

15.16.193.6 255.255.248.0

128.16.32.13 255.255.255.252

153.50.6.27 255.255.255.128

27
Broadcast Address Exercise Answers

Address Subnet Mask Class Subnet Broadcast

201.222.10.60 255.255.255.248 C 201.222.10.56 201.222.10.63


15.16.193.6 255.255.248.0 A 15.16.192.0 15.16.199.255

128.16.32.13 255.255.255.252 B 128.16.32.12 128.16.32.15

153.50.6.27 255.255.255.128 B 153.50.6.0 153.50.6.127

28
Variable Length Subnet Masking

ƒ VLSM, defined in RFC 1812, allows you to apply different subnet


masks to the same class address.
For instance, a good mask for
- point-to-point links might be 255.255.255.252
- LAN connection might be 255.255.255.192
VLSM solves the problem of address space wastage by enabling you
to use different subnet mask values on the same class address space.

Two major advantages:


ƒ More efficient use of addressing
ƒ Ability to perform route summarization

29
192.168.1.64 / 26

192.168.1.0 / 26

192.168.1.192 / 26
192.168.1.128 / 26
Before VLSM

192.168.2.0 / 26 192.168.2.64 / 26

192.168.1.0 / 26
192.168.1.192 / 30

192.168.1.64 / 26
192.168.1.196 / 30
After VLSM

192.168.1.200 / 30 192.168.1.128 / 26

30
Addressing with VLSM

VLSM basically means taking a subnet (not a network number) and


applying a different subnet mask to it.
This section covers how to create an efficient addressing scheme using
VLSM.
There are certain steps that you should follow when performing VLSM:
1. Find the largest segment in the area—the segment with the largest
number of devices connected to it.
2. Find the appropriate subnet mask for the largest network segment.
3. Write down your subnet numbers to fit your subnet mask.
4. For your smaller segments, take one of these newly created subnets
and apply a different, more appropriate, subnet mask to it.
5. Write down your newly subnetted subnets.
6. For even smaller segments, go back to step 4.
Actually, you can take a subnetted subnet and subnet it again!
With this process,you can come up with a very efficient
addressing scheme.

31
Example

30 hosts

30 hosts
Point - to - point

30 hosts

30 hosts

192.168.2.0 / 24 30 hosts

32
Solution

192.168.2.0 / 27

0
/3
60
.1 192.168.2.32 / 27
8 .2
Point - to - point
. 16
2 / 30
19 1 64
.
8.2
.16
192
192.168.2.168 / 30 192.168.2.64 / 27

192
.16
8.2
.17
2/
30 192.168.2.96 / 27
19
2.
16
8.
2.
17
6
/3
0

192.168.2.128 / 27

33
Route Summarization

ƒ Route summarization is the ability to take a bunch of contiguous


network numbers in your routing table and advertise these
contiguous routes as a single summarized route.
ƒ VLSM allows you to summarize subnetted routes back to the class
boundary.
ƒ Summarization is a form of VLSM.

192.168.1.0 / 26

192.168.1.64 / 26 Advertised
summarized
route:
192.168.1.128 / 26
192.168.1.0 /24
192.168.1.192 / 26

34
Advantages of Summarization

Summarization allows you to create a more efficient routing


environment by providing the following advantages:
ƒ It reduces the size of routing tables, requiring less memory and
processing.
ƒ It reduces the size of updates, requiring less bandwidth.
ƒ It contains network problems.
Advantageous in the case of Flapping routes.

Down-side: The route summarization hides the complete picture of


the network. The route updates with the summarized route keeps
going even though the network is down.

35
Classless Inter-domain Routing
(CIDR)

Classless Interdomain Routing (CIDR), specified in RFC 2050, is an


extension to VLSM and route summarization.
ƒ With VLSM, you can summarize subnets back to the Class A, B, or C
network boundary.
For example, if you have a Class C network 192.168.1.0/24 and
subnet it with a 26-bit mask, you have created four subnets. Using
VLSM and summarization, you can summarize these four subnets
back to 192.168.1.0/24.
ƒ CIDR takes this one step further and allows you to summarize a block
of contiguous class A, B, and C network numbers. This practice is
commonly referred to as supernetting.

36
CIDR Example

192.168.0.0 / 24

192.168.1.0 / 24

192.168.0.0 / 22

192.168.2.0 / 24

192.168.3.0 / 24

37
Hierarchical Addressing

In order to perform route summarization, you will need to set up your


addressing in a hierarchical fashion. Hierarchical addressing provides the
following benefits:
ƒ It enables more efficient routing.
ƒ It uses route summarization to decrease the size of routing tables.
ƒ It decreases the amount of memory needed to store the smaller routing
tables.
ƒ It decreases the impact on the router when needing to rebuild the routing
table.
ƒ It provides a design to simplify your troubleshooting process.
To take advantage of route summarization the protocols should be capable of
using VLSM: (ex : BGP, EIGRP, IS-IS, OSPF, RIP V2 )
• The routing protocol must carry the subnet mask with the corresponding network
entries.
• Routing decisions must be made on the entire destination IP address.
• In order to summarized routing entries, they must have the same highest-order
matching bits.

38
Simple Hierarchical Addressing Example

Summarized route leaving AS


10.0.0.0 / 8

Campus 2 Campus 3
Campus 1
10.2.0.0 / 16 10.3.0.0 / 16
10.1.0.0 / 16

Bldg 1 Bldg 2 Bldg 1 Bldg 2 Bldg 1 Bldg 2


10.1.1.0 /24 10.1.2.0 /24 10.2.1.0 /24 10.2.2.0 /24 10.3.1.0 /24 10.3.2.0 /24

39
Routing and Subnet Masks

ƒ Classfull versus Classless protocols and routing updates

CLASSFULL
172.16.0.0 / 16

172.16.1.0 / 24 192.168.1.0 / 24 192.168.2.0 / 24

CLASSLESS
172.16.1.0 / 24

172.16.1.0 / 24 192.168.1.0 / 24 192.168.2.0 / 24

40
Discontiguous Subnets

Router C

CLASSFULL

172.16.0.0 / 16 172.16.0.0 / 16

172.16.1.0 / 24 192.168.1.0 / 24 172.16.2.0 / 24


Router A Router B

Router C

CLASSLESS

172.16.1.0 / 24 172.16.2.0 / 24

172.16.1.0 / 24 192.168.1.0 / 24 172.16.2.0 / 24


Router A Router B

41
Performance Summarization

In order to summarize routing entries, they must have the same


highest-order matching bits.

In other words, you can perform summarization when the network


numbers in question are a power-of-2 and start on a network
boundary that is either a power-of-2 or a multiple of a power-of-2.

Example: Class C subnets: 192.168.1.0/30 and 192.168.1.4/30.


These networks contain a total of eight addresses and start on a
power-of-2 boundary: 0. Therefore, you could summarize these as
192.168.1.0/29, which encompasses addresses from 192.168.1.0
through 192.168.1.7.

42
Route Summarization

192.168.5.208 /28
192.168.5.112 /28

C
192.168.5.32 /28
192.168.5.48 /28 192.168.5.96 /28
192.168.5.128 /28
192.168.5.144 /28 192.168.5.192 /28
192.168.5.176 /28
192.168.5.160 /28 A

192.168.5.64 /28

192.168.5.80 /28

43
B

192.168.5.208 /28
192.168.5.112 /28

C
192.168.5.32 /28
192.168.5.48 /28 192.168.5.96 /28
192.168.5.128 /28
192.168.5.144 /28 192.168.5.192 /28
192.168.5.176 /28
192.168.5.160 /28 A

192.168.5.64 /28

192.168.5.80 /28

192.168.5.64/26 This covers addresses 64–127, which are to the right of Router A.
192.168.5.192/27 This covers addresses 192–223, which are also to the right of Router A.
44
Summary

y There are five classes of IP addresses:


à A (1-126), B (128-191), C (192-223), D (224-239), and E (240-
254).
y Class A addresses have one network byte and three host bytes.
y Class B addresses have two network and two host bytes.
y Class C addresses have three network bytes and one host byte.

y Private IP addresses include networks


à 10.0.0.0/8, 172.16.0.0/16-172.31.0.0/16, and 192.168.0.0/24-
192.168.255.0/24.

y IP addresses are of three types : network, host, and broadcast.


à The very first number in a network is the network, or wire
number.
à The very last address is the broadcast address of the network.
à Any addresses between the network and broadcast addresses
are host addresses.

45
Summary

y VLSM allows you to have more than one subnet mask applied to the
same class address.
y VLSM’s advantages include more efficient use of addressing and route
summarization. Only classless protocols such as RIPv2, EIGRP, OSPF,
IS-IS, and BGP support VLSM.
y Route summarization is the ability to take a group of contiguous entries
in your routing table and advertise these entries as a single summarized
entry.
y CIDR is s special type of route summarization. CIDR allows you to
summarize a group of contiguous class network numbers.
y Summarization can be achieved only by laying out hierarchical
addresses in your network.
y It decreases routing table sizes, the amount of memory for routing, the
number of processing cycles required, and difficulties with
troubleshooting.
y When implementing route summarization, note that the routing protocol
must carry the subnet mask along with the routing entry: Only classless
protocols allow this process.

46
Questions

1. You have this binary value: 11000001. This equates to _________ in


decimal.
2. A Class A address has _________ host bits.
A. 8 B. 16 C. 20 D. 24
3. 172.16.240.256 is a class __________ address.
A. A B. B C. C D. None of the above
4. Which of the following is a valid subnet mask value?
A. 255.0.255.255 B. 0.0.0.255 C. 255.255.254.0 D.
255.255.255.256
E. 255.255.255.247

5. The function of a _________ is to differentiate between the network


address, the host addresses, and the directed broadcast address.

6. You are given a Class C network with 25 bits of networking. How many
subnets do you have?
A. 1 B. 2 C. 3 D. 4

47
7. You are given a Class C network with a subnet mask of 255.255.255.248.
How many host addresses are there on each subnet?
A. 4 B. 6 C. 8 D. 14
8. You are given a Class B network with a subnet mask of 255.255.255.192.
How many host addresses are there on each subnet?
A. 30 B. 62 C. 126 D. 254
9. You are given the following addressing information: 192.168.37.192/25.
What type of address is this?
A. Network B. Directed Broadcast C. Host
10. You are given the following addressing information: 10.0.8.0/22. What
type of address is this?
A. Network B. Directed Broadcast C. Host
11. VLSM allows you to summarize 192.168.2.0/24 and 192.168.3.0/24 as
192.168.2.0/25.
A. True B. False
12. VLSM allows a network segment to have more than one subnet mask.
A. True B. False

48
13. Which protocol supports VLSM?
A. RIP B. IGRP C. RIP and IGRP D. None of these
14. You are given a Class C network, 192.168.1.0/24. You need one network
with 120 hosts and two networks with 60 hosts. How many subnet masks do
you need?
A. 1 B. 2 C. 3 D. 4
15. You are given a class C network, 192.168.1.0/24. You need one network
with 120 hosts and three networks with 60 hosts. What subnet mask values
would you use?
A. 255.255.255.128 and 255.255.255.192
B. 255.255.255.128
C. 255.255.255.192
D. None of these
16. You are given a class C network, 192.168.1.0/24. You need three
networks with 60 hosts and two networks with 30 hosts. What are the subnet
mask values you could use?
A. 255.255.255.240 and 255.255.255.192
B. 255.255.255.224 and 255.255.255.240
C. 255.255.255.192 and 255.255.255.224
D. None of these
17. You are given this address space: 172.16.5.0/25. You need one network
with 64 hosts and two with 30 hosts. What are the most specific subnet mask
values to use?
A. /25 and /26 B. /26 and /27 C. /27 and /28 D. None of these

49

You might also like