CMPE 80N: Introduction to Networking and the Internet Katia Obraczka Computer Engineering UCSC Baskin Engineering Lecture 17 CMPE 80N Spring'10 1
Announcements Next class: Presentation of fun projects involving networking. Plan for the remaining of the quarter: Quiz on 05.27 and 06.03. Final exam: June 7 th at 4pm. Comprehensive. Photo id required. CMPE 80N Spring'10 2
Last class Network layer. Main functions. Routing versus forwarding. Types of services provided by network layer: Datagram versus virtual circuit. CMPE 80N Spring'10 3
Today Network layer cont d. CMPE 80N Spring'10 4
The Internet Network Layer CMPE 80N Spring'10 5
The Internet Network Layer Host, router network layer functions: Transport layer: TCP, UDP Network layer Routing protocols path selection RIP, OSPF, BGP forwarding table IP protocol addressing conventions datagram format packet handling conventions ICMP protocol error reporting router signaling Link layer physical layer CMPE 80N Spring'10 6
IP Datagram Format IP protocol version number header length (bytes) type of data max number remaining hops (decremented at each router) upper layer protocol to deliver payload to ver head. len 16-bit identifier time to live 32 bits type of service upper layer flgs length fragment offset header checksum 32 bit source IP address 32 bit destination IP address Options (if any) data (variable length, typically a TCP or UDP segment) total datagram length (bytes) for fragmentation/ reassembly E.g. timestamp, record route taken, specify list of routers to visit. CMPE 80N Spring'10 7
IP Fragmentation & Reassembly network links have MTU (max.transfer size) - largest possible link-level frame. different link types, different MTUs large IP datagram divided ( fragmented ) within net one datagram becomes several datagrams reassembled only at final destination IP header bits used to identify, order related fragments reassembly fragmentation: in: one large datagram out: 3 smaller datagrams CMPE 80N Spring'10 8
IP Fragmentation and Reassembly Example 4000 byte datagram MTU = 1500 bytes length =4000 ID =x length =1500 fragflag =0 ID =x offset =0 One large datagram becomes several smaller datagrams fragflag =1 offset =0 length =1500 ID =x fragflag =1 offset 1 length =1000 ID =x fragflag =0 offset 2 CMPE 80N Spring'10 9
IP Addressing: Introduction IP address: 32-bit identifier for host, router interface. Interface: router s typically have multiple interfaces. host typically has one interface IP addresses associated with each interface 223.1.1.1 223.1.1.2 223.1.2.1 223.1.1.4 223.1.2.9 223.1.1.3 223.1.3.27 223.1.2.2 223.1.3.1 223.1.3.2 223.1.1.1 = 11011111 00000001 00000001 00000001 223 1 1 1 CMPE 80N Spring'10 10
IP address: subnet part (high order bits) host part (low order bits) What s a subnet? Subnets 223.1.1.1 223.1.2.1 223.1.1.2 223.1.1.4 223.1.2.9 223.1.1.3 223.1.3.27 subnet 223.1.2.2 223.1.3.1 223.1.3.2 network consisting of 3 subnets CMPE 80N Spring'10 11
Subnets 223.1.1.0/24 223.1.2.0/24 Recipe To determine the subnets, detach each interface from its host or router, creating islands of isolated networks. Each isolated network is called a subnet. 223.1.3.0/24 Subnet mask: /24 CMPE 80N Spring'10 12
IP addresses: how to get one? Q: How does a host get IP address? hard-coded by system admin in a file Windows: control-panel->network->configuration- >tcp/ip->properties UNIX: /etc/rc.config DHCP: Dynamic Host Configuration Protocol: dynamically get address from as server plug-and-play CMPE 80N Spring'10 13
DHCP: Dynamic Host Configuration Protocol Goal: allow host to dynamically obtain its IP address from network server when it joins network Can renew its lease on address in use Allows reuse of addresses (only hold address while connected an on ) Support for mobile users who want to join network (more shortly) CMPE 80N Spring'10 14
DHCP Overview Client-server interaction: Host requests IP address: DHCP request msg DHCP server sends address: DHCP ack msg CMPE 80N Spring'10 15
DHCP client-server scenario A 223.1.1.1 DHCP server 223.1.2.1 B 223.1.1.2 223.1.1.4 223.1.2.9 223.1.1.3 223.1.3.27 223.1.2.2 223.1.3.1 223.1.3.2 E arriving DHCP client needs address in this network CMPE 80N Spring'10 16
IP addressing: the last word... Q: How does an ISP get block of addresses? A: ICANN: Internet Corporation for Assigned Names and Numbers allocates addresses manages DNS assigns domain names, resolves disputes CMPE 80N Spring'10 17
NAT: Network Address Translation rest of Internet 138.76.29.7 10.0.0.4 local network (e.g., home network) 10.0.0/24 10.0.0.1 10.0.0.2 10.0.0.3 All datagrams leaving local network have same single source NAT IP address: 138.76.29.7, different source port numbers Datagrams with source or destination in this network have 10.0.0/24 address for source, destination (as usual) CMPE 80N Spring'10 18
NAT: Network Address Translation Motivation: local network uses just one IP address as far as outside world is concerned: range of addresses not needed from ISP: just one IP address for all devices can change addresses of devices in local network without notifying outside world can change ISP without changing addresses of devices in local network devices inside local net not explicitly addressable, visible by outside world (a security plus). CMPE 80N Spring'10 19
NAT: Network Address Translation Implementation: NAT router must: outgoing datagrams: replace (source IP address, port #) of every outgoing datagram to (NAT IP address, new port #)... remote clients/servers will respond using (NAT IP address, new port #) as destination addr. remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair incoming datagrams: replace (NAT IP address, new port #) in dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table CMPE 80N Spring'10 20
: NAT router NAT translation table hanges datagram WAN side addr LAN side addr 138.76.29.7, 5001 10.0.0.1, 3345 ource addr from 0.0.0.1, 3345 to 38.76.29.7, 5001, pdates table 2 S: 138.76.29.7, 5001 D: 128.119.40.186, 80 138.76.29.7 S: 128.119.40.186, 80 D: 138.76.29.7, 5001 3 3: Reply arrives dest. address: 138.76.29.7, 5001 10.0.0.4 S: 10.0.0.1, 3345 D: 128.119.40.186, 80 10.0.0.1 10.0.0.2 10.0.0.3 CMPE 80N Spring'10 21 Network Layer 4-21 1 S: 128.119.40.186, 80 D: 10.0.0.1, 3345 4 1: host 10.0.0.1 sends datagram to 128.119.40.186, 80 4: NAT router changes datagram dest addr from 138.76.29.7, 5001 to 10.0.0.1, 3345
IPv6 Initial motivation: 32-bit address space soon to be completely allocated. Additional motivation: header format helps speed processing/ forwarding header changes to facilitate QoS IPv6 datagram format: fixed-length 40 byte header no fragmentation allowed CMPE 80N Spring'10 22
IPv6 Header (Cont) Priority: identify priority among datagrams in flow Flow Label: identify datagrams in same flow. (concept of flow not well defined). Next header: identify upper layer protocol for data CMPE 80N Spring'10 23
Transition From IPv4 To IPv6 Not all routers can be upgraded simultaneous no flag days How will the network operate with mixed IPv4 and IPv6 routers? Tunneling: IPv6 carried as payload in IPv4 datagram among IPv4 routers CMPE 80N Spring'10 24 Network Layer 4-24
Tunneling Logical view: A B E F tunnel IPv6 IPv6 IPv6 IPv6 Physical view: A B E F IPv6 IPv6 IPv6 IPv6 IPv4 IPv4 CMPE 80N Spring'10 25 Network Layer 4-25
Tunneling Logical view: Physical view: A B E F tunnel IPv6 IPv6 IPv6 IPv6 A B C D E F IPv6 IPv6 IPv4 IPv4 IPv6 IPv6 Flow: X Src: A Dest: F data Src:B Dest: E Flow: X Src: A Dest: F Src:B Dest: E Flow: X Src: A Dest: F Flow: X Src: A Dest: F data data data A-to-B: IPv6 B-to-C: E-to-F: B-to-C: IPv6 inside IPv4 IPv6 IPv6 inside CMPE 80N Spring'10 IPv4 26 Network Layer 4-26