Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

17
Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim

Transcript of Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Page 1: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Subnetting & CIDR

Tahir Azim

Page 2: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Announcements

• Participate in NASCON, FAST-NU Islamabad• Assignment 1 deadline extended to Tuesday

due to no BIT-7 classes on Monday• From last time:

– Packet bursting: An approach to increasing the speed of 802.11g-based wireless networks by unwrapping short 802.11g packets and rebundling them into a larger packet to reduce the impact of mandatory gaps between packets (jwire.com)

Page 3: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Subnetting

• Subnetting is a form of hierarchical routing.• Subnets are usually represented via an address

plus a subnet mask or “netmask”.• e.g. [email protected] > ifconfig hme0 hme0: flags=863<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST> mtu

1500 inet 171.64.15.82 netmask ffffff00 broadcast 171.64.15.255

• Netmask ffffff00: the first 24 bits are the subnet ID, and the last 8 bits are the host ID.

• Can also be represented by a “prefix + length”, e.g. 171.64.15.0/24, or just 171.64.15/24.

Page 4: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Subnetting

CLASS “B”e.g.

Company

10 Net ID Host-ID

2 14 16

10 Net ID Host-ID

2 14 16

0000

Subnet ID (20) SubnetHost ID (12)

10 Net ID Host-ID

2 14 16

1111

Subnet ID (20) SubnetHost ID (12)

10 Net ID Host-ID

2 14 16

000000

Subnet ID (22) SubnetHost ID (10)

10 Net ID Host-ID

2 14 16

1111011011

Subnet ID (26) SubnetHost ID (6)

e.g. Site

e.g. Dept

Page 5: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Routing in the presence of subnets

• The rest of the Internet is not aware of subnets within a network

• Levels: site, subnet, host

• Routing now involves delivery to the site, then the subnet and finally the host

Page 6: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Example of subnetting

Gates-rtr171.64.74.58

171.64.74.0/24

171.64.1.178

EndHost

border2-rtr

hpr1-rtr

bbr2-rtr

171.64.1.161

171.64.1.160/27171.64.0.0/16AS 32

Class BAddress

171.64.74.1

171.64.1.131To: cenic.net

To: cogentco.com

171.64.1.152

171.64.1.148

171.64.1.133

171.64.1.144/28

171.64.1.132/30

Page 7: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Classless Interdomain Routing (CIDR)Addressing

The IP address space is broken into line segments, or blocks e.g. Block of 2 addresses, block of 128 addresses etc.

Each block is described by a prefix. A prefix is of the form x/y where x indicates the prefix of all addresses

in the block, and y indicates the length of the prefix. e.g. The prefix 128.9/16 represents the block containing addresses in

the range: 128.9.0.0 … 128.9.255.255.

0 232-1

128.9/16

128.9.0.0

216

142.12/19

65/8

128.9.16.14

Page 8: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Classless Interdomain Routing (CIDR)Addressing

0 232-1

128.9/16

128.9.16.14

128.9.16/20128.9.176/20

128.9.19/24

128.9.25/24

Most specific route = “longest matching prefix”

Page 9: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Classless Interdomain Routing (CIDR)Addressing

Prefix aggregation: If a service provider serves two organizations with

prefixes, it can (sometimes) aggregate them to form a shorter prefix. Other routers can refer to this shorter prefix, and so reduce the size of their address table.

E.g. ISP serves 128.9.14.0/24 and 128.9.15.0/24, it can tell other routers to send it all packets belonging to the prefix 128.9.14.0/23.

ISP Choice: In principle, an organization can keep its prefix if it

changes service providers.

Page 10: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Size of the Routing Table at the core of the Internet

Source: http://www.cidr-report.org/

Page 11: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Prefix Length Distribution

Source: Geoff Huston, Jan 2006

0

20000

40000

60000

80000

100000

8 11 14 17 20 23Prefix length (bits)

Num

ber

of

entr

ies

Page 12: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Examples

Page 13: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Finding the first address

• What is the first address in the block if one of the addresses is 167.199.170.82/27?

• Solution: The prefix length is 27, which means that we must keep the first 27 bits as is and change the remaining bits (5) to 0s. The following shows the process:

Address in binary: 10100111 11000111 10101010 01010010 Keep the left 27 bits: 10100111 11000111 10101010 01000000 Result in CIDR notation: 167.199.170.64/27

Page 14: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Finding the first address

• What is the first address in the block if one of the addresses is 140.120.84.24/20?

Page 15: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Finding the last address in the block

• To the first address, add the number of addresses, minus one

• OR

• Set all bits that are not part of the CIDR prefix to 1

Page 16: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Example

• Find the number of addresses in the block if one of the addresses is 140.120.84.24/20.

• Solution: The prefix length is 20. The number of addresses in the block is 232−20 or 212 or 4096. Note that this is a large block with 4096 addresses.

Page 17: Courtesy Nick McKeown (Stanford), Umar Kalim (NIIT) Subnetting & CIDR Tahir Azim.

Courtesy Nick McKeown (Stanford), Umar Kalim

(NIIT)

Example 2

• Find the last address in the block if one of the addresses is 140.120.84.24/20.

• Solution – We found in the previous examples that the first

address is 140.120.80.0/20 and the number of addresses is 4096. To find the last address, we need to add 4095 (4096 − 1) to the first address.

– Or, set all bits that are not part of the CIDR prefix to 1• 140.120.(0101 1111)2. (1111 1111)2 = 140.120.95.255