CSCD58 WINTER 2018 WEEK 6 - NETWORK LAYER PART 1 Brian Harrington University of Toronto Scarborough February 13, 2018
ADMIN Assignments Midterm after reading week (Feb 27) In class Covering everything up-to transport layer (i.e., not this week s material) No lecture or tutorials that week
CONNECTION VS CONNECTION-LESS Recall: In Transport layer we had 2 options: UDP: Connectionless - just send data out TCP: Connection-oriented: establish a connection first In Network Layer, we also have 2 options: Datagram: Let the data find its own way Virtual Circuit (VC): Establish end-to-end pathway first Actually... we don t have any choice. Network is either Datagram or VC, implemented in network core.
VIRTUAL CIRCUIT NETWORKS Try to emulate behaviour of circuit switched network Set up call before (tear down after) Each VC path segment has unique number Packet only has to hold VC number (not source or dest) Routers keep state of each VC Can allocate resources (bandwidth, buffers, etc) to each VC = predictable, reliable circuit-switching-like performance Example
VIRTUAL CIRCUIT
DATAGRAM No call setup Routers don t need to keep any state info At each point, packets are forwarded using host address Routers can t know all 4 billion + IP addresses List range instead Example
DATAGRAM EXAMPLE 11001000 00010111 00010110 10100001 11001000 00010111 00011000 10101010 11001000 00010111 00001011 00110101
DATAGRAM OR VC? VC Smart network core, dumb end systems Complexity inside network Can provide timing, reliability guarantees Used in Asynchronous Transfer Mode (ATM) networks Network World 2001: I give Ethernet six months before the whole thing is gone... This is just not going to work, ATM is going to dominate Datagram Smart end systems, dumb core Complexity at the edge Elastic/flexible Most importantly? Cheap! Internet standard
FORMAT OF IP DATAGRAM
FORMAT OF IP DATAGRAM
IP FRAGMENTATION Not everyone can carry packets of the same size Ethernet: 1500 bytes WLAN (802.11): 7891 bytes Some WANs: 576 bytes Sometimes we ll need to fragment packets and put them back together later
IP FRAGMENTATION
IP FRAGMENTATION
IP: INTERNET PROTOCOL Note: Focusing on IP v4 (we ll discuss IPv6 later) Each interface identified by 32-bit number Interface: connection between host/router and physical link routers usually have many interfaces hosts usually have 1-2 (e.g,. ethernet + wifi) 223.1.2.1 = 11011111 00000001 00000010 00000001
SUBNETS subnet: group of device interfaces with same higher order part of IP address interfaces on a subnet can talk to each other without intervening router
SUBNETS subnet: group of device interfaces with same higher order part of IP address interfaces on a subnet can talk to each other without intervening router
SUBNETS Pop quiz: how many subnets? What are their masks?
DHCP: DYNAMIC HOST CONFIGURATION PROTOCOL Hosts should be mobile Want to dynamically obtain IP address from local network server when you join a network Each host leases an address (can renew periodically) Allows reuse of addresses (when lease expires, address is up-for-grabs
DHCP Basic Steps: host broadcasts: DHCP discover [optional] DHCP server responds: DHCP offer [optional] host requests: DHCP request DHCP server sends: DHCP ack
DHCP 255.255.255.255 = broadcast to entire subnet
CIDR: CLASSLESS INTERDOMAIN ROUTING So how do we get IP addresses in the first place? ISP gets allocated a block by ICANN (Internet Corporation for Assigned Names and Numbers) http://www.icann.org/ Organization (could also be ISP) gets a sub-block ISP s block 11001000 00010111 00010000 00000000 200.23.16.0/20 Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23 Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23 Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23......... Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23
CIDR Hierarchical Addressing Allows efficient advertising of routing information But what if an organization wants to move?
CIDR No problem, just go with whoever has the most specific route
NAT: NETWORK ADDRESS TRANSLATION Not every interface needs a unique IP Not enough addresses to go around IPv4-2 32 4.2 billion addresses Too much work to keep track of every update Solution: hide network behind a single ISP To the rest of the world: whole network has 1 address Inside network: We ve got loads of room
NAT: NETWORK ADDRESS TRANSLATION
NAT: NETWORK ADDRESS TRANSLATION
NAT: NETWORK ADDRESS TRANSLATION Benefits of NAT Only need 1 IP address from ISP Can change addresses of local devices without notifying outside world Can change ISPs without affecting local network Devices inside network not directly accessible/visible to outside world (good for security)
NAT: NETWORK ADDRESS TRANSLATION Idea: Translate each local IP + port number into public port number Outgoing: nat_source ip + nat_source port external ip + external port Incoming: external ip + external port nat_source ip + nat_source port
NAT: NETWORK ADDRESS TRANSLATION
NAT: NETWORK ADDRESS TRANSLATION
NAT: NETWORK ADDRESS TRANSLATION
NAT: NETWORK ADDRESS TRANSLATION
NAT: NETWORK ADDRESS TRANSLATION
ICMP: INTERNET CONTROL MESSAGE PROTOCOL Simple messages sent at network level Sort of like a pseudo-layer between Transport and Network layers Useful for a lot of low-level functions Type Code description 0 0 echo reply (ping) 3 0 dest. network unreachable 3 1 dest host unreachable 3 2 dest protocol unreachable 3 3 dest port unreachable 3 6 dest network unknown 3 7 dest host unknown 4 0 source quench (congestion control - not used) 8 0 echo request (ping) 9 0 route advertisement 10 0 router discovery 11 0 TTL expired 12 0 bad IP header
ICMP & TRACEROUTE Traceroute is implemented in ICMP Less overhead to use bandwidth/mess up timings Idea: use TTL field When TTL expires, router sends back ICMP 11-0: TTL expired, with router info attached Send out UDP segment with TTL = 1, get info of first router Send out UDP segment with TTL = 2, get info of second router Eventually, reach destination, pick unlikely port#. Host will send back ICMP 3-3: Dest port unreachable
IPV6 IPv4 s 32-bit address space soon to be used up (actually practically exhausted in 2011) Updated header format to improve speed Better processing, faster forwarding, get rid of unused fields Can add QoS info
IPV6 fixed length header no fragmentation allowed datagrams form a flow Not really well defined No checksum (let TCP handle that) Options indicated by next_hdr field (held inside data) Major difference: 128bit addressing = 2 128 3.4x10 28 addresses
IPV6
IPV6 1996 - defined (RFC 1883) 2011 - IPv4 exhausted, plans for IPv6 to take over bulk of networking traffic by the end of the year 2017 - We ve finally reached a milesone... (of 20% adoption)