410 likes | 620 Views
CMPE 155. Week 8. Router demos: background. IP Datagram Format. IP datagram consists of header and data (or payload). Header (IPv4): 20-byte fixed (mandatory) part. Variable length optional part. IP Header. 32 bits. Header length. Type of service. Version.
E N D
CMPE 155 Week 8 Winter 2002
Router demos: background Winter 2002
IP Datagram Format • IP datagram consists of header and data (or payload). • Header (IPv4): • 20-byte fixed (mandatory) part. • Variable length optional part. Winter 2002
IP Header 32 bits Header length Type of service Version Total length U D M Identification Fragment offset TTL Protocol Header checksum Source address Destination address Options Winter 2002
IP Functions • Type of Service • Not used until recently. • Identification, Flags and Fragment Offset • Fragmentation. • Time to live • Bounded delivery. • Protocol • (De)multiplexing higher layer protocols. Winter 2002
Other Fields • Length • IP packet length limited to 64K. • Header checksum • Ensures some degree of header integrity. Winter 2002
Fragmentation • Networks are different! • Different speed and error rates! • Maximum Transmission Unit (MTU). • Larger in more reliable, faster networks. • 1,536 bytes on 10Mbs Ethernets, 4,096 bytes on 100 Mbps FDDI ring. • Router between FDDI and Ethernet. • Either refuses packet, or • Chop it into fragments. Winter 2002
IP Fragmentation • IP header includes identification, flags, and offset fields. • Flags: DF (don’t fragment) and MF (more fragments). • Identification: same for all packet fragments. • Offset: relative fragment position within packet. Winter 2002
Internet How hosts find one another? Computer1 Winter 2002
Packet traveling over Internet Routers send packet to next closest point H R H R H H R R R R R H R H: Hosts R: Routers H Winter 2002
Addressing • Domain name (e.g. www.ucsc.edu) • Global, human readable name. • DNS translates name to IP address. (e.g. 128.114.129.49) • Global, understood by all networks. • Finally, we need local net address. • E.g., Ethernet (08-00-2c-19-dc-45) • Local, works only on a particular network. Winter 2002
Finding IP Address: Domain Name System (DNS) Computer 1 What’s the IP address for www.ucsc.edu? It is 128.114.129.49 Winter 2002
Finding Ethernet Address:Address Resolution (ARP) Broadcast: who knows the Ethernet address for 128.125.51.41? Ethernet Broadcast: it is 08-00-2c-19-dc-45 Ethernet Winter 2002
Addressing in IP • IP addresses are names of interfaces. • DNS names are names of hosts. • DNS binds host names to interfaces. • Routing binds interface names to paths. Winter 2002
Addressing Considerations • Fixed length or variable length? • Issues: • Flexibility. • Processing costs. • Header size. • IP uses fixed-length addresses. • IP uses hierarchical addresses. Winter 2002
IP Addresses • Every host and router on the Internet must have an IP address. • Fixed length: 32 bits. • 2-level hierarchy: • Network number. • Host number. • Notations: • Binary: 10000000 00000110 11110000 00000011 • Dotted decimal: 128.6.240.3 Winter 2002
IP Address Formats 1 • 4 different classes: 0XXXXXXX Class A: 128 nets. 16M hosts/net. Class B: 16K nets. 64K hosts/net. Class C: 2M nets. 256 hosts/net. Class D: Multicast. 10XXXXXX XXXXXXXX 110XXXXX XXXXXXXX XXXXXXXX 1110XXXX XXXXXXXX XXXXXXXX XXXXXXXX Network Host Winter 2002
Class sizes Total IP address space: 4 billion • Class A: 128 networks, 16M hosts. • 1~127. • Class B: 16K networks, 64K hosts. • 128~191. • Class C: 2M networks, 256 hosts. • 192~223. Winter 2002
Some special IP addresses • 127.0.0.1: local host (a.k.a. the loopback address. • 127.x.x.x: same as above. • Host bits all set to 0: network address. • Host bits all set to 1: broadcast address. • 0.0.0.0: this host on this network. Winter 2002
Multi-addresses • A router usually has more than one IP address. • Multi-homed host: host with multiple network interfaces each of which has different IP address. 236.240.128.0 129.98.0.0 236.240.128.3 129.98.95.1 80.0.0.0 80.0.0.8 Winter 2002
Management • Network numbers assigned by single authority: NIC (network information center). • All hosts in a network must have same network number. • What if networks grow? Winter 2002
Scalability • Example: company starts with 1 class C LAN, thus can connect up to 256 hosts. • It might grow to more than 256 hosts. • It might get more LANs. • For every new LAN, need new network number from NIC. • Moving machines between LANs needs address change. Winter 2002
Subnetting (1) • Split address space into several “internal” subnets. • Still act like single network to outside world. • Example: Class B address. Class B: 16K nets. 64K hosts/net 10XXXXXX XXXXXXXX HHHHHHHH HHHHHHHH 10XXXXXX XXXXXXXX SSSSSSHH HHHHHHHH Class B with subnetting: 62 LANs, 1022 hosts each. 1st. subnet: 130.50.4.1 2nd. subnet: 130.50.8.1 Winter 2002
Subnetting 2 • Routing: hierarchical. • (network, -) entries: distant hosts. • (this network, host) entries: local hosts. • Routers only need to keep track of other networks and local hosts. • With subnetting: • (network, -) entries: distant hosts. • (this network, subnet, -). • (this network, this subnet, host). • Adds extra hierarchical level => smaller RTs. Winter 2002
Subnet Mask • Used to compute the subnet number; i.e., gets rid of the host number. • Facilitates routing table look-up. • IP address AND subnet mask = subnet # • Example: 10XXXXXX XXXXXXXX SSSSSSHH HHHHHHHH 11111111 11111111 11111100 00000000 Ex: 130.50.15.6 AND subnet mask = 130.50.12.0, which is subnet 3. Winter 2002
Subnetting Example • Assume an organization was assigned address 150.100. • Assume < 100 hosts per subnet. • How many host bits do we need? • 7. • What is the network mask? • 11111111 11111111 11111111 10000000. • 255.255.255.128 Winter 2002
Using Subnet Mask • Assume a packet arrives with address 150.100.12.176. • Step 1: AND address with subnet mask • (150.100.12.176) AND (255.255.255.128) • result: 150.100.12.128 which is the target network. • Target network has hosts in the range • 150.100.12.129 - 150.100.12.254. Winter 2002
150.100.12.154 150.100.12.176 H1 H2 150.100.12.128 150.100.12.129 150.100.12.24 150.100.12.55 150.100.0.1 R1 H3 H4 To Internet 150.100.12.4 150.100.12.0 150.100.12.1 150.100.15.11 R2 H5 150.100.15.54 150.100.15.0 Subnet Addressing Example Winter 2002
150.100.12.154 150.100.12.176 H1 H2 150.100.12.128 150.100.12.129 150.100.12.24 150.100.12.55 150.100.0.1 R1 H3 H4 To Internet 150.100.12.4 150.100.12.0 150.100.12.1 150.100.15.11 R2 H5 150.100.15.54 150.100.15.0 Routing to the network A packet destined to 150.100.15.11 arrives. R1 applies a 9-bit subnet mask and gets the address 150.100.15.0. R1 looks up its routing table and sends the packet to R2. Winter 2002
150.100.12.154 150.100.12.176 H1 H2 Destination Next hop Interface 150.100.12.128 150.100.12.129 lo0 150.100.12.24 150.100.12.55 127.0.0.1 127.0.0.1 150.100.0.1 R1 H3 H4 Routing table at H5 default 150.100.15.54 emd0 To Internet 150.100.12.4 150.100.15.0 150.100.15.11 emd0 150.100.12.0 150.100.12.1 150.100.15.11 R2 H5 150.100.15.54 150.100.15.0 Routing within the subnet H5 wants to send pkt to H2. • Lookup rules: • exact match • network match • default route Search for longest matching prefix Winter 2002
150.100.12.154 150.100.12.176 H1 H2 150.100.12.128 150.100.12.129 150.100.12.24 150.100.12.55 150.100.0.1 R1 H3 H4 Routing table at R2 To Internet 150.100.12.4 Destination Next hop Interface 150.100.12.0 150.100.12.1 150.100.15.11 lo0 R2 H5 127.0.0.1 127.0.0.1 150.100.15.54 default 150.100.12.4 emd0 150.100.15.0 150.100.15.0 150.100.15.11 emd1 emd0 150.100.12.0 150.100.12.1 Routing within the subnet From H5, Packet reaches R2. R2 delivers the packet to R1. Winter 2002
150.100.12.154 150.100.12.176 H1 H2 150.100.12.128 150.100.12.129 150.100.12.24 150.100.12.55 150.100.0.1 R1 H3 H4 To Internet 150.100.12.4 150.100.12.0 150.100.12.1 150.100.15.11 R2 H5 150.100.15.54 150.100.15.0 Routing within the subnet Routing table at R1 Destination Next hop Interface lo0 127.0.0.1 127.0.0.1 150.100.12.176 150.100.12.176 emd0 R1 has direct route and delivers packet to H2. 150.100.12.0 150.100.12.4 emd1 emd1 150.100.15.0 150.100.12.1 Winter 2002
IP Address Problem • Exponential growth of the Internet! • Address space depletion. • Danger of running out of classes A and B. • 32-bit address fields are getting too small. • Early predictions: it’d take decades to achieve 100,000 network mark. • 100,000th. network was connected in 1996! • Internet is rapidly running out of IP addresses! • Waste due to hierarchical address. Winter 2002
IP Address Scalability • Class A addresses: 16M hosts is usually too much. • Class C addresses: 254 hosts is usually too small. • Class B addresses provide room for 64K hosts. • Organizations usually request class B addresses but more than 50% of them only have up to 50 hosts! Winter 2002
Scaling IP Addresses • Class C addresses should have 10-bit host numbers instead of only 8-bit numbers. • Would allow for 1022 hosts instead of just 254. • More Class C networks: network number can grow up to 0.5M. • But, could result in routing table explosion. • Routers will have to know about many more networks. Winter 2002
CIDR (1) • Classless Interdomain Routing: RFC 1519. • No longer uses classes A, B, and C addresses. • Allocate remaining Class C addresses in variable-sized blocks. • Example: if an organization needs 2000 addresses, it’s given a block of 2048 addresses, or 8 contiguous class C networks and not a full class B address. Winter 2002
CIDR (2) • New allocation rules for class C addresses. • World partitioned into 4 zones and each one was given portion of class C address space (192~223). • 192.0.0.0~195.255.255.255: Europe. • 198.0.0.0~199.255.255.255: North America. • 200.0.0.0~201.255.255.255: Central and South America. • 202.0.0.0~203.255.255: Asia and Pacific. Winter 2002
CIDR (3) • Each region is allocated ~ 32M class C addresses. • Addresses 204.0.0.0~223.255.255.255 reserved for future use. • Advantages: • Less waste. • Routing table aggregation: • Routers need only one RT entry per region, i.e., 32M addresses compressed into one. Winter 2002
CIDR (4) • Once packet gets to its destination region, need more detailed routing information. • One possibility is to keep 131,072 (32M/28) entries for all “local” networks. • Explosion problem. • Instead, use of 32-bit masks: only need to keep start address of block. Winter 2002
CIDR - Example (1) • Cambridge University has 2048 addresses from 194.24.0.0~194.24.7.255 and mask 255.255.248.0. • Oxford University: 4096 addresses 194.24.16.0~194.24.31.255 with mask 255.255.240.0. • U of Edinburgh: 1024 addresses 194.24.8.0~194.24.11.255 and mask 255.255.252.0. Winter 2002
CIDR - Example (2) • Routing tables in Europe contain base address and mask: Address Mask 11000010 00011000 00000000 00000000 11111111 11111111 11111000 00000000 11000010 00011000 00010000 00000000 11111111 11111111 11110000 00000000 11000010 00011000 00001000 00000000 11111111 11111111 11111100 00000000 When packet to 194.24.17.4 (11000010 00011000 00010001 00000100) arrives, it’s ANDed with Cambridge U’s mask yielding 11000010 00011000 00010000 00000000 which does not match Cambridge U’s base. When it’s ANDed with Oxford’s mask, it matches Oxford’s base, so packet sent to Oxford’s router. Winter 2002