CSE 124: IP ADDRESSES, NAMING, AND DNS. George Porter Oct 4, 2017

Similar documents
IP ADDRESSES, NAMING, AND DNS

NAMING, DNS, AND CHORD

Domain Name Service. DNS Overview. October 2009 Computer Networking 1

Chapter 2 Application Layer. Lecture 5 DNS. Computer Networking: A Top Down Approach. 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012

CSEN 404 Introduction to Networks. Mervat AbuElkheir Mohamed Abdelrazik. ** Slides are attributed to J. F. Kurose

CSEN 503 Introduction to Communication Networks

CSc 450/550 Computer Networks Domain Name System

Lecture 05: Application Layer (Part 02) Domain Name System. Dr. Anis Koubaa

CSE561 Naming and DNS. David Wetherall

The Domain Name System

Computer Networks. Domain Name System. Jianping Pan Spring /25/17 CSC361 1

CS 43: Computer Networks. 10: Naming and DNS September 24, 2018

ELEC / COMP 177 Fall Some slides from Kurose and Ross, Computer Networking, 5 th Edition

Applications & Application-Layer Protocols: (SMTP) and DNS

Lecture 7: Application Layer Domain Name System

Domain Name System (DNS) 김현철 ( 화 ) 정보통신융합서울대학교컴퓨터공학부

INTRODUCTION TO PROTOCOLS, LAYERING, FRAMING AND PARSING

CS 3516: Advanced Computer Networks

Chapter 2 part B: outline

CSE 486/586 Distributed Systems

Chapter 2: Application layer

Page 1. TCP Flow Control" TCP Flow Control" TCP Flow Control" CS162 Operating Systems and Systems Programming Lecture 16. Flow Control, DNS"

Computer Networking Introduction

DNS. dr. C. P. J. Koymans. September 16, Informatics Institute University of Amsterdam. dr. C. P. J. Koymans (UvA) DNS September 16, / 46

DNS and CDNs : Fundamentals of Computer Networks Bill Nace

Application Layer: , DNS

CS 457 Networking and the Internet. Problems. Mechanisms 9/21/16. Fall 2016 Indrajit Ray

DNS Hierarchical Name Space. BIND Terminology and DNS Name Servers. Distributed Hierarchical Database (1st Approx) Domain Name System (DNS)

EE 122: Domain Name System

Chapter 2 Application Layer

Reminders. EE 122: Domain Name System. Goals of Today!s Lecture. Host Names vs. IP addresses. Separating Naming and Addressing

Application-layer Protocols

CSCD 330 Network Programming Winter 2015

CSCI-1680 DNS Rodrigo Fonseca

Application Layer. Pure P2P architecture. Client-server architecture. Processes communicating. Hybrid of client-server and P2P. Creating a network app

Domain Name System (DNS)

CSE 124 January 27, Winter 2017, UCSD Prof. George Porter

CSE 124 January 18, Winter 2017, UCSD Prof. George Porter

Application Layer. Pure P2P architecture. Client-server architecture. Processes communicating. Hybrid of client-server and P2P. Creating a network app

Lecture 8. Basic Internetworking (IP) Outline. Basic Internetworking (IP) Basic Internetworking (IP) Service Model

Lecture 8. Reminder: Homework 3, Programming Project 2 due on Thursday. Questions? Tuesday, September 20 CS 475 Networks - Lecture 8 1

ELEC / COMP 177 Fall Some slides from Kurose and Ross, Computer Networking, 5 th Edition

CSE 124 January 12, Winter 2016, UCSD Prof. George Porter

Section 2: Application layer

L10: Simple Internetworking. Hui Chen, Ph.D. Department of Engineering & Computer Science Virginia State University Petersburg, VA 23806

Table of Contents DNS. Short history of DNS (1) DNS and BIND. Specification and implementation. A short history of DNS.

Application Layer. Goals: Service models. Conceptual aspects of network application protocols Client server paradigm

Communications Software. CSE 123b. CSE 123b. Spring Lecture 11: Domain Name System (DNS) Stefan Savage. Some pictures courtesy David Wetherall

CSE 123b Communications Software. Overview for today. Names and Addresses. Goals for a naming system. Internet Hostnames

DNS and Modern Network Services. Amin Vahdat CSE 123b April 27, 2006

Light at the end of the tunnel Final Lecture: Course Overview

Translating Addresses

Announcements. Transport Protocols & DNS. Goals for Today s Lecture, Part 1. Goals of Today s Lecture, Part 2. Transport Protocols

0 0& Basic Background. Now let s get into how things really work!

Chapter II: Application Layer

CSCD 330 Network Programming Spring 2018 Lecture 5 Application Layer. Reading: Chapter 2 Still

C14a: Internetworks and The Internet

ECE 158A: Lecture 7. Fall 2015

CIS 551 / TCOM 401 Computer and Network Security. Spring 2006 Lecture 16

CSCE 463/612 Networks and Distributed Processing Spring 2018

Table of Contents DNS. Short history of DNS (1) DNS and BIND. Specification and implementation. A short history of DNS. Root servers.

ELEC / COMP 177 Fall Some slides from Kurose and Ross, Computer Networking, 5 th Edition

EECS 122: Introduction to Computer Networks DNS and WWW. Internet Names & Addresses

Networking Applications

Page 1. CS162 Operating Systems and Systems Programming Lecture 22. Networking III. Automatic Repeat Request

Protocol Classification

Overview General network terminology. Chapter 9.1: DNS

Internetworking Part 2

f.root-servers.net ISOC cctld Workshop Nairobi, Kenya, 2005

Application layer. Some network apps. Client-server architecture. Hybrid of client-server and P2P. Pure P2P architecture. Creating a network app

CS475 Networks Lecture 8 Chapter 3 Internetworking. Ethernet or Wi-Fi).

CIS 551 / TCOM 401 Computer and Network Security

CSC 401 Data and Computer Communications Networks

The Internet. Overview. Network building blocks

CS4/MSc Computer Networking. Lecture 3: The Application Layer

CS155b: E-Commerce. Lecture 3: Jan 16, How Does the Internet Work? Acknowledgements: S. Bradner and R. Wang

ECE 4450:427/527 - Computer Networks Spring 2017

Advanced Networking. Domain Name System

Advanced Networking. Domain Name System. Purpose of DNS servers. Purpose of DNS servers. Purpose of DNS servers

Application Layer Protocols

DNS. Karst Koymans & Niels Sijm. Tuesday, September 7, Informatics Institute University of Amsterdam

CSCI-1680 DNS Rodrigo Fonseca

Network Layer: Internet Protocol

2/22/2008. Outline Computer Networking Lecture 9 IP Protocol. Hop-by-Hop Packet Forwarding in the Internet. Internetworking.

Internetworking Part 2

DNS & Iodine. Christian Grothoff.

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 6

EPL606. Internetworking. Part 2a. 1Network Layer

Application Layer. Goals:

Application Layer. Applications and application-layer protocols. Goals:

Chapter 2 outline. 2.1 Principles of app layer protocols

INTERNET ARCHITECTURE & PROTOCOLS

CH. 3 IP FORWARDING AND ROUTING

CS519: Computer Networks. Lecture 6: Apr 5, 2004 Naming and DNS

CSCD 330 Network Programming Spring 2017

Domain Name System.

Internet applications. 2: Application Layer 1

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 5

The Domain Name System (DNS) and its security. CSU CS557, Spring 2018 Instructor: Lorenzo De Carli Partly based on the CS457 slides by Indrajit Ray

Domain Name System (DNS)

Transcription:

CSE 124: IP ADDRESSES, NAMING, AND DNS George Porter Oct 4, 2017

ATTRIBUTION These slides are released under an Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) Creative Commons license These slides incorporate material from: Computer Networks: A Systems Approach, 5e, by Peterson and Davie

ANNOUNCEMENTS Homework 1 deadline pushed to Wednesday at 5pm Some updates on the FAQ, posted to the class website Reading due: Donahoo and Calvert, Chapter 2 Start working on Project 1!

Outline 1. Homework 1 strategy 2. Internetworking overview 3. IP and IP addresses 4. DNS and naming 5. DNS API

CHALLENGE: READ IN A SIMPLE CALCULATOR INSTRUCTION SET Instructions separated by <CR> <LF> two-byte delimiter Groups of instructions separated by a pair of <CR><LF> delimiters Goal: Working with delimiters in isolation, without also needing to work with reading data from the network Today: Approach most similar to what will work for your web server

BASIC INPUT/OUTPUT IN C/C++ ptr: the buffer to read data into (fread); the data you want to write out (fwrite) size: how big of a data item you want to read/write nmemb: how many data items to read/write stream: the I/O stream you want to read or write to/from How to put these together to read in a stream?

READING DATA INTO A BUFFER WITH FREAD() Create a buffer of size BUF_SIZE: uint8_t[buf_size] mybuf; Recall fread(): fread(pointer, size_of_item, num_items, fp); fread(mybuf, BUF_SIZE, 1, fp); How big to make BUF_SIZE? For homework 1, can make it 8192 But what about your web server?

READING ENTIRE FILE INTO MEMORY NOT EFFICIENT 3MB JPEG? 20MB JPEG? Not good to have memory usage of your server == size of files served Videos can be gigabytes in size So what can we do?

WRITING IN FIXED-SIZED CHUNKS Writing out a big image uint8_t buffer[512]; uint64_t offset = 0; do { read up to 512 bytes from file at offset into buffer write out buffer s contents to the web client offset += how much data was read into the buffer; } while (offset < file size); But what about reading (and parsing?) Case 1: We don t know the maximum size of a request Case 2: We do know the maximum size of a request

CASE 1: DYNAMIC ARRAYS REVIEW Growable array of bytes Underpins classes like Vector, ArrayList, etc... State variables: uint64_t capacity; uint8_t buffer[capacity] uint64_t size Appending item myitem : size = size + 1 buffer[size] = myitem; Accessing item i : return buffer[i]; But what if array is full? I.e., (size == capacity)? Doubling algorithm: allocate newbuffer[2 * capacity]; copy buffer into newbuffer Replace pointer in the data structure with a pointer to newbuffer Free the original buffer Amortized cost to insert? O(1)

READING REQUEST OF UNKNOWN SIZE INTO A DYNAMIC BUFFER dynamic_buffer requestbuffer; uint8_t readbuffer[512]; while( ) { read up to 512 bytes from web client into readbuffer requestbuffer.append(readbuffer); Does requestbuffer contain a full request? If yes,(1) parse it, then (2) remove from requestbuffer Otherwise, keep reading from the client }

HOW TO TELL IF BUFFER CONTAINS A COMPLETE REQUEST? This is the framing problem For length-based framing: 12 97 108 97... Keep reading until we have 12 bytes of request data For delimiter-based framing: OK to simply scan for delimiters using e.g., a for() loop for(int i = 0; i < requestbuffer.size(); i++) if (requestbuffer[i] == \r )

CASE 2: REQUEST OF KNOWN SIZE (HW1, PROJ1, ) uint8_t requestbuffer[8192]; uint8_t readbuffer[512]; uint64_t offset = 0; while( ) { read up to 512 bytes from client into readbuffer copy bytes from readbuffer into requestbuffer at offset Does requestbuffer contain a full request? If yes: (1) parse it, then (2) move remainder of requestbuffer to the beginning, (3) keep reading If no: keep reading }

HOMEWORK 1 SUMMARY Reading the file: Buffer of type uint8_t[bufsize] fread() data from the stream into the buffer You can assume fixed input size of 8,192 bytes Parsing a sequence of instructions: Fine iterate through array looking for <CR> or <LF> E.g., for() loop But reading 1 byte at a time not efficient 1 system call/context switch per byte!

Outline 1. Homework 1 strategy 2. Internetworking overview 3. IP and IP addresses 4. DNS and naming 5. DNS API

INTERNETWORKING What is an internetwork? An arbitrary collection of networks interconnected to provide some sort of host-host to packet delivery service

INTERNETWORKING PROTOCOL Each host has a local address on specific sub-network Ethernet, WiFi, UCSD, Comcast, AT&T, Verizon Wireless, Yet each host has a single, global IP address

Outline 1. Homework 1 strategy 2. Internetworking overview 3. IP and IP addresses 4. DNS and naming 5. DNS API

IP SERVICE MODEL Packet Delivery Model Connectionless model for data delivery Best-effort delivery (unreliable service) packets are lost packets are delivered out of order duplicate copies of a packet are delivered packets can be delayed for a long time Global Addressing Scheme Provides a way to identify all hosts in the network

IP PACKET FORMAT Version (4): currently 4 Hlen (4): number of 32-bit words in header TOS (8): type of service (not widely used) Length (16): number of bytes in this datagram Ident (16): used by fragmentation Flags/Offset (16): used by fragmentation TTL (8): number of hops this datagram has traveled Protocol (8): demux key (TCP=6, UDP=17) Checksum (16): of the header only DestAddr & SrcAddr (32)

GLOBAL ADDRESSES Properties globally unique hierarchical: network + host 4 Billion IP address, half are A type, ¼ is B type, and 1/8 is C type Format Dot notation 10.3.2.4 128.96.33.81 192.12.69.77

CIDR: CLASSLESS INTERDOMAIN ROUTING Original IP address design: limited network sizes 256, 65536, or 16777216 hosts per network Not very flexible! CIDR enables any power-of-two network size Networks with 16 hosts, or 32 hosts, etc. Number of bits assigned to the host part of the address indicated with a /

CIDR EXAMPLES 192.168.1.1/16 First 16 bits = network, last 16 bits = 2^16 hosts 206.109.3.1/24 First 24 bits = network, last 8 = 256 hosts 212.110.9.1/30 First 30 bits = network, only 4 hosts in that network!

ASSIGNING ADDRESSES VIA DHCP DHCP server is responsible for providing configuration information to hosts There is at least one DHCP server for an administrative domain DHCP server maintains a pool of available addresses

DHCP IN ACTION Newly booted or attached host sends DHCPDISCOVER message to a special IP address (255.255.255.255) DHCP relay agent unicasts the message to DHCP server and waits for the response

Outline 1. Homework 1 strategy 2. Internetworking overview 3. IP and IP addresses 4. DNS and naming 5. DNS API

DNS HOSTNAME VERSUS IP ADDRESS DNS host name (e.g. www.cs.ucsd.edu) Mnemonic name appreciated by humans Variable length, full alphabet of characters Provides little (if any) information about location IP address (e.g. 128.112.136.35) Numerical address appreciated by routers Fixed length, decimal number Hierarchical address space, related to host location

MANY USES OF DNS Hostname to IP address translation IP address to hostname translation (reverse lookup) Host name aliasing: other DNS names for a host Alias host names point to canonical hostname Email: Lookup domain s mail server by domain name

ORIGINAL DESIGN OF DNS Per-host file named /etc/hosts (1982) Flat namespace: each line = IP address & DNS name SRI (Menlo Park, California) kept the master copy Everyone else downloads regularly But, a single server doesn t scale Traffic implosion (lookups and updates) Single point of failure Need a distributed, hierarchical collection of servers

DNS: GOALS AND NON-GOALS A wide-area distributed database Goals: Scalability; decentralized maintenance Robustness Global scope Names mean the same thing everywhere Distributed updates/queries Good performance But don t need strong consistency properties

DOMAIN NAME SYSTEM (DNS) Hierarchical name space divided into contiguous sections called zones Zones are distributed over a collection of DNS servers Hierarchy of DNS servers: Root servers (identity hardwired into other servers) Top-level domain (TLD) servers Authoritative DNS servers Performing the translations: Local DNS servers located near clients Resolver software running on clients

DNS IS HIERARCHICAL. Root TLDs: com. gov. edu. fcc.gov. ucsd.edu. cs.ucsd.edu. princeton.edu. Hierarchy of namespace matches hierarchy of servers Set of nameservers answers queries for names within zone Nameservers store names and links to other servers in tree

DNS ROOT NAMESERVERS 13 root servers. Does this scale? E NASA Mt View, CA F Internet Software Consortium, Palo Alto, CA A Verisign, Dulles, VA C Cogent, Herndon, VA D U Maryland College Park, MD G US DoD Vienna, VA H ARL Aberdeen, MD J Verisign I Autonomica, Stockholm M WIDE Tokyo B USC-ISI Marina del Rey, CA L ICANN Los Angeles, CA

DNS ROOT NAMESERVERS 13 root servers. Does this scale? Each server is really a cluster of servers (some geographically distributed), replicated via IP anycast E NASA Mt View, CA F Internet Software Consortium, Palo Alto, CA A Verisign, Dulles, VA C Cogent, Herndon, VA D U Maryland College Park, MD G US DoD Vienna, VA H ARL Aberdeen, MD J Verisign I Autonomica, Stockholm M WIDE Tokyo B USC-ISI Marina del Rey, CA L ICANN Los Angeles, CA

TLD AND AUTHORITATIVE SERVERS Top-level domain (TLD) servers Responsible for com, org, net, edu, etc, and all top-level country domains: uk, fr, ca, jp Network Solutions maintains servers for com TLD Educause non-profit for edu TLD Authoritative DNS servers An organization s DNS servers, providing authoritative information for that organization May be maintained by organization itself, or ISP

LOCAL NAME SERVERS Do not strictly belong to hierarchy Each ISP (or company, or university) has one Also called default or caching name server When host makes DNS query, query is sent to its local DNS server Acts as proxy, forwards query into hierarchy Does work for the client

DNS RESOURCE RECORDS DNS is a distributed database storing resource records Resource record includes: (name, type, value, time-to-live) Type = A (address) name = hostname value is IP address Type = CNAME name = alias for some canonical (real) name value is canonical name Type = NS (name server) name = domain (e.g. princeton.edu) value is hostname of authoritative name server for this domain Type = MX (mail exchange) name = domain value is name of mail server for that domain

DNS IN OPERATION Most queries and responses are UDP datagrams Two types of queries: Recursive: Nameserver responds with answer or error Client www.ucsd.edu? Nameserver Answer: www.ucsd.edu A 132.239.180.101 Iterative: Nameserver may respond with a referral Client www.ucsd.edu? Nameserver Referral:.edu NS a.edu-servers.net.

RECURSIVE DNS IN ACTION www.cs.ucsd.edu edu DNS server client local DNS proxy ucsd DNS server cs DNS server

RECURSIVE VERSUS ITERATIVE QUERIES Recursive query Less burden on entity initiating the query More burden on nameserver (has to return an answer to the query) Most root and TLD servers won t answer (shed load) Iterative query More burden on query initiator Less burden on nameserver (simply refers the query to another server) Local name server answers recursive query

DNS CACHING Performing all these queries takes time And all this before actual communication takes place Caching can greatly reduce overhead The top-level servers very rarely change Popular sites visited often Local DNS server often has the information cached How DNS caching works All DNS servers cache responses to queries Responses include a time-to-live (TTL) field Server deletes cached entry after TTL expires

Outline 1. Homework 1 strategy 2. Internetworking overview 3. IP and IP addresses 4. DNS and naming 5. DNS API

MAPPING NAMES TO ADDRESSES

LINKED LIST OF ADDRINFO STRUCTS Q: Why a linked list? Q: Which of the multiple results should you use?

ANNOUNCEMENTS Homework 1 deadline pushed to Wednesday at 5pm Some updates on the FAQ, posted to the class website Reading due: Donahoo and Calvert, Chapter 2 Start working on Project 1!