Missing pieces + Putting the pieces together

  • View
    83

  • Download
    0

Embed Size (px)

DESCRIPTION

Missing pieces + Putting the pieces together. EE 122, Fall 2013 Sylvia Ratnasamy http://inst.eecs.berkeley.edu/~ee122 / Material thanks to Ion Stoica , Scott Shenker , Jennifer Rexford, Nick McKeown , and many other colleagues. Today. Missing pieces DHCP ARP - PowerPoint PPT Presentation

Text of Missing pieces + Putting the pieces together

PowerPoint Presentation

Missing pieces + Putting the pieces togetherEE 122, Fall 2013Sylvia Ratnasamyhttp://inst.eecs.berkeley.edu/~ee122/

Material thanks to Ion Stoica, Scott Shenker, Jennifer Rexford, Nick McKeown, and many other colleagues

TodayMissing piecesDHCPARP

Putting the pieces togetherWhat happens when I click on a link?

More missing piecesNaming Application layer: URLs and domain namesnames resources -- hosts, content, program(recall: mixes the what and where of an object)

Network layer: IP addresseshosts network location

Link layer: MAC addresses host identifier

Use all three for end-to-end communication!DiscoveryA host is born knowing only its MAC address

Must discover lots of information before it can communicate with a remote host Bwhat is my IP address? what is Bs IP address? (remote) what is Bs MAC address? (if B is local)what is my first-hop routers address? (if B is not local)

ARP and DHCPLink layer discovery protocolsAddress Resolution Protocol, Dynamic Host Configuration Protocolconfined to a single local-area network (LAN) rely on broadcast capability of a LAN

HostsRouterARP and DHCPLink layer discovery protocolsServe two functions Discovery of local end-hostsfor communication between hosts on the same LAN

ARP and DHCPLink layer discovery protocolsServe two functions Discovery of local end-hostsBootstrap communication with remote hostswhats my IP address?who/where is my local DNS server?who/where is my first hop router?

DHCPDynamic Host Configuration Protocoldefined in RFC 2131A host uses DHCP to discoverits own IP address its netmaskIP address(es) for its DNS name server(s) IP address(es) for its first-hop default router(s)

DHCP: operationOne or more local DHCP servers maintain required information IP address pool, netmask, DNS servers, etc.application that listens on UDP port 67

DHCP: operationOne or more local DHCP servers maintain required informationClient broadcasts a DHCP discovery messageL2 broadcast, to MAC address FF:FF:FF:FF:FF:FF

DHCP: operationOne or more local DHCP servers maintain required informationClient broadcasts a DHCP discovery messageOne or more DHCP servers responds with a DHCP offer messageproposed IP address for client, lease timeother parameters

DHCP: operationOne or more local DHCP servers maintain required informationClient broadcasts a DHCP discovery messageOne or more DHCP servers responds with a DHCP offer messageClient broadcasts a DHCP request messagespecifies which offer it wants echoes accepted parametersother DHCP servers learn they were not chosenDHCP: operationOne or more local DHCP servers maintain required informationClient broadcasts a DHCP discovery messageOne or more DHCP servers responds with a DHCP offer messageClient broadcasts a DHCP request messageSelected DHCP server responds with an ACK(DHCP relay agents used when the DHCP server isnt on the same broadcast domain -- see text)DHCP uses soft stateSoft state: if not refreshed, state is forgottenhard state: allocation is deliberately returned/withdrawnused to track address allocation in DHCP

Implementationaddress allocations are associated with a lease periodserver: sets a timer associated with the record of allocationclient: must request a refresh before lease period expiresserver: resets timer when a refresh arrives; sends ACKserver: reclaims allocated address when timer expires

Simple, yet robust under failurestate always fixes itself in (small constant of) lease time

Soft state under failureWhat happens when host XYZ fails? refreshes from XYZ stopserver reclaims a.b.c.d after O(lease period)

RouterXYZDHCPServer a.b.c.d is mine from (now, now+lease)a.b.c.d is XYZs from (now, now+c.lease)Soft state under failureWhat happens when server fails? ACKs from server stopXYZ releases address after O(lease period); send new requestA new DHCP server can come up from a `cold start and were back on track in ~lease time

RouterXYZDHCPServer a.b.c.d is mine from (now, now+lease)a.b.c.d is XYZs from (now, now+c.lease)Soft state under failureWhat happens if the network fails?refreshes and ACKs dont get through XYZ release address; DHCP server reclaims it

RouterXYZDHCPServer a.b.c.d is mine from (now, now+lease)a.b.c.d is XYZs from (now, now+c.lease) RouterHostHostHostHostDHCPServer Are we there yet?DNSServer What I learnt from DHCPmy IP: 1.2.3.48netmask: 1.2.3.0/24 (255.255.255.0)DNS: 1.2.3.156router: 1.2.3.19Sending Packets Over Link-LayerLink layer only understands MAC addressesTranslate the destination IP address to MAC addressEncapsulate the IP packet inside a link-level frameRouterHostHostHostHostDNS1.2.3.481.2.3.15658-23-D7-FA-20-B090-E2-A1-09-66-1B1.2.3.531.2.3.156IP packet19ARP: Address Resolution ProtocolEvery host maintains an ARP tablelist of (IP address MAC address) pairs

Consult the table when sending a packetMap destination IP address to destination MAC addressEncapsulate the (IP) data packet with MAC header; transmit

But: what if IP address not in the table?Sender broadcasts: Who has IP address 1.2.3.156?Receiver responds: MAC address 58-23-D7-FA-20-B0Sender caches result in its ARP table20What if the destination is remote?Look up the MAC address of the first hop router1.2.3.48 uses ARP to find MAC address for first-hop router 1.2.3.19 rather than ultimate destination IP addressHow does the red host know the destination is not local?Uses netmask (discovered via DHCP)How does the red host know about 1.2.3.19? Also DHCP

hosthostDNS...hosthosthost...routerrouter1.2.3.0/24 (255.255.255.0)5.6.7.0/241.2.3.1561.2.3.481.2.3.19router21Security Analysis of ARPImpersonationAny node that hears request can answer and can say whatever they want

Actual legit receiver never sees a problemBecause even though later packets carry its IP address, its NIC doesnt capture them since not its MAC address22Steps in Sending a PacketWhat do hosts need to know?And how do they find out?Steps in reaching a HostFirst look up destinations IP address

Need to know where local DNS server isDHCP

Also needs to know its own IP addressDHCP

Sending a PacketOn same subnet:Use MAC address of destination. ARP

On some other subnet:Use MAC address of first-hop router. DHCP + ARP

And how can a host tell whether destination is on same or other subnet?Use the netmaskDHCP

Example: A Sending a Packet to BHow does host A send an IP packet to host B?ARB26

Example: A Sending a Packet to BARB1. A sends packet to R.2. R sends packet to B.2728Host A Decides to Send Through R

ARBHost A constructs an IP packet to send to BSource 111.111.111.111, destination 222.222.222.222Host A has a gateway router RUsed to reach destinations outside of 111.111.111.0/24Address 111.111.111.110 for R learned via DHCP2829Host A Sends Packet Through RHost A learns the MAC address of Rs interfaceARP request: broadcast request for 111.111.111.110ARP response: R responds with E6-E9-00-17-BB-4BHost A encapsulates the packet and sends to R

ARB2930R Decides how to Forward PacketRouter Rs adapter receives the packetR extracts the IP packet from the Ethernet frameR sees the IP packet is destined to 222.222.222.222Router R consults its forwarding tablePacket matches 222.222.222.0/24 via other adapter (port)

ARBTwo points:Routing table points to this portDestination address is within mask of ports address (i.e., local)3031R Sends Packet to BRouter Rs learns the MAC address of host BARP request: broadcast request for 222.222.222.222ARP response: B responds with 49-BD-D2-C7-56-2ARouter R encapsulates the packet and sends to B

ARB31Key Ideas in Both ARP and DHCPBroadcasting: used for initial bootstrap

Caching: remember the past for a whileStore the information you learn to reduce overheadRemember your own address & other hosts addressesKey optimization for performance

Soft state: eventually forget the pastAssociate a time-to-live field with the information and either refresh or discard the informationKey for robustness 32Discovery mechanismsWeve seen two broad approachesBroadcast (ARP, DHCP)flooding doesnt scale no centralized point of failurezero configurationDirectory service (DNS)no floodingroot of the directory is vulnerable (caching is key)needs configuration to bootstrap (local, root servers, etc.)Can we get the best of both? Internet-scale yet zero config?Are we there yet? Yes!

Putting the pieces together Assume: `cold start -- nothing cached anywhereAssume: yourDNS on a different subnet from yourDHCPIgnore intra- and interdomain routing protocols

Googles datacenter

DormYouyourDHCP

UCByourDNSRrouterCount the number of protocols that come into play!Walk through the steps required to download www.google.com/index.html from your laptopStep 1: Self discoveryYou use DHCP to discover bootstrap parametersyour IP addr (u.u.u.u) your DNS servers IP (u.dns.ip.addr) Rs IP address (r.r.r.r)..

Exchange between you and yourDHCP

Protocol count = 4

DormYouyourDHCPRrouterEthernetUDPDHCPIPNextYou are ready to contact www.google.com need an IP address for www.google.com need to ask googles DNS server need to ask my DNS server to ask googles DNS I know my DNS servers IP addr is u.dns.ip.addr create a packet to send

EthernetUDPDNSIPdestination MAC?source: u.u.u..udst: u.dns.ip.addrStep 2: Getting out the doorYou use ARP to discover the MAC address of R

Exchange between you and R

Protocol count = 5

DormYouyourDHCPRrouterEthernetARPdst MAC?Step 3: Send a DNS requestExchange between you and yourDNSNow ready to send that packet

Protocol count = 6

EthernetUDPDNSIPsource: u.u.u..udst: u.dns.ip.addrRs MAC

You

UCByourDNSRrouterStep 4: yourDNS d