Open jasperzhong opened 3 years ago
要解决这些问题需要对basic infrastructure有大改动. 后面提到的SDN能解决上述问题.
来自这篇paper: The Design Philosophy of the DARPA Internet Protocols. 1988.
fundamental goal: multiplexed utilization of existing interconnected networks. 这里面有两个重点:
所有packet共享网络资源. 提供best effort服务. 缺点是这个shared resource会有delay.
对比的是电话那种circuit switching方式, 有一条dedicated path.
说的是IP层. 所有internet device都必须有IP层,也叫network layer. IP层上下层都有很多协议,但IP stack只有一个. goal: interconnect many existing networks, hide underlying technology from applications.
survivability: network works even if some devices fail. 有两种选择: -> replication -> fate sharing: the state of a particular device shares the fate of the device itself.
Heterogeneity: TCP和UDP有其各自场景. 比如streaming, DNS啊不一定每次都要成功,UDP best effor这种方式也是可以的,但是对于debug就很困难.
Distributed management: Internet没有一个owner. 管理是分布式的.
而这篇paper没有提到:
这是篇重要的paper. 1981.
The function in question can completely and correctly be implemented only with the knowledge and help of the application standing at the end points of the communication system. Therefore, providing that questioned function as a feature of the communication system itself is not possible. (Sometimes an incomplete version of the function provided by the communication system may be useful as a performance enhancement.)
summary: Dumb network, intelligent endpoints
说实话,这段话没怎么看懂. 这里说的end指的是协议的最上层,一般是应用层. 知乎上有一篇解释文章: https://zhuanlan.zhihu.com/p/55311553
这个argument有一些violations: NAT, VPN, TCP splitting...
network address translation. 就是只有一个public ip,但是可以在内部网络分配很多private ip. 通过转换表实现,用端口对应机器.
NAT violates end-to-end argument.
LAN内p2p发送消息需要知道对方的MAC address. 但一般只知道ip地址,而不知道MAC地址,所以需要ARP协议来自动获得MAC地址. 每个网卡都有一个唯一的MAC地址. ff:ff:ff:ff:ff:ff是广播地址.
ARP原理:广播询问某个ip是谁的消息. 某个机器收到消息后发现是自己,就回复自己的MAC address. 收到这个MAC address后记录在ARP Table.
有了MAC address后,在数据链路层的包上填写src/dst MAC address.
最简单连接LAN的方式就是用Hub,其特点是收到消息后会广播消息.
这样会导致
这种方式已经淘汰.
实现转发功能. 需要switch table: 把MAC地址映射到port. 其实就是记录已经接收的packet来自于哪个端口. 如果表中找不到记录,就flooding.
但由于还是有broadcast. 如果拓扑中有环就会有问题.
对比switch和router:
switch的主要缺点是broadcast. 因为spanning tree topology和ARP queries的网络负载高.
一个rule of thumb是Buffer size = 2 T C. T是RTT, C是带宽.
后面讲TCP的buffer size有点超出我的知识范围了...
TCP flow control:
Flow control: limits the rate a sender transfers data to guarantee reliable delivery. The receiver continually hints the sender on how much data can be received (controlled by the sliding window). When the receiving host's buffer fills, the next acknowledgment contains a 0 in the window size, to stop transfer and allow the data in the buffer to be processed.
注意TCP header有一个window size字段. 另外TCP还有window scaling option. 默认的max window size是65536(因为只有16Bytes).
TCP congestion control算法叫做AIMD (additive-increase/multiplicative-decrease).
The approach taken is to increase the transmission rate (window size), probing for usable bandwidth, until loss occurs.
rate = Window size / RTT.
大概意思是出现congestion的时候. Rate = W / (RTT + B / C) . B是buffer size. C是bandwidth. B / C是 queuing delay. 然后我们希望congestion前后的sender rate是一样的. 最后得到d的 B还是等于 2TC.
最后说了实际中由于有很多sender,sender是不同步的,所以出现的峰值是比较平滑的. 最后结论是所需要的是 2TC / sqrt(n). n是flow数量.
TCP - segment IP - datagram data link - frame
From Cloudflare:
The Internet is a network of networks*, and autonomous systems are the big networks that make up the Internet. More specifically, an autonomous system (AS) is a large network or group of networks that has a unified routing policy. Every computer or device that connects to the Internet is connected to an AS.
https://www.cloudflare.com/learning/network-layer/what-is-an-autonomous-system/
Autonomous Systems (AS) 自治系统
AS一般包括
routing: where to forward messages
距离向量路由协议
problem: count to infinity..就是如果一条链路延迟很大(甚至断了),那么这个表会更新很缓慢. solution: poison reverse. wiki上有不错的解释. https://en.wikipedia.org/wiki/Split_horizon_route_advertisement
Example: routing information protocol (RIP) 路由信息协议
目前用的更广. 每个node把自己的network map发给其他所有node. 然后每个node计算到其他所有点的最短路径. 用dijkstrta算法.
典型代表:
缺点是复杂度太高 O(N^3). N是节点数量.
应对办法是hierarchy,分成几个area. area内部算最短路径, area与area直接算最短路径. 所以可以看作是2-level的最短路径. 妙啊.
需要理解几个东西
https://www.udacity.com/course/computer-networking--ud436