You are on page 1of 23

IP Addressing and

Routing

Basic IP Addressing

• Each host connected to the Internet


is identified by a unique IP address.
• An IP address is a 32-bit quantity.
¾Expressed as a dotted-decimal notation
W.X.Y.Z.
¾Consists of two logical parts:
ƒ A network number
ƒ A host number
¾This partition defines the IP address
classes.

1
IP Address Classes

• There are five defined IP address


classes.
¾Class A UNICAST
¾Class B UNICAST
¾Class C UNICAST
¾Class D MULTICAST
¾Class E RESERVED
• There are some special-purpose IP
addresses also.
3

Class Address High- Network Host


Range order bits bits bits

A 0.0.0.0 – 0 7 24
127.255.255.255

B 128.0.0.0 – 10 14 16
191.255.255.255

C 192.0.0.0 – 110 21 8
223.255.255.255

D 224.0.0.0 – 1110
239.255.255.255

E 240.0.0.0 – 1111
255.255.255.255

2
Special-Purpose IP Addresses
Address Range Purpose
0.0.0.0 Unknown network,
commonly represents default
10.0.0.0 – Reserved for private use
10.255.255.255
127.0.0.0 – Reserved for loopback / local
127.255.255.255 address
172.16.0.0 – Reserved for private use
172.31.255.255
192.168.0.0 – Reserved for private use
192.168.255.255
255.255.255.255 Limited broadcast

• The class-based addressing is also


known as the classful model.
¾Different network classes lend
themselves to different network
configurations.
¾Different network-to-hosts ratio.

3
Some Conventions

• Within a particular network (Class A, B


or C), the first and last addresses
serve special functions.
¾The first address represents the network
number (for example, 118.0.0.0).
¾The last address represents the directed
broadcast address of the network (for
example, 118.255.255.255).

IP Subnetting

4
IP Subnet

• Basic concept:
¾A subset of a class A, B or C network.
• IP addresses that do not use subnets
consists of
ƒ a network portion, and
ƒ a host portion.
¾Represents a static two-level hierarchical
addressing model.

IP Subnet (contd.)

• IP subnets introduces a third level of


hierarchy.
ƒ a network portion
ƒ a subnet portion
ƒ a host portion
¾Allow more efficient (and structured)
utilization of the addresses.
¾Uses network masks.

10

5
Natural Masks

• Network mask 255.0.0.0 is applied to


a class A network 10.0.0.0.
¾In binary, the mask is a series of
contiguous 1’s followed by a series of
contiguous 0’s.
11111111 00000000 00000000 00000000

Network Host
portion portion
11

Natural Masks (contd.)


• Provide a mechanism to split the IP
address 10.0.0.20 into
¾a network portion of 10, and
¾a host portion of 20.

Decimal Binary
IP address:10.0.0.20 00001010 00000000 00000000 00010100
Mask: 255.0.0.0 11111111 00000000 00000000 00000000
Network Host

12

6
Natural Masks (contd.)

• Class A, B and C addresses


¾Have fixed division of network and host
portions.
¾Can be expressed as masks.
ƒ Called natural masks.
• Natural Masks
¾Class A :: 255.0.0.0
¾Class B :: 255.255.0.0
¾Class C :: 255.255.255.0

13

Creating Subnets using Masks

• Masks are very flexible.


¾Using masks, networks can be divided into
smaller subnets.
• How?
¾By extending the network portion of the
address into the host portion.
• Advantage gained:
¾We can create a large number of subnets
from one network.
¾Can have less number of hosts per network.

14

7
Example: Subnets

• Network mask 255.255.0.0 is applied


to a class A network 10.0.0.0.
¾This divides the IP address 10.5.0.20
into
ƒ a network portion of 10,
ƒ a subnet portion of 5, and
ƒ a host portion of 20.
¾The 255.255.0.0 mask borrows a portion
of the host space, and applies it to
network space.
15

Subnets (contd.)

• What happens?
¾Initially it was a single large Class A
network (224 – 2 hosts).
¾We have now split the network into 256
subnets.
ƒ From 10.0.0.0 to 10.255.0.0.
ƒ The hosts pet subnet decreases to 65,534.

16

8
Subnets (contd.)

Decimal Binary
IP address: 10.5.0.20 00001010 00000101 00000000 00010100
Mask: 255.255.0.0 11111111 11111111 00000000 00000000
Network Subnet Host

17

Default Mask and Subnet mask


Default Mask
IP Address 255.255.0.0
Network Address
144.16.72.57 144.16.0.0
AND

Subnet Mask
255.255.192.0
IP Address Network Address
144.16.72.57 144.16.64.0
AND

192: 1100 0000


72: 0100 1000 18

9
Subnets vrs Multiple Address Classes

• Subnets
¾Management of subnets is done by
local network administrator.
¾Single entry in external router tables.
• Multiple Address Classes
¾Multiple entries in external router tables.
¾Additional overhead on the backbone
(external) routers.

19

Comparison

R R
MULTIPLE
SUBNETS ADDRESS
CLASSES
R R
R R

20

10
Variable Length Subnet Mask
(VLSM)

21

Variable Length Subnet Masks (VLSM)

• Basic concept
¾The same network can be configured
with different masks.
¾Can have subnets of different sizes.
¾Allows better utilization of available
addresses.

22

11
Example: VLSM

• Suppose we are assigned a Class C


network 192.203.17.0.
¾To be divided into three subnets.
ƒ Corresponding to three departments.
ƒ With 110, 45 and 50 hosts respectively.

D1 D2 D3
(110) (45) (50)

23

The Example (contd.)

• Available subnet options


¾The network mask will be the Class C
natural mask 255.255.255.0
¾Subnet masks of the form 255.255.255.X
ƒ Can be used to divide the network
into more subnets.

24

12
The Subnet Options

X X (in No. of No. of


binary) Subnets Hosts
128 1000 0000 2 128
192 1100 0000 4 64
224 1110 0000 8 32
240 1111 0000 16 16
248 1111 1000 32 8
252 1111 1100 64 4

• Cannot satisfy the requirements.


25

The VLSM Option

• Basic concept:
¾Use the mask 255.255.255.128 to divide
the network address into two subnets
with 128 hosts each.
ƒ 192.203.17.0 (.0 to .127)
ƒ 192.203.17.0 (.128 to .255)

26

13
The VLSM Option (contd.)

¾Next subnet the second .128 subnet


using a mask of 255.255.255.192.
ƒ Creates two subnets, 64 hosts each
192.213.17.128 (.128 to .191)
192.213.17.128 (.192 to .255)

27

The VLSM Option (contd.)

192.203.17.0
Mask:
255.255.255.128

192.203.17.0 (.0 to .127) 192.203.17.0 (.128 to .255)

Mask:
255.255.255.192
192.213.17.128 (.128 to .191)

192.213.17.128 (.192 to .255)

28

14
Interface 1 :: 128 hosts
Network number: 192.203.17.0
Network mask: 255.255.255.128
Address: 192.203.17.0 -- .127

Interface 2 :: 64 hosts
Network number: 192.203.17.128
Network mask: 255.255.255.192
Address: 192.203.17.128 -- .191

Interface 3 :: 64 hosts
Network number: 192.203.17.192
Network mask: 255.255.255.192
Address: 192.203.17.192 -- .255
29

128 Hosts

E2

64 Hosts E3 E4
ROUTER 64 Hosts

Interface E2 :: 128 hosts


Network number: 192.203.17.0
Network mask: 255.255.255.128
Address range: 192.203.17.0 − .127

Interface E3 :: 64 hosts Interface E4 :: 64 hosts


Network number: 192.203.17.128 Network number: 192.203.17.192
Network mask: 255.255.255.192 Network mask: 255.255.255.192
Address range: 192.203.17.128 − .191 Address range: 192.203.17.192 − .255

30

15
VLSM :: Current Status

• All routing protocols do not support VLSM.


¾ Routing Information Protocol version 1 (RIP-1) do
not carry network masks in routing updates.
¾ RIP-1 cannot implement VLSM.
• The following protocols support VLSM:
¾ Open Shortest Path First (OSPF)
¾ RIP-2
¾ Enhanced IGRP (EIGRP)

31

Classless Internet Domain Routing


(Supernetting)

32

16
Classless Inter-Domain Routing (CIDR)

• The size of the global routing tables


have grown very fast in recent years.
¾Caused routers to become saturated.
¾Limits to processing power and
available memory.
¾Size of the tables have doubled every 10
months or so, between 1991 and 1995.

33

• Without any remedial measure, the


routing tables would have grown to
about 80,000 routes in 1995.
• But early 2000 data shows that the
size was around 76,000.
• Why this reduction?
¾Planned IP address allocation.
¾CIDR.

34

17
Growth of Internet Routing Tables

80000
70000
60000
50000
40000
30000 Routing Table
Size
20000
10000
0
'88 '94 '96 '98 '00
Year

35

CIDR: Introduction

• CIDR is a new concept to manage IP


networks.
¾Classless Inter Domain Routing.
¾No concept of class A, B, C networks.
¾Reduces sizes of routing tables.

36

18
CIDR: Basic Idea

• An IP address is represented by a
prefix, which is the IP address of the
network.
• It is followed by a slash, followed by
a number M.
¾M: number of leftmost contiguous bits
to be used for the network mask.
¾Example: 144.16.192.57 / 18

37

CIDR: An Important Rule

• The number of addresses in each block


must be a power of 2.
• The beginning address in each block
must be divisible by the number of
addresses in the block.
¾A block that contains 16 addresses cannot
have beginning address as 144.16.223.36.
¾But the address 144.16.192.64 is possible.

38

19
Example: CIDR

• An organization is allotted a block with


beginning address:
144.16.192.24 / 29
What is the range of the block?

Start addr: 10010000 00011000 11000000 00011000


End addr: 10010000 00011000 11000000 00011111

There are 8 addresses in the block.


39

Example

• Suppose Company A needs IP


addresses for 1000 machines
• Assign 4 contiguous Class C address
blocks
¾192.60.128.0
¾192.60.129.0
¾192.60.130.0
¾192.60.131.0
(last 8 bits 0)
40

20
• Supernet:
¾Address : 192.60.128.0
¾Netmask: 255.255.252.0 (last 10 bits 0)
• Also written as:
¾192.60.128.0/22
¾22 denotes size of network portion. Also
called prefix.
¾Routing done by prefix

41

Advantages

• Routing table at higher levels will have


only one entry for the 4 networks.
• In classful addressing (that did not
recognize masks), would have required 4
entries for the 4 networks.
• Possible only due to contiguous
allocation.
¾ Higher level routers can just send it to lower
level routers (in this case company A’s router)
using one entry only.
¾ Lower level router will distinguish.
42

21
• Routing table at all higher level routers:
¾ 192.60.128.0/22 - send to host X (next hop on
way to Company A’s router RA)
• Routing table at RA:
¾ 192.60.128.0/24 – send to router of first net
¾ 192.60.129.0/24 – send to router of second net
¾ 192.60.130.0/24 – send to router of third net
¾ 192.60.131.0/24 – send to router of fourth net

RA

43

• Routers always do longest prefix


match. If two entries match, longest
match is taken.
¾Example:
ƒ two entries in table: one for 192.65.0.0/16
and one for 192.65.128.0/24.
ƒ If address is 192.65.128.4, second entry will
be used even though it matches both.

44

22
Recent Trend

• Move on to CIDR addressing.


¾Existing classful networks can also be
represented using this notation.
ƒ Class A: W.X.Y.Z / 8
ƒ Class B: W.X.Y.Z / 16
ƒ Class C: W.X.Y.Z / 24
• Recent routers support CIDR.

45

23