-
Notifications
You must be signed in to change notification settings - Fork 19
/
TCP-DNS.html
834 lines (810 loc) · 28.5 KB
/
TCP-DNS.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>TCP-DNS</title>
<!-- 2014-10-10 Fri 08:17 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<meta name="generator" content="Org-mode"/>
<meta name="author" content="Jim Blomo"/>
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center; }
.todo { font-family: monospace; color: red; }
.done { color: green; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.right { margin-left: auto; margin-right: 0px; text-align: right; }
.left { margin-left: 0px; margin-right: auto; text-align: left; }
.center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
pre.src-sh:before { content: 'sh'; }
pre.src-bash:before { content: 'sh'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-R:before { content: 'R'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-java:before { content: 'Java'; }
pre.src-sql:before { content: 'SQL'; }
table { border-collapse:collapse; }
td, th { vertical-align:top; }
th.right { text-align: center; }
th.left { text-align: center; }
th.center { text-align: center; }
td.right { text-align: right; }
td.left { text-align: left; }
td.center { text-align: center; }
dt { font-weight: bold; }
.footpara:nth-child(2) { display: inline; }
.footpara { display: block; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
/*]]>*/-->
</style>
<link rel="stylesheet" type="text/css" href="production/common.css" />
<link rel="stylesheet" type="text/css" href="production/screen.css" media="screen" />
<link rel="stylesheet" type="text/css" href="production/projection.css" media="projection" />
<link rel="stylesheet" type="text/css" href="production/color-blue.css" media="projection" />
<link rel="stylesheet" type="text/css" href="production/presenter.css" media="presenter" />
<link href='http://fonts.googleapis.com/css?family=Lobster+Two:700|Yanone+Kaffeesatz:700|Open+Sans' rel='stylesheet' type='text/css'>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
</head>
<body>
<div id="content">
<h1 class="title">TCP-DNS</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1. TCP & DNS</a></li>
<li><a href="#sec-2">2. Telephone Numbers</a>
<ul>
<li><a href="#sec-2-1">2.1. Parallels</a></li>
</ul>
</li>
<li><a href="#sec-3">3. Hostnames -> IP addresses</a></li>
<li><a href="#sec-4">4. Parts of a Hostname</a>
<ul>
<li><a href="#sec-4-1">4.1. Details</a></li>
</ul>
</li>
<li><a href="#sec-5">5. Hostnames -> IP addresses</a>
<ul>
<li><a href="#sec-5-1">5.1. Caching</a></li>
</ul>
</li>
<li><a href="#sec-6">6. Example</a>
<ul>
<li><a href="#sec-6-1">6.1. Root</a></li>
</ul>
</li>
<li><a href="#sec-7">7. Mappings Types</a>
<ul>
<li><a href="#sec-7-1">7.1. Many others</a></li>
</ul>
</li>
<li><a href="#sec-8">8. Why Separate Names & Addresses?</a>
<ul>
<li><a href="#sec-8-1">8.1. Tradeoffs</a></li>
</ul>
</li>
<li><a href="#sec-9">9. Caching</a>
<ul>
<li><a href="#sec-9-1">9.1. Why?</a></li>
</ul>
</li>
<li><a href="#sec-10">10. Browsers</a>
<ul>
<li><a href="#sec-10-1">10.1. Packets</a></li>
</ul>
</li>
<li><a href="#sec-11">11. Highest selling domain names</a>
<ul>
<li><a href="#sec-11-1">11.1. Source</a></li>
</ul>
</li>
<li><a href="#sec-12">12. IP is Unreliable</a>
<ul>
<li><a href="#sec-12-1">12.1. Components</a></li>
</ul>
</li>
<li><a href="#sec-13">13. Transport Control Protocol</a>
<ul>
<li><a href="#sec-13-1">13.1. Accurate delivery</a></li>
<li><a href="#sec-13-2">13.2. Checksum</a></li>
<li><a href="#sec-13-3">13.3. Details</a></li>
<li><a href="#sec-13-4">13.4. Ack</a></li>
<li><a href="#sec-13-5">13.5. Window</a></li>
<li><a href="#sec-13-6">13.6. Sequence Numbers</a></li>
<li><a href="#sec-13-7">13.7. Tricks</a></li>
<li><a href="#sec-13-8">13.8. Three-way Handshake</a></li>
<li><a href="#sec-13-9">13.9. Timeline</a></li>
<li><a href="#sec-13-10">13.10. Congestion</a></li>
<li><a href="#sec-13-11">13.11. Exponential</a></li>
</ul>
</li>
<li><a href="#sec-14">14. Telnet</a>
<ul>
<li><a href="#sec-14-1">14.1. No!</a></li>
</ul>
</li>
<li><a href="#sec-15">15. Flexibility</a></li>
<li><a href="#sec-16">16. Composability!</a>
<ul>
<li><a href="#sec-16-1">16.1. Notes</a></li>
</ul>
</li>
<li><a href="#sec-17">17. Overview</a>
<ul>
<li><a href="#sec-17-1">17.1. Overview</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-sec-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> TCP & DNS   <span class="tag"><span class="slide">slide</span></span></h2>
</div>
<div id="outline-container-sec-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> Telephone Numbers   <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-2">
<ul class="org-ul">
<li>Specify a device, not necessarily a person
</li>
<li>But to call a person, we eventually need to call a device
</li>
<li>How do we map between a person and their phone?
</li>
</ul>
</div>
<div id="outline-container-sec-2-1" class="outline-3">
<h3 id="sec-2-1"><span class="section-number-3">2.1</span> Parallels   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-2-1">
<ul class="org-ul">
<li>Keeping your phone number is recent, but still may need to change
</li>
<li>Home, cell numbers services to balance between them
</li>
<li>Ultimately, we get a phone number from the person
</li>
<li>But we can trust other people who have it to share
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-sec-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> Hostnames -> IP addresses   <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-3">
<ul class="org-ul">
<li>Just like my telephone number, we associate names like <code>yelp.com</code> to a
number
</li>
<li>Association is done using Domain Name Service (DNS)
</li>
<li>DNS has a hierarchy for finding who can authoritatively provide an IP
address, and typically has caching once the question has been answered
</li>
</ul>
</div>
</div>
<div id="outline-container-sec-4" class="outline-2">
<h2 id="sec-4"><span class="section-number-2">4</span> Parts of a Hostname   <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-4">
<dl class="org-dl">
<dt> Top Level Domain </dt><dd>highest level in domain hierarchy: <code>.com</code> <code>.org</code>
<code>.edu</code> <code>.uk</code> <code>.cn</code>
</dd>
<dt> Subdomain </dt><dd>labels specifying the hierarchy reading from right to left
</dd>
<dt> Hostname </dt><dd>domain name with an IP address
</dd>
</dl>
</div>
<div id="outline-container-sec-4-1" class="outline-3">
<h3 id="sec-4-1"><span class="section-number-3">4.1</span> Details   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-4-1">
<ul class="org-ul">
<li>The first subdomain can be registered by domain registrars
</li>
<li>Further subdomains can be generated by domain owners (eg.
<code>www.google.com</code>, <code>people.ischool.berkeley.edu</code>
</li>
<li>Subdomains can be arbitrary, but typically used for department (eg <code>ischool</code>), service (eg. <code>www</code>), or area (<code>en</code>)
</li>
<li><code>com</code> is not a hostname because it does not have an IP
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-sec-5" class="outline-2">
<h2 id="sec-5"><span class="section-number-2">5</span> Hostnames -> IP addresses   <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-5">
<ul class="org-ul">
<li>To find a mapping, a client asks a root name server
</li>
<li>The nameservers will recursively direct the client to the domain authority
</li>
<li>Authority will return an IP address, client may optionally cache
</li>
</ul>
<div class="figure">
<p><img src="img/dns-recursive.png" alt="dns-recursive.png"/></p>
</div>
</div>
<div id="outline-container-sec-5-1" class="outline-3">
<h3 id="sec-5-1"><span class="section-number-3">5.1</span> Caching   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-5-1">
<ul class="org-ul">
<li>Caching can happen at many levels
</li>
<li>Typically your computer will ask the ISP name server
</li>
<li>The ISP nameserver will recursively lookup the result and cache it for the
next customer
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-sec-6" class="outline-2">
<h2 id="sec-6"><span class="section-number-2">6</span> Example   <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-6">
<div class="org-src-container">
<pre class="src src-bash">host -v -t A people.ischool.berkeley.edu 199.7.83.42
;; AUTHORITY SECTION:
edu. 172800 IN NS a.edu-servers.net.
;; ADDITIONAL SECTION:
a.edu-servers.net. 172800 IN A 192.5.6.30
host -v -t A people.ischool.berkeley.edu 192.5.6.30
;; AUTHORITY SECTION:
berkeley.edu. 172800 IN NS phloem.uoregon.edu.
berkeley.edu. 172800 IN NS adns1.berkeley.edu.
;; ADDITIONAL SECTION:
phloem.uoregon.edu. 172800 IN A 128.223.32.35
adns1.berkeley.edu. 172800 IN A 128.32.136.3
host -v -t A people.ischool.berkeley.edu 128.32.136.3
;; ANSWER SECTION:
people.ischool.berkeley.edu. 3600 IN CNAME harbinger.ischool.berkeley.edu.
harbinger.ischool.berkeley.edu. 3600 IN A 128.32.78.16
</pre>
</div>
</div>
<div id="outline-container-sec-6-1" class="outline-3">
<h3 id="sec-6-1"><span class="section-number-3">6.1</span> Root   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-6-1">
<ul class="org-ul">
<li>Root server addresses are lettered <code>a</code> through <code>m</code>, we'll use ICANN's
</li>
<li>Provide <code>authority</code> information about who to query next
</li>
<li>Down to DNS provider for people
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-sec-7" class="outline-2">
<h2 id="sec-7"><span class="section-number-2">7</span> Mappings Types   <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-7">
<dl class="org-dl">
<dt> A </dt><dd>IP Address (main record type)
</dd>
<dt> CNAME </dt><dd>alias for another domain name
</dd>
<dt> MX </dt><dd>mail transfer agents
</dd>
<dt> TXT </dt><dd>meta data
</dd>
</dl>
</div>
<div id="outline-container-sec-7-1" class="outline-3">
<h3 id="sec-7-1"><span class="section-number-3">7.1</span> Many others   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-7-1">
<ul class="org-ul">
<li><a href="http://en.wikipedia.org/wiki/List_of_DNS_record_types">http://en.wikipedia.org/wiki/List_of_DNS_record_types</a>
</li>
<li>TXT originally started as human notes, but has evolved to store metadata
about a domain, for example encryption keys
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-sec-8" class="outline-2">
<h2 id="sec-8"><span class="section-number-2">8</span> Why Separate Names & Addresses?   <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-8">
<ul class="org-ul">
<li>Different semantic meaning
</li>
<li>May want other mappings: names to street addresses
</li>
<li>They don't have to be the same, so keep flexibility
</li>
</ul>
</div>
<div id="outline-container-sec-8-1" class="outline-3">
<h3 id="sec-8-1"><span class="section-number-3">8.1</span> Tradeoffs   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-8-1">
<ul class="org-ul">
<li>Flexibility wins again
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-sec-9" class="outline-2">
<h2 id="sec-9"><span class="section-number-2">9</span> Caching   <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h2>
<div class="outline-text-2" id="text-9">
<ul class="org-ul">
<li>Inefficient to always start at the root
</li>
<li>Instead, ask a "local" server
</li>
<li>"local" server does the recursive lookup, caches result
</li>
</ul>
<div class="figure">
<p><img src="img/dns-cache.png" alt="dns-cache.png"/></p>
</div>
</div>
<div id="outline-container-sec-9-1" class="outline-3">
<h3 id="sec-9-1"><span class="section-number-3">9.1</span> Why?   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-9-1">
<ul class="org-ul">
<li>Computers on a network likely to ask for the same stuff
</li>
<li>eg. all computers in this classroom probably have now asked for github.com
</li>
<li>Why have all of us do the full recursion?
</li>
<li>Instead have a nameserver on campus do the recursive lookup for us, cache
</li>
</ul>
<p>
the result
</p>
<ul class="org-ul">
<li>If it is in cache, and still valid just return answer
</li>
<li>DNS returns "time to live" that specifies how long result can be cached
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-sec-10" class="outline-2">
<h2 id="sec-10"><span class="section-number-2">10</span> Browsers   <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-10">
<ul class="org-ul">
<li>Type in a URL with domain name (eg. <code>yelp.com</code>)
</li>
<li>Browser uses DNS to find IP address (eg. <code>199.255.189.60</code>)
</li>
<li>Connects to address on a port (eg. <code>80</code>)
</li>
<li>Sends packets of data containing <code>GET / HTTP/1.1</code>
</li>
</ul>
</div>
<div id="outline-container-sec-10-1" class="outline-3">
<h3 id="sec-10-1"><span class="section-number-3">10.1</span> Packets   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-10-1">
<ul class="org-ul">
<li>Operating System typically breaks up a stream of data into packets
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-sec-11" class="outline-2">
<h2 id="sec-11"><span class="section-number-2">11</span> Highest selling domain names   <span class="tag"><span class="slide">slide</span> <span class="animate">animate</span></span></h2>
<div class="outline-text-2" id="text-11">
<ul class="org-ul">
<li>diamond.com $7.5 million
</li>
<li>fb.com $8.5 million
</li>
<li>porn.com $9.5 million
</li>
<li>fund.com $9.99 million
</li>
<li>hotels.com $11 million
</li>
<li>sex.com $13 million
</li>
</ul>
</div>
<div id="outline-container-sec-11-1" class="outline-3">
<h3 id="sec-11-1"><span class="section-number-3">11.1</span> Source   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-11-1">
<ul class="org-ul">
<li><a href="http://www.domaining.com/topsales/">http://www.domaining.com/topsales/</a>
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-sec-12" class="outline-2">
<h2 id="sec-12"><span class="section-number-2">12</span> IP is Unreliable   <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-12">
<ul class="org-ul">
<li>Best effort delivery
</li>
<li>No guarantees
</li>
<li>How do we build a reliable Web on it?
</li>
</ul>
</div>
<div id="outline-container-sec-12-1" class="outline-3">
<h3 id="sec-12-1"><span class="section-number-3">12.1</span> Components   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-12-1">
<ul class="org-ul">
<li>How to build stateful applications on stateless protocols?
</li>
<li>Keep state on the host
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-sec-13" class="outline-2">
<h2 id="sec-13"><span class="section-number-2">13</span> Transport Control Protocol   <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-13">
<dl class="org-dl">
<dt> Correctness </dt><dd>prevent data corruption
</dd>
<dt> Reliability </dt><dd>ensure delivery or error
</dd>
<dt> Ordering </dt><dd>add sequence numbers
</dd>
<dt> Congestion </dt><dd>back off
</dd>
</dl>
</div>
<div id="outline-container-sec-13-1" class="outline-3">
<h3 id="sec-13-1"><span class="section-number-3">13.1</span> Accurate delivery   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-13-1">
<ul class="org-ul">
<li>How do you know if the data you receive is the same as was sent? Checksum
</li>
<li>How does the sender know if a packet was delivered? Ack
</li>
<li>How do we know the ordering of the data? Packet sequence numbering
</li>
<li>TCP also adds "ports": ability to connect to a particular application on
the destination host
</li>
</ul>
</div>
</div>
<div id="outline-container-sec-13-2" class="outline-3">
<h3 id="sec-13-2"><span class="section-number-3">13.2</span> Checksum   <span class="tag"><span class="slide">slide</span></span></h3>
<div class="outline-text-3" id="text-13-2">
<ul class="org-ul">
<li>Take the bits in a message
</li>
<li>Add them up*
</li>
<li>Append the sum
</li>
<li>Example: "jim" = 106 + 105 + 109 = <b>320</b>
</li>
</ul>
</div>
</div>
<div id="outline-container-sec-13-3" class="outline-3">
<h3 id="sec-13-3"><span class="section-number-3">13.3</span> Details   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-13-3">
<ul class="org-ul">
<li>Many other ways of calculating besides addition, eg xor or polynomial
formulas
</li>
<li>Difference between checksum for errors and checksum against attackers
</li>
</ul>
</div>
</div>
<div id="outline-container-sec-13-4" class="outline-3">
<h3 id="sec-13-4"><span class="section-number-3">13.4</span> Ack   <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h3>
<div class="outline-text-3" id="text-13-4">
<ul class="org-ul">
<li>When a machine receives a packet, it acknowledges it
</li>
<li>If a machine does not receive an ack, it resends
</li>
<li>To keep track of messages, uses a sliding window
</li>
</ul>
<div class="figure">
<p><img src="img/tcp-window.png" alt="tcp-window.png"/></p>
</div>
</div>
</div>
<div id="outline-container-sec-13-5" class="outline-3">
<h3 id="sec-13-5"><span class="section-number-3">13.5</span> Window   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-13-5">
<ul class="org-ul">
<li>If the sender waits for every ack, things get pretty slow
</li>
<li>So instead we keep sending up to a certain point, but then if we don't hear
anything for a while we stop and wait for ack
</li>
<li>Like a good phone conversation
</li>
</ul>
</div>
</div>
<div id="outline-container-sec-13-6" class="outline-3">
<h3 id="sec-13-6"><span class="section-number-3">13.6</span> Sequence Numbers   <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h3>
<div class="outline-text-3" id="text-13-6">
<div class="figure">
<p><img src="img/ip-communication.png" alt="ip-communication.png"/></p>
</div>
<ul class="org-ul">
<li>If we can resend, or packets can take different routes, they can be
delivered in a different order
</li>
<li>How do we know the right order?
</li>
<li>Agree on a starting number, send numbered packets
</li>
<li>Client will keep track of packets received, deliver data in order to app
</li>
</ul>
</div>
</div>
<div id="outline-container-sec-13-7" class="outline-3">
<h3 id="sec-13-7"><span class="section-number-3">13.7</span> Tricks   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-13-7">
<ul class="org-ul">
<li>We can also use this as an optimization for acks: Send ack for <b>all</b>
packets < current one
</li>
<li>Agreement = "TCP Handshake"
</li>
</ul>
</div>
</div>
<div id="outline-container-sec-13-8" class="outline-3">
<h3 id="sec-13-8"><span class="section-number-3">13.8</span> Three-way Handshake   <span class="tag"><span class="slide">slide</span></span></h3>
<div class="outline-text-3" id="text-13-8">
<dl class="org-dl">
<dt> SYN </dt><dd>Synchronize using a random starting number
</dd>
<dt> SYN-ACK </dt><dd>Acknowledge syn packet with an ack number and its own random
starting number
</dd>
<dt> ACK </dt><dd>Acknowledge the SYN-ACK packet
</dd>
</dl>
</div>
</div>
<div id="outline-container-sec-13-9" class="outline-3">
<h3 id="sec-13-9"><span class="section-number-3">13.9</span> Timeline   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-13-9">
<ul class="org-ul">
<li>Client sends request
</li>
<li>Server responds
</li>
<li>Client responds
</li>
</ul>
</div>
</div>
<div id="outline-container-sec-13-10" class="outline-3">
<h3 id="sec-13-10"><span class="section-number-3">13.10</span> Congestion   <span class="tag"><span class="slide">slide</span></span></h3>
<div class="outline-text-3" id="text-13-10">
<ul class="org-ul">
<li>Why are packets delayed?
</li>
<li>Often, it is because the system is overwhelmed
</li>
<li>So back off! If it is still overwhelmed, back off more!
</li>
</ul>
</div>
</div>
<div id="outline-container-sec-13-11" class="outline-3">
<h3 id="sec-13-11"><span class="section-number-3">13.11</span> Exponential   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-13-11">
<ul class="org-ul">
<li>Wait 1 second, 2 seconds, 4, 8, 16…
</li>
<li>Randomize wait, so not everyone tries again at the same time
</li>
<li>Then ramp up again: larger packets, bigger window
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-sec-14" class="outline-2">
<h2 id="sec-14"><span class="section-number-2">14</span> Telnet   <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-14">
<ul class="org-ul">
<li>TCP/IP and DNS client
</li>
<li>Connects to a host at TCP/IP level
</li>
<li>Up to you to communicate with HTTP or any other protocol
</li>
<li>Does TCP/IP know about domains or hostnames?
</li>
</ul>
</div>
<div id="outline-container-sec-14-1" class="outline-3">
<h3 id="sec-14-1"><span class="section-number-3">14.1</span> No!   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-14-1">
<ul class="org-ul">
<li>That's why we must send <code>Host</code> header in HTTP
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-sec-15" class="outline-2">
<h2 id="sec-15"><span class="section-number-2">15</span> Flexibility   <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h2>
<div class="outline-text-2" id="text-15">
<ul class="org-ul">
<li>TCP/IP most commonly used, but not the only ones!
</li>
<li>UDP (User Datagram) used for DNS
</li>
<li>Realtime protocols (voice, video) may value timeliness over correctness
</li>
</ul>
<div class="figure">
<p><img src="img/protocols.png" alt="protocols.png"/></p>
</div>
</div>
</div>
<div id="outline-container-sec-16" class="outline-2">
<h2 id="sec-16"><span class="section-number-2">16</span> Composability!   <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-16">
<ul class="org-ul">
<li>Internet is a network of networks
</li>
<li>IP used to send packets between two addresses
</li>
<li>DNS maps names to addresses
</li>
<li>TCP ensures reliable communication
</li>
<li>Web built on Internet technology
</li>
</ul>
</div>
<div id="outline-container-sec-16-1" class="outline-3">
<h3 id="sec-16-1"><span class="section-number-3">16.1</span> Notes   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-16-1">
<ul class="org-ul">
<li>Each component evolved, and we're not stuck with any one particular
technology
</li>
<li>But all parts must be working correctly for users to get a great experience
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-sec-17" class="outline-2">
<h2 id="sec-17"><span class="section-number-2">17</span> Overview   <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-17">
<div class="figure">
<p><img src="img/overview.png" alt="overview.png"/></p>
</div>
</div>
<div id="outline-container-sec-17-1" class="outline-3">
<h3 id="sec-17-1"><span class="section-number-3">17.1</span> Overview   <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-17-1">
<ul class="org-ul">
<li>What do these arrows represent? TCP/IP connections
</li>
<li>What kind of requests are being made to the DNS server?
</li>
<li>What is in the "payload" of the first TCP/IP packets sent to the web
</li>
</ul>
<p>
server? (GET … HTTP/1.1)
</p>
<script type="text/javascript" src="production/org-html-slideshow.js"></script>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Jim Blomo</p>
<p class="date">Created: 2014-10-10 Fri 08:17</p>
<p class="creator"><a href="http://www.gnu.org/software/emacs/">Emacs</a> 23.4.1 (<a href="http://orgmode.org">Org</a> mode 8.0.6)</p>
<p class="xhtml-validation"><a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a></p>
</div>
</body>
</html>