subnet & classless address extensions linda wu (cmpt 471 2003-3)

33
Subnet & Classless Address Extensions Linda Wu (CMPT 471 • 2003-3)

Upload: kerry-simmons

Post on 25-Dec-2015

230 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Subnet & Classless Address Extensions

Linda Wu

(CMPT 471 • 2003-3)

Page 2: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 2

Content

Motivation Transparent routers Proxy ARP Subnet addressing Classless addressing

Reference: chapter 10

Page 3: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 3

Motivation Problem: network growth will exhaust

IPv4 address space eventually Solution: minimize the number of

addresses used Avoid assigning netid whenever possible Share one netid among multiple

networks: transparent router, proxy ARP, subnet addressing

Arbitrary assignment: classless addressing

Page 4: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 4

Transparent Routers

A special router T, called transparent router, connects WAN and LAN

Other hosts and routers on the WAN do not know T’s existence

The LAN does not have its own netid; the hosts in the LAN are assigned unused addresses in the WAN

T sends packets from the WAN to the appropriate host in the LAN

T accepts packets from the LAN and routes them across WAN to the destination

Page 5: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 5

Transparent Routers (cont.)

Advantages One netid is shared by multiple networks:

fewer network addresses are required Support load balancing

Disadvantages Only work with WAN that has a large

address space Do not provide all the same services as

conventional routers

Page 6: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 6

Proxy ARP ARP

Address Resolution Protocol Maps IP addresses to physical addresses

Proxy an application that closes a straight path between

2 networks and prevents the crackers from obtaining internal addresses and details of a private network

A B CR

D E

Main network

Hidden network

Router running proxy ARP

Page 7: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 7

Proxy ARP (cont.)

How proxy ARP works? Main network and hidden network: share the

same netid A router, R, connects these 2 networks R knows which hosts lie on which physical

networks, and maintains the illusion that only one network exists

A in the main network sends packets to E in the hidden network

A broadcasts ARP request for E’s physical addr. R responses ARP request by sending back its own

physical addr. A sends the packet destined for E to R R forwards the packet destined for E over the hidden

network

Page 8: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 8

Proxy ARP (cont.)

Advantages One netid is shared by multiple networks Proxy ARP can be added to a single

router without disturbing other hosts or routers on the network

Disadvantages The network must use ARP for address

resolution Cannot be generalized to more complex

network topology Rely on managers to maintain tables of

machines and addresses manually

Page 9: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 9

Subnet Addressing Subnet addressing, subnetting A network is divided into several

smaller subnets Each subnet has its own subnet

address Subnets appear as a single network

to the rest of the internet The router attached to the subnets

knows the network is physically divided into subnets

Page 10: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 10

Subnet Addressing (cont.)

Subnetting Example

To the rest of the internet

141.14.128.1 141.14.128.2

141.14.5.1 141.14.5.2 141.14.5.3 141.14.64.1 141.14.64.5 141.14.64.7

R1

R2netid: 141.14.0.0Class B

Subnet: 141.14.5.0 Subnet: 141.14.64.0

Subnet: 141.14.128.0

Page 11: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 11

Subnet Addressing (cont.)

Subnetting address

141 • 14 • 191 • 10

netid hostid

Without subnetting

141 • 14 • 192 • 192

netid subnetid hostid

With subnetting

( 405 ) 864 - 8902

Area code Exchange Connection

Hierarchy in telephone number

Hierarchy addressing:

netid

subnetid

hostid

Page 12: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 12

Subnet Addressing (cont.)

Mask a 32-bit binary number that gives the network

address when bitwise ANDed with an IP address e.g.

IP address: 123.24.3.1 (class B)Mask: 11111111 11111111 00000000 00000000IP & mask = 123.24.0.0 (network address)

Bitwise AND

mask

IP address

Network address

Page 13: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 13

Subnet Addressing (cont.)

Default masksMasks for class A, B, C addresses 1s: preserve the netid 0s: set the hostid to 0 Number of 1s is predetermined: 8/16/24

Class Binary mask Dotted-decimal mask

A 11111111 00000000 00000000 00000000 255.0.0.0

B 11111111 11111111 00000000 00000000 255.255.0.0

C 11111111 11111111 11111111 00000000 255.255.255.0

Page 14: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 14

Subnet Addressing (cont.)

Subnet mask Change some of the leftmost 0s in the

default mask to 1s to make a subnet mask Preserve netid and subnetid, set hostid to 0 Contiguous subnet mask (recommended)

11111111 11111111 11000000 00000000 Noncontiguous subnet mask

11111111 11111111 00110000 001000000

Subnet mask: 255.255.224.0

11111111 11111111 111 00000 00000000

Default mask: 255.255.0.0

11111111 11111111 00000000 00000000

Page 15: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 15

Subnet Addressing (cont.)

Bitwise AND

Subnet mask

255.255.224.0

141.14.72.24

IP address

141.14.64.0

Network address

72 010 01000

224 111 00000

010 00000 (64)

Page 16: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 16

Subnet Addressing (cont.)

Subnet design exampleA company is granted network address 200.16.64.0 (class C). It needs 6 subnets. Design the subnet. # of 1s in the default mask = 24 (class C) 6 subnets < 23: need 3 more 1s in the subnet

mask Total # of 1s in the subnet mask: 24 + 3 = 27 Total # of 0s in the subnet mask: 8 – 3 = 5 (hostid

bits) Mask is: 11111111 11111111 11111111 11100000,

or, 255.255.255.224 # of hosts per subnet: 25 = 32

Page 17: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 17

Subnet Addressing (cont.) Subnet address ranges

1st: 200.16.64.0 ~ 200.16.64.31

2nd: 200.16.64.32 ~ 200.16.64.63

3rd : 200.16.64.64 ~ 200.16.64.95

4th : 200.16.64.96 ~ 200.16.64.127

5th : 200.16.64.128 ~ 200.16.64.159

6th : 200.16.64.160 ~ 200.16.64.191

7th : 200.16.64.192 ~ 200.16.64.223

8th : 200.16.64.224 ~ 200.16.64.255

Page 18: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 18

Subnet Addressing (cont.)

Fixed-length subnetting All 1s or all 0s subnet is not recommended All 1s and all 0s host addresses are reserved

Variable-length subnetting No single subnetid partition works for all

organizations An organization may select subnetid partition on

a per-network basis; all hosts and routers attached to the network must follow the partition

Subnet bits # of subnets Hosts per subnet (class B)

0 1 (20) 65534 (216 – 2)

2 2 (22-2) 16382 (214 – 2)

8 254 (28-2) 254 (28-2)

Page 19: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 19

Subnet Addressing (cont.)

Variable-length subnetting exampleA class C site has 5 subnets with host numbers: 60, 60, 60, 30, 30 2 bits in subnetid? No, only 4 subnets. 3 bits in subnetid? No, at most 32 hosts per

subnets.

62 hosts

62 hosts

30 hosts

62 hosts

30 hosts

First mask (26 1s)

255.255.255.192

Second mask (27 1s)

255.255.255.224router

Page 20: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 20

Subnet Addressing (cont.)

Subnet broadcasting Subnet broadcast address

hostid is all 1s 3-tuple form: {netid, subnetid, -1}, “-1”

means “all 1s”. {netid, -1, -1}

Means “deliver packet to all hosts with network address netid, even if they are in separate physical subnets”

Operationally, such broadcasting make sense only if routers that interconnect the subnets agree to propagate the packets to all subnets

Page 21: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 21

Classless Addressing Also called supernetting Combine several address blocks to create

a larger address range: supernet Instead of using a single netid for

multiple subnets, it allows a network’s addresses to span multiple netids E.g., an organization that needs 1000 addresses

can be granted 4 class C blocks instead of 1 class B block

X.Y.32.0 ~ X.Y.32.255X.Y.33.0 ~ X.Y.33.255X.Y.34.0 ~ X.Y.34.255X.Y.35.0 ~ X.Y.35.255

Page 22: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 22

Classless Addressing (cont.)

Address block assigning

Choose address blocks randomly The routers outside of the supernet treat

each block separately Each router has N entries in its routing table,

N = # of blocks; therefore, increase the size of the routing table tremendously

Page 23: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 23

Classless Addressing (cont.)

Choose address blocks based on a set of rules so that each router has only one entry in the routing table: required by CIDR (Classless Inter-Domain Routing)

# of blocks is a power of 2 (1, 2, 4, 8 …) The size of each block is a power of 2 The blocks are contiguous in the address

space (no gaps between the blocks) The size of supernet = (# of blocks) *

(size of each block): a power of 2 The first address can be evenly divisible

by supernet size

Page 24: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 24

Classless Addressing (cont.)

Blocks defining in different addressing schemesBlock: [first address, last address] Classful address

one block, default mask is always known the first address only can define the block

Subnetting the first address in the subblock (subnet) and

subnet mask define the subblock Supernetting

the first address of the supernet and supernet mask define the superblock

IP address & supernet mask = first address (network address)

Page 25: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 25

Classless Addressing (cont.)

Supernet mask The reverse of a subnet mask Has less 1s than the default mask for this class

Subnet mask Divide 1 network into 8 subnets

11111111 11111111 11111111 111 00000

Default mask (class C)

11111111 11111111 11111111 000 00000

Supernet mask Combine 8 networks into 1 supernet

11111111 11111111 11111 000 000 00000

Subnetting

Supernetting

Page 26: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 26

Classless Addressing (cont.)

Supernet mask examples A supernet is made out of 16 class C

blocks, what is its supernet mask?

Block #: 16 = 24

Change the last 4 1s in the default mask (class C) to 0s to get the supernet mask:11111111 11111111 11111111 00000000

11111111 11111111 11110000 00000000

Page 27: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 27

Classless Addressing (cont.)

A supernet with mask 255.255.248.0 includes an address 205.16.37.44, what is the address range?

First address

205.16.37.44 AND 255.255.248.0 = 205.16.32.0(11001101 00010000 00100000 00000000)

Mask 11111111 11111111 11111000 00000000, 1s: 21, 0s: 11

Last address: 205.16.39.255 (11001101 00010000 00100111 11111111)

Page 28: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 28

Classless Addressing (cont.)

Slash notation (CIDR notation): A.B.C.D/n

For identifying a CIDR block A.B.C.D: an IP address n: # of bits that are shared in every

address in the block, i.e., # of 1s in the mask

Prefix: common part of the address range (similar to netid), prefix length = n

Suffix: varying part of the address range (similar to hostid), suffix length = 32 - n

Page 29: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 29

Classless Addressing (cont.)

Relationship between mask and prefix length

/n Mask /n Mask

/1 128.0.0.0 /12 255.240.0.0

/2 192.0.0.0 /16 255.255.0.0 (class B)

/3 224.0.0.0 /24 255.255.255.0 (class C)

/8 255.0.0.0 (class A) /32 255.255.255.255

Class A: a.b.c.d/8Class B: a.b.c.d/16Class C: a.b.c.d/24

Page 30: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 30

Classless Addressing (cont.)

Subnetting with classless addressing Increase supernet prefix length (n) to

define the subnet prefix length

Example: an organization is granted the block 130.34.12.64/26. It needs to have 4 subnets. What is the subnet address and address range for each subnet?

Prefix length = 26, suffix length = 6 # of addresses in the block: 26 = 64

4 subnets 16 addresses per subnet 4 subnets subnet prefix /28 (2 more 1s in

the mask)

Page 31: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 31

Classless Addressing (cont.)

Subnet address ranges 1st: 130.34.12.64/28 ~ 130.34.12.79/28 2nd: 130.34.12.80/28 ~ 130.34.12.95/28 3rd: 130.34.12.96/28 ~ 130.34.12.111/28 4th: 130.34.12.112/28 ~ 130.34.12.127/28

130.34.12.64/28

130.34.12.80/28

130.34.12.96/28 130.

34.1

2.11

2/28

R3

R1

R2

Site: 130.34.12.64/26

Page 32: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 32

Classless Addressing (cont.)

Reserved CIDR blocks Private addresses, unroutable addresses Used with private networks Never assigned to networks in the global

Internet Router in the global Internet knows they

are reserved addresses, and can detect it if a packet destined to the reserved address accidentally reaches the Internet

Page 33: Subnet & Classless Address Extensions Linda Wu (CMPT 471 2003-3)

Notes-4 CMPT 471 2003-3 33

Classless Addressing (cont.)

Reserved CIDR blocks: list

Prefix First address Last address

10/8 10.0.0.0 10.255.255.255

172.16/12 172.16.0.0 172.31.255.255

192.168/16 192.168.0.0 192.168.255.255

169.254/16 169.254.0.0 169.254.255.255