Locations and Times Jennifer Rexford Fall 2014 (TTh 3:00-4:20 in CS 105) COS 561: Advanced Computer Networks http://www.cs.princeton.edu/courses/archive/fall14/cos561/ Announcements • Course projects –Presentations will be in January –… not on the last day of class –… as a “poster session” • So, –Written report: Dean’s Date –Poster session: A few days after 2 Locating a Host • Geographic location – Actual physical location (e.g., latitude and longitude) – Location-based search results, advertising, content, … – Blocking access based on client location – Deciding whether traffic can be wiretapped • Best or closest server in a set – Server with the lowest round-trip time to the client – E.g., the shortest network path – To select the best server replica • The two are similar, but not the same 3 Landmarks • Fixed vantage points –Known geographic locations –Probe the client IP address V2 V1 V3 Delay vector: [D1, D2, D3] 4 Latency != Distance • Indirect routes – E.g., Princeton town to Princeton campus – Violations of the triangle inequality • Asymmetric routing – A-to-B is not the reverse of the B-to-A path – Errors when dividing round-trip-time in half • Network congestion – Queuing delay, particularly with deep buffers • Last-mile latency – High transmission delays on slow access link – Inflates the latency measurement 5 IP2Geo Paper • GeoTrack – Infer location from DNS names – Of the host or routers in the traceroute path – E.g., airport codes like sjc2-cw- oc3.sjc.above.net • GeoPing – Hosts with similar delays are close to each other – Store delay vectors for hosts of known locations – For new target, find the nearest neighbor in delay space • GeoCluster – Group IP addresses by IP prefix – Infer location of other IP addresses in the cluster – Identify possible errors (outliers) in IP geolocation 6 Octant Paper (NSDI’07) • Construct a system of constraints – And solve to locate the host • Include a “height” constraint for each node – To capture the latency on the access link • Place more weight on low latency measurements – Less likely to involve an indirect route • Use intermediate routers as additional landmarks – By extracting router location from the DNS name • Both positive and negative constraints – Positive: zip codes from Whois data, others in prefix – Negative: uninhabitable regions (e.g., oceans) 7 Street-Level Geolocation (NSDI’11) • Main insights – Many organizations host their web sites locally – Many web sites list the organization’s postal address • Example: Princeton CS – Princeton CS is hosted in the Princeton CS building – Princeton CS address at 35 Olden St., Princeton, NJ • Combining the information – Infer a coarse-grain region using delay measurements – Identify the zip codes (and Web sites) in the region – Traceroute to the Web sites within the zip code – Find last common hop in the path to Web site and target – Select the location of the “closest” of the Web sites 8 Network Time Protocol (NTP) 9 What is Time in NTP • Coordinated Universal Time (UTC) –A successor to Greenwich Mean Time (GMT) –Time zones are expressed as an offset • Time relative to an epoch –Starting January 1, 1900 • 64-bit representation –32 bits for seconds since the epoch –32 bits for fractions of a second –(Will roll over in 2036) 10 Computer Clocks • Time stored in a counter – Incremented periodically based on interrupts • Generating clock ticks – Quartz crystal oscillator – Common clock hardware is not very accurate – E.g., 0.001% error amounts to almost 1 sec per day – (My laptop is off by 34 parts per million: /var/db/ntp.drift) • Terminology – Clock skew: difference between two clocks at one time – Clock drift: change in reference time per period of time Normal to drift about 1 second every 11-12 days 11 Clock Strata • Multi-level hierarchy of time sources – Level based on distance from reference clock • Stratum 0 – High-precision timekeeping devices – Atomic clocks, GPS clocks, other radio clocks • Stratum 1 – Computers synchronized to attached stratum 0 devices – Stratum 1 computers can peer for sanity checking • Stratum 2 – Synchronized over the network to stratum 1 computers – And so on, for stratum 3, 4, 5, … 12 Clock Synchronization • Client polls NTP server T2 T1 Server Client T3 T4 • Client computes – Round-trip delay d = (T4 -T1 )-(T3 -T2 ) – Offset q = 1 [(T2 -T1 )+(T3 -T4 )] 2 13 Reducing Errors • Client regularly polls three or more NTP servers • Applying filters and analyzing statistics – Most accurate offset is at the lowest delay 14 Correcting the Clock • Time should be a continuous, steady stream – Should not have abrupt changes in the clock – Should not take the clock backwards • Gradually adjust the client clock – E.g., 0.5 msec per second • Accuracy of NTP – Often within tens of msec over the public Internet – Better than 1 msec within a local area network 15 Finding an NTP Server • NTP pool project – Default time server for major Linux distributions – Hundreds of publicly accessible NTP servers – http://www.pool.ntp.org/en/ 16