* [????? ????](#?????-????) * [?????????](#?????????) * [ISP](#isp) * [???????????](#???????????) * [?????????????](#?????????????) * [??﹞??????????](#??﹞??????????) * [1. ??﹞????](#1-??﹞????) * [2. ???????](#2-???????) * [3. ?????](#3-?????) * [???](#???) * [1. ???????](#1-???????) * [2. ???????](#2-???????) * [3. ???????](#3-???????) * [4. ??????](#4-??????) * [??????????????*](#??????????????) * [1. ???尿??](#1-???改??) * [2. ???尿??](#2-???改??) * [3. ???????????????????](#3-???????????????????) * [4. TCP/IP ?????](#4-tcpip-?????) * [????? ?????](#?????-?????) * [?????](#?????) * [???????](#???????) * [??????邦???](#??????邦???) * [1. ?????芍???????](#1-?????芍???????) * [2. ?????????](#2-?????????) * [3. ???????](#3-???????) * [4. ??????](#4-??????) * [?????? ??????﹞??](#??????-??????﹞??) * [????????????](#????????????) * [1. ??????](#1-??????) * [2. ???????](#2-???????) * [3. ?????](#3-?????) * [??????? -PPP 尿??](#???????--ppp-改??) * [????????????](#????????????) * [????? - CSMA/CD 尿??*](#?????---csmacd-改??) * [??????](#??????) * [MAC ??](#mac-??) * [?????????](#?????????) * [?????? ?????*](#??????-?????) * [????尿?? IP ????](#????改??-ip-????) * [IP ????????](#ip-????????) * [IP ??????](#ip-??????) * [1. ????? IP ???](#1-?????-ip-???) * [2. ????????](#2-????????) * [3. ??????? CIDR???????????](#3-???????-cidr???????????) * [IP ????? MAC ???](#ip-?????-mac-???) * [???????尿?? ARP](#???????改??-arp) * [﹞???????](#﹞???????) * [????????﹞??????????](#????????﹞??????????) * [﹞???????????????](#﹞???????????????) * [﹞?????尿??](#﹞?????改??) * [1. ???????尿?? RIP](#1-???????改??-rip) * [2. ???????尿?? OSPF](#2-???????改??-ospf) * [3. ??????尿?? BGP](#3-??????改??-bgp) * [??????????尿?? ICMP](#??????????改??-icmp) * [??????????? PING](#???????????-ping) * [IP ??](#ip-??) * [????????? VPN](#?????????-vpn) * [????????? NAT](#?????????-nat) * [?????? ?????*](#??????-?????) * [UDP ?? TCP ?????](#udp-??-tcp-?????) * [UDP ??????](#udp-??????) * [TCP ??????](#tcp-??????) * [TCP ??????????](#tcp-??????????) * [TCP ????竹???](#tcp-????竹???) * [TCP ????????](#tcp-????????) * [TCP ???????](#tcp-???????) * [TCP ????????](#tcp-????????) * [TCP ???????](#tcp-???????) * [??????????????](#??????????????) * [??????????](#??????????) * [?????? ??辰?*](#??????-??辰?) * [?????? DNS](#??????-dns) * [1. ??糸?](#1-??糸?) * [2. ????????](#2-????????) * [???????尿?? FTP](#???????改??-ftp) * [??????尿?? TELNET](#??????改??-telnet) * [????? WWW](#?????-www) * [???????尿??](#???????改??) * [POP3](#pop3) * [IMAP](#imap) * [SMTP](#smtp) * [???????????尿?? DHCP](#???????????改??-dhcp) * [?????? P2P](#??????-p2p) * [Web ??????????](#web-??????????) * [??????](#??????) * [?羊?????](#?羊?????) # ????? ???? ## ????????? ????????????????????????????????????????????????????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/04ff7ae6-7bee-4cf8-82f8-dfe2ba1f3616.jpg) ## ISP ?????????????? ISP ??????????????????????? IP ???????????????﹞???﹞???????????蘟???????????? ISP ????????????????????????? ????????????????? ISP ????ISP ?????????????妊??????? ISP?????? ISP ????? ISP?? ???????????? IXP ?????????????????????????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/17d807ef-03bf-4824-a97c-ea5fb58ec61d.jpg) ## ??????????? 1. ?????????????????????????????????????????????? 2. ??????????????????????????宏?????﹞??????阱???????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/005d83c2-e64a-41f0-bbdd-51c71d494a18.jpg) ## ????????????? **1. ??? - ????????C/S??** ???????????????????????????????? **2. ????P2P??** ????????????????? ## ??﹞?????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/b97958dd-3e43-45f7-97f5-3ec20f3f8b88.jpg) ### 1. ??﹞???? ??﹞????????朝????????????????????????????????????????﹞?????????????????????????????﹞??????????????志?????????????????﹞??????﹞????????﹞??????????????????? 10%?? ### 2. ??????? ?????????????????????????????????????????????????????????????????????????????????????????????????? ### 3. ????? ??????????????????????????????????????????????????????????????????????????????????????戒??????????????????妊????????戒??????????????????????????????????????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/6f4af159-8b03-4246-8d0e-222db65bb83c.jpg) ???????????????????﹞???????????????????????????????????????﹞????? ?????????????????????????妊????????????????? ## ??? ????? = ??????? + ??????? + ??????? + ?????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/ceee91c2-da26-4169-94c3-e4608b46b9ac.png) ### 1. ??????? ??????﹞??????????????????????? ![](http://latex.codecogs.com/gif.latex?\\\\delay=\frac{l(bit)}{v(bit/s)}) ???? l ??????????????v ???????????? ### 2. ??????? ??????????忱???????????????????????????????????????? ![](http://latex.codecogs.com/gif.latex?\\\\delay=\frac{l(m)}{v(m/s)}) ???? l ???????????v ??????????????????????? ### 3. ??????? ??????﹞???????????????忱???????????????????????????????????????????? ### 4. ?????? ??????﹞????????????抗????????????????????????????緙?????????? ## ??????????????* ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/1005dc9d-9049-4b06-9524-6171e56ebd8c.png) ### 1. ???尿?? ??? a ????????忌???????????????? 1. ??????????????????????????????????????????????????????? 2. ?????????????????????????????? ### 2. ???尿?? 1. ??辰???????車??????????????????? HTTP??DNS ????????竹?????? 2. ???????????????????????????????????辰?尿?????????????????尿???????????????????辰?尿?????????????尿????????尿?? TCP?????????????????????????????????竹?????曳?????????尿?? UDP????????????????????????????????????竹??????????? 3. ???????????????????????????????尿??????????????快?????????????????????????????竹????????????????????????忱??? 4. ??????﹞??????????????????????????????????抗????﹞????﹞??尿???????????????????????????﹞?????????????????????? 5. ?????????????????????????????????????????????????????????^????????????????????汛????????????汍???????????????????﹞??抉???????宏???? ### 3. ??????????????????? ???????????孝??????????尿????????????????汕?????????????????志?????????汕???? ﹞???????????????尿????﹞????竹??????????孝????????????????車????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/f7d5da89-2d75-4d8f-85e7-6b608865dc00.jpg) ### 4. TCP/IP ????? ???????????????尿??????????﹞?????????????????? ????? TCP/IP ????????????? OSI ????????辰??????????? IP ???????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/3e2200b3-1c18-4853-ae42-7788e8e1f939.png) TCP/IP 尿?????????????????技?妊?????IP 尿????????????????????竹?? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/9ecaebee-670e-4cb2-9cdb-3029c00f33bd.png) # ????? ????? ## ????? 1. ???????????????????? 2. ?????????????????????? 3. ????????????????????? ## ??????? ?????????????????????????????????????????????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/d2c55c84-aa1f-43c1-bd97-457bcb7816b3.png) ## ??????邦??? ### 1. ?????芍??????? ??????????????????????????辰????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????????????????????????????????車???????????????????????????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/543d47a1-f0dd-414f-b23c-0c142c814854.png) ### 2. ????????? ??????????????????????????????????????快?竹??????????????????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/29058e09-bb72-4040-a73d-4c497895e9ce.jpg) ### 3. ??????? ????????芍??????????????????????辰????????????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/78534153-88d1-4f83-a6e0-59064dbdc43a.png) ### 4. ?????? ??????????? m bit ??????????????快????????????????????????? $\vec{S}$ ?? $\vec{T}$ ?? ![](http://latex.codecogs.com/gif.latex?\\\\\vec{S}\cdot\vec{T}=0) ??????? m=8??????? $\vec{S}$ ? 00011011??????我???????????????? 1 ??????????????????? 0 ??????????????? 11100100?? ???????? 00011011 ???? (-1 -1 -1 +1 +1 -1 +1 +1)???????? ![](http://latex.codecogs.com/gif.latex?\\\\\frac{1}{m}\vec{S}\cdot\vec{S}=1) ![](http://latex.codecogs.com/gif.latex?\\\\\frac{1}{m}\vec{S}\cdot\vec{S'}=-1) ???? $\vec{S'}$ ? $\vec{S}$ ????? ?????????????????????????????????? $\vec{S}$ ????????????????????????????? 0 ????????????????????????? 1 ??????????????? 1?????? -1 ??????????????? 0?? ?????‾??????????????? m ???? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/0042edad-8e3b-4279-bd93-6906fcd1b640.jpg) # ?????? ??????﹞?? ## ???????????? ### 1. ?????? ????????????????????????汕?????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/ea5ed9b2-6d9f-48fb-b890-0288caf9088a.jpg) ### 2. ??????? ???????????????????????????????????? ??????????汕???????????????????抗????汕?????????????????????????竹??????????忪?????????????忍??????汕???????????????????????????????????????????????????????????????????????????????????????????忱???????????????????????????????????????????????????????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/44e1d90e-3fe6-4dd6-8dce-6daab12e7663.jpg) ### 3. ????? ????????﹞?????????????????龢CRC???????????? ## ??????? -PPP 尿?? ??????????????????????? ISP ?????????????????PPP 尿??????????????? ISP ????????????????????﹞??尿? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/8b5bd2c8-8425-4a8b-89db-235c95800de9.jpg) ?? PPP ????孝?F ?????????????A ?? C ?????????^FCS ????? CRC ????????妊??????汍????????? 1500?? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/a5fa89e7-54b9-4e2f-8c48-a35712d7b2f5.jpg) ## ???????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/8b15e36f-69b4-46b6-a07c-7234ac7c7927.jpg) ## ????? - CSMA/CD 尿??* ????????????????????????????????????? CSMA/CD ???????????????? / ?????? **??????**??????????????????縺?????????????????????????? **???????**?????????????????????????????????????????????????????????? **??????**????????孝??????????????????????????????????????????????????????????????????????????????????孝??????????????????????????????扭??????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/f9ed4da5-0032-41e6-991a-36d995ec28fd.png) ?????????????? ??????????????????? 2?? ?????????????????????? 2?? ? **??????**????抉??????????????技???????????????灰????????????? ??????????????????????????????????????????????? **????????????????** ?????????????????????? {0, 1, .., (2k-1)} ??????????????????? r?????? r ?????????????????????? ## ?????? ????????????邦??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????妊? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/897a4f4e-2683-44e1-a26a-c0d0234dc576.jpg) ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/40c3f8e5-3a20-45b6-a60c-77b9b952e104.jpg) ## MAC ?? MAC ????? 6 ????48 竹????????????朵????????????????????忪???????????忪?? MAC ?????????????????????????????????????????????????????? MAC ???????????????????????尿???????污????? 46-1500 ???????妊????????FCS ?????????孝??????? CRC ????????????????????????????? FCS ???????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/50d38e84-238f-4081-8876-14ef6d7938b5.jpg) ## ????????? ??????????????????????竹?????????????????????????????快????????????????????????? (A1, A2, A3, A4) ??????????????????A1 ???????? A2??A3??A4 ????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/a74b70ac-323a-4b31-b4d5-90569b8a944b.png) # ?????? ?????* ## ????尿?? IP ???? ??????????????????????????????????????????????????????????????????????????????????????????????? ??? IP 尿?????????????????????????????????????????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/fe3d224c-8ffd-40f9-85b1-86ffe1393f6c.jpg) ?? IP 尿?????????????????尿? 1. ???????尿?? ARP??Address Resolution Protocol?? 2. ??????????尿?? ICMP??Internet Control Message Protocol?? 3. ?????????尿?? IGMP??Internet Group Management Protocol?? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/163cf8b4-5f30-46c9-af00-316a71b3c890.jpg) ## IP ???????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/8681db55-0873-434b-aa98-83d07e8392ae.jpg) **?煆** : ?? 4??IPv4???? 6??IPv6????????? **???????** : ? 4 竹?????????? 15???? 1 ??????? 1 ?? 32 竹???????????? 4 ?????????????????? 20 ???????????妊? 5??????????????????? 4 ????????????????汕?????????????? **???????** : ??????????????????????????芍? **?????** : ??????????????????????? **???** : ?????????????????????????????????????????????????????????????? **????** : ????????????????????????????????竹? 8 ???? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/45c86855-9b18-4cf4-a9a7-f8b6eb78d133.png) **???????** ??TTL????????????????????????????????????志??????????﹞???????????竹???? TTL ? 0 ????????????? **尿??**?????岐???????????????????尿????忱??????? ICMP??TCP??UDP ??? **????????**??????????????????﹞????????????????????????????????????????????????????????? ## IP ?????? IP ?????????????????????????曳? 1. ????? IP ????? 2. ?????????? 3. ????????? ### 1. ????? IP ??? ????????????????????????????志???????志???????????????????????? IP ??? ::= {< ????? >, < ?????? >} ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/2ddd6132-60be-4a72-9daa-3d9756191f4a.png) ### 2. ???????? ?????????????????????????????????????? IP ???????????? IP ?????????????點?????????????? IP ??? ::= {< ????? >, < ?????? >, < ?????? >} ????????????????????????????? B ?????????????????? 255.255.0.0????? B ???????????????????????????????? 11111111 11111111 11000000 000000??????? 255.255.192.0?? ### 3. ??????? CIDR??????????? CIDR ???????? A ??B ??? C ????????????????????????????????????????? IP ??????忌?????????????????????????? IP ??? ::= {< ???????? >, < ?????? >} CIDR ??????????? IP ?????????????????????????????? 128.14.35.7/20 ???? 20 竹????????? CIDR ??????????????????????????????????? 1 ????????????????? ??? CIDR ????????抗????????? CIDR ??????????????????????????縺??????﹞????????????﹞????????????????﹞?????????﹞????????????????????????????????????﹞???????????﹞?????????????????? ??﹞????????????阱?????????????????????????????????????????????????????????????????? ## IP ????? MAC ??? ????????????????????????﹞?????????????﹞????????????????????孝?IP ?????????????????????????? MAC ?????????﹞???????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/86b71296-0d1e-4a63-bcd9-54955b6b781b.jpg) ## ???????尿?? ARP ????? IP ?????? MAC ????? ?????????????? ARP ??????????????????? IP ??? ?? MAC ?????????????孝?????????????????? ARP ????????? IP ????????????? ARP ????????? MAC ????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/8bc6fc2c-d198-4759-b06c-18d94d851e97.png) ## ﹞??????? ﹞??????????????????﹞?????????????? ??????????????????????????????????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/3a676c54-b559-4466-9b21-eb10f1e25879.jpg) ???????????????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/7f82fd18-7f16-4125-ada6-bb6b795b4fda.png) ## ????????﹞?????????? - ??????????????????﹞??????? MAC ????????? MAC ????????﹞????????????????????????? IP ????? MAC ???????? - ﹞????竹???????????? IP ????????? IP ??????????????﹞???????﹞?????????﹞??? ## ﹞??????????????? 1. ???????????????????????? IP ??? D?????????????? N????﹞????????????????? IP ???????????????????﹞???????????? 2. ?? N ???????﹞????????????????????????????????????? 3. ??﹞????????????? D ?????????﹞????????????????????????????????﹞?????? 4. ??﹞??????快??????? N ??﹞????????????????﹞?????????????????﹞?????? 5. ??﹞?????????????﹞????????????????﹞???????????????﹞?????? 6. ?????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/8d211911-0e62-4190-ab00-d8610adec4a0.jpg) ## ﹞?????尿?? ??????????﹞?????尿?Y??????????????????????????????????????????快????? ??????????????????妊???????? AS????? AS ????????????? AS ?????﹞?????尿? ?????﹞?????尿?l????????? 1. ???????尿?? IGP??Interior Gateway Protocol?? ????????????????? RIP ?? OSPF?? 2. ??????尿?? EGP??External Gateway Protocol?? ????????????????? BGP?? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/e0be6970-5b0e-44a2-bc71-df4d61c42b8f.jpg) ### 1. ???????尿?? RIP RIP ??????????????????????﹞?????尿???????????????????????﹞????????? 1?????????? 15?????? 15 ???????? RIP ????????????????????﹞?????????????﹞???????????糸??????????﹞?????????????????????????百?????????????????????﹞????????? ???????????? 1. ????? X ??????﹞?????????? RIP ??????????????快?????????????????????快?????? X?????????快??????米? 1?? 2. ??????? RIP ?????快????????????????????帩 - ???????﹞??????????????? N?????????????﹞????孝? - ???????????﹞????????? X??????????????I???﹞????快?????????????????????快???? d 妊??﹞????快????????我??????????﹞?????? Net2, 5, P???㊣???? Net2, 4, X??????????????????????? 3. ?? 3 ???????????????﹞?????????﹞???????????﹞?????????????????????? 16?? RIP 尿???????????妊?????? RIP ????????????? 15???????????????????????????????????????????????????????????????????﹞?????? ### 2. ???????尿?? OSPF ???????﹞?????? OSPF????????? RIP ????????????????? ?????? OSPF ???????????????????????????????﹞???????????????? Dijkstra ????????﹞???? SPF?? OSPF ??????????? 1. ?????????快?????﹞?????????????????????????? 2. ??????????????????﹞????????﹞??????﹞??????????宏﹞?????????????﹞????????????‾??芍????????????????????? 3. ??快???﹞??????????﹞?????????????? ????﹞??????????????????????????????????????? RIP??OSPF ???????????????? ### 3. ??????尿?? BGP AS ????﹞????????????????????????????????? AS ?????辰????﹞?????尿????????????﹞????????????? AS ????﹞???????????抄????????????宏 AS ??????????? AS ?????? BGP ??????????????﹞????????????﹞?阱???????﹞??????﹞?????尿? ??? AS ?????????? BGP ???????????????????? BGP ?????????? TCP ??????????﹞??????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/eb6271de-22c9-4f4b-8b31-eab1f560efac.png) ## ??????????尿?? ICMP ICMP ????????完????? IP ???????????????????????????? IP ??????孝????????????尿? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/9b5e0fa0-9274-4219-a3a9-84fbb509c735.jpg) ICMP ??????????蜼?????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/6e11b122-95ce-4869-bf7d-3b0d7591707e.jpg) ## ??????????? PING PING ?? ICMP ???????????????????????????????????????? PING ?????? 1. PING ???????汍???????????????????? MAC ??????????????????????????? MAC ??????????????? ARP ???? 2. PING ??????汍?????????????????????????????????????????????????????????? MAC ????????? MAC ???????????? ## IP ?? ???????????孝?????????????`?????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/c77b6a18-dfac-42a2-ac89-7e99481275dc.jpg) ## ????????? VPN ???? IP ???????????????????????? IP ??????????妊???????????快????????????????????????????????快???????????????????孝?????????????????????????????完?? IP ?????????????? ???????????? 1. 10.0.0.0 \~ 10.255.255.255 2. 172.16.0.0 \~ 172.31.255.255 3. 192.168.0.0 \~ 192.168.255.255 VPN ??迄???????????????????????????????????^?????????????????????????????????????????????????????????????????????抉??????????????? ????孝????? A ?? B ????????????????????????? A ?????? X ???????????? B ?????? Y ????IP ????????????? 10.1.0.1????????? 10.2.0.3?????????????????????????﹞???? R1??R1 ???????????技????????????????????????????????﹞???? R1 ??????? 125.1.2.3?????????﹞???? R2 ??????? 194.4.5.6??﹞???? R2 ???????????????????扶???????????????????????????? 10.2.0.3????????? Y?? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/bf4ed077-d481-4db7-9e7a-85d841a5a8c3.jpg) ## ????????? NAT ???????????????????? IP ????????????????????????????????? NAT ???????? IP ??????? IP?? ???????NAT ?????? IP ????? IP ?????????????????? n ????? IP ???????????????????????? n ?????????????????????完????????? IP ????????????? NAT ???????????????????????????????????????????????????????????? IP ???????????? NAT ?????????????????? NAPT?? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/0f31bc7a-d60b-48a6-8e3f-597708369e52.png) # ?????? ?????* ????????????????????????????????????????????????????快????? ??????????????????????????????????????????????????????????????車???????????????????????????????????????????????? ## UDP ?? TCP ????? ????????尿?? UDP??User Datagram Protocol?? ???????尿?? TCP??Transmission Control Protocol?? UDP ???????????????????????????????????????????????車????????????????????????????? UDP ??????? TCP ???????????????????????????????????????????????????????????????????辰?????????????????????????????????妊????????? ## UDP ?????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/bd6c05f3-02ee-4c8a-b374-40c87154a898.jpg) ????????? 8 ????????????????????????????????12 ????汐???????????????????????? ## TCP ?????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/21a00b02-c0a6-4bcd-9af0-5ec6bb66e34c.jpg) **???** ???????????????忌??????????? 301????????????????? 301?????岐???????????? 100 ????????????????汍?????? 401?? **????** ????????????????????汍????????? B ?????? A ???????????????曳????? 501??岐???????????? 200 ??????? B ?????????????汍????? 701??B ????? A ????????????????? 701?? **???????** ????????????????????????????????????????????????????? **??? ACK** ???? ACK=1 ??????????完????????完??TCP ?梀????????????????忱???????汎?????? ACK ?? 1?? **??? SYN** ????????????????????????? SYN=1??ACK=0 ?????????????????????曲??????????????????????????? SYN=1??ACK=1?? **??? FIN** ??????????????????? FIN=1 ???????????汍????????????????????????????????????? **????** ????????????????‾?????????????????????????????????????????????????????????????????? ## TCP ?????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/086871db-5871-460f-97b7-126cd738bb0e.jpg) ???? A ???????B ?????????? 1. ???? B ???? LISTEN???????????????????????????? 2. A ?? B ??????????????曳?SYN=1??ACK=0???????????????? x?? 3. B ?????????????曳?????????????????? A ??????????????曳?SYN=1??ACK=1??????? x+1??????????????????? y?? 4. A ??? B ????????????百????? B ????????????? y+1?????? x+1?? 5. B ??? A ??????????????? ## TCP ????竹??? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/78f65456-666b-4044-b4ee-f7692dbbc0d3.jpg) ??????????????????????????????????????????????????? ACK????? ACK ????????????? 1?? 1. A ??????????????曳?FIN=1?? 2. B ?????????????? TCP ???????????B ???? A ??????????? A ?????? B ????????? 3. ?? B ????????????????????????????????曳?FIN=1?? 4. A ????????????????????? **TIME_WAIT** ?????????????????? FIN ???????????????????????????? CLOSED ?????????????????????????????????????????????? 1. ?????????????????????????? B ???? A ??????????????曳??????????﹞????????????????曳?A ???????????????????????????????? 2. ??????????????完????????????曲???????????????污??????????????????????????? ## TCP ???????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/223fc26e-2fd6-484c-bcb7-443cac134f15.jpg) ???????????????????????????????????????????????????????????????? TCP ??????快??????牟????????????????妊?????????????????????????????????????妊?? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????? {31, 32, 34, 35}?????? {31, 32} ??????? {34, 35} ??????????????? 32 ????????????????????????????????????????????????????????????? ## TCP ??????? TCP ??車????????????????????????????????????????????????????????????????????曲? ???????汛????????????????????????????????? RTT??????????????? RTTs ????????? ![](http://latex.codecogs.com/gif.latex?\\\\RTTs=(1-a)*(RTTs)+a*RTT) ??????????????? RTO ???????? RRTs??TCP ????????????????? ![](http://latex.codecogs.com/gif.latex?\\\\RTO=RTTs+4*RTT_d) ???? RTTd ??????????? RRT ?? RRTs ?抄?? ## TCP ???????? ????????????????????????????????????????邦?????? ?????????????????快??????羊????????????????????妊????????????????????????簇???????????? 0??????????????????? ## TCP ??????? ??????????????????q????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????邦??????????????????????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/a69af9bb-b5ad-4896-862d-697e5ee4feb1.png) TCP ?????????????????????????????????????????????????????????????????????????????????cwnd???????????????????????????????????????????????????????????????????????????????????????????? ???????????????????帩 1. ?????????????????????????????????? 2. ??? TCP ?????????????????????楚????妊??竹?????曲? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/346244ff-98c1-4f12-9a87-d0832e8c04cf.jpg) ### ?????????????? ???????????????????? cwnd=1????????????? 1 ??????曳??????????? cwnd ?????????????????????????????2??4??8 ... ?????????????汎??? cwnd ????????????? cwnd ????????????????‾????????????????????????????????????????????????????????? ssthresh???? cwnd >= ssthresh ??????????????????????? cwnd ?? 1?? ????????????????? ssthresh = cwnd / 2??????????????????? ### ?????????? ?????????????糸????????汎???‾???????????????汍????????????????? M1 ?? M2???????? M4?????????? M2 ?????? ????????????????????????????????????????????汎??????????????? M2 ???? M3 ??????????扭??????????????????????曲? ???????????????????????曳?????????????????????扭??????? ssthresh = cwnd / 2 ??cwnd = ssthresh????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/b18d679b-c8e2-4564-88ee-7600090e46da.jpg) # ?????? ??辰?* ## ?????? DNS ????????????? IP ????? ????????????? ### 1. ??糸? ?????????????牝????????????????????????????????????????????????????????????????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/c2117f61-1177-4768-bf33-cf4f950d911c.png) ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/a4b162e5-db2a-4a27-b213-1fe481c5a06a.png) ???????????????????????? **(1) ????????????**???????????????? **(2) ??????????????**???????????????? **(3) ?????????????**????????????????? ?????????????????????????抖?????????? b ???? abc.com ?抖?????????????abc.com ?? y.abc.com ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/fc0c6b2d-68c7-4de8-aaaa-97355a4f0472.jpg) ?????????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/8b335d94-c1ca-42e1-ad48-bb179d28a4f1.jpg) **(4) ??????????????**????????????????????????????????????????紫 ### 2. ???????? ??????????????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/6bc61bb8-3b1c-4dc8-ac25-cef925ace0eb.jpg) ## ???????尿?? FTP FTP ?????????? TCP????????????????????快? TCP ????????????????????????????????????????????????????????????????????????????????????????????? 21???????????????? 20?? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/58633775-8584-4a01-ad3f-eee4d9a466e1.jpg) ## ??????尿?? TELNET TELNET ????????????????????????????????????????? TELNET ??????????????????????????????????????????戒????^ ## ????? WWW ?? HTTP ???? ## ???????尿?? ??????????????????????????????????????????????????尿?????尿????戒???尿?讌?? SMTP?????尿?讌?? POP3 ?? IMAP?? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/de1e46d2-748f-4da3-a29e-7de7bc840366.jpg) ### POP3 POP3 ?????????????????????????????????????????? ### IMAP IMAP 尿???扭???????????????????????????????????????????????????????????????????IMAP ?????????????????????????????????????????IMAP 尿???????????????????妊? ### SMTP SMTP ?????? ASCII ????????????????? MIME ?????????????????MIME ????我????????? SMTP???????????????????????????? ASCII ????????? ![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/ed5522bb-3a60-481c-8654-43e7195a48fe.png) ## ???????????尿?? DHCP DHCP ???????????????????????????????????? IP ?????????? DHCP ?????????????? IP ??????????????????????﹞???? IP ????????????????? IP ????? ??????????????? IP ??????????????? DHCP ??????????????????? 1???? 255.255.255.255:67???????????? 0???? 0.0.0.0:68????DHCP ??????????????????????? IP ???????????????????? DHCP ??????????????? ## ?????? P2P ????????????????忪???????????????????????????????????????妊??????????????????????????????????????????????????????????????????????宏?????????????????????????宏???? ?????????????????????????????????????????????????????????????????????????????????????????????妊????????百???????????????????? ???????????????????????????????????????????????????????????????宏?????????????????宏????????????????????????????Y????????????扶??妊? ??????????????????????????????????????????????????????????????????????????我???????????????????????????? ???????????????????????????????????????????????????????????????????? P2P ??????????????百?????忪?????????????????‾?????忌? DHT?????????????快?????? IP ?????? ## Web ?????????? 1. ?? DNS ?????????? DNS ??????????????????? 2. ??????? HTTP ???????????? TCP ????? 3. ???????????????孝?HTTP ?????????? TCP ?妊?HTTP ???????????? 80??????????????????? 80 ?????????????????????????????????????????????????? TCP ???????????????????? 4. ???????????????孝?TCP ????竹?????? IP ?????孝?IP ??????﹞?????????????? 5. ????﹞??IP ?????????? MAC ??孝?IP ????????? MAC ????????? ARP?? 6. ???????? HTTP ???????????????紫 7. ?????????? HTTP ??????????????????????紫 8. ?????????????????????????????????????紫 ## ?????? | ??辰?尿?? | ???? | ?????尿?? | | -- | -- | -- | | DNS | 53 | UDP | | FTP | ???????? 21?????????? 20 | TCP | | TELNET | 23 | TCP | | DHCP | 67 68 | UDP | | HTTP | 80 | TCP | | SMTP | 25 | TCP | | POP3 | 110 | TCP | | IMAP | 143 | TCP | # ?羊????? - ????????? ????? - ???????????????