几点注意:
1. 这篇文章是我复习KTH课程Internetworking时的学习笔记。主要的参考资料为课本与课件。
课本:Behrouz A. Forouzan, TCP/IP Protocol Suite, 3nd Edition, 2005, McGraw-Hill, ISBN 0-07-296772-2
2. 全文篇幅比较长,建议利用目录查找需要的内容
3. 由于课程是英文授课,所以许多地方中英混合出现,写的比较粗糙
4. 有可能会出现图片打不开的情况,翻墙会解决这个问题
5. 我在github上上传了pdf版,有需要可以下载
目录
3. Ethernet (有线) address & MAC address
4. Collision in Wireless LAN (Problem 1. Hidden station problem)
Lecture 3 Network layer fundamentals - Basic forwarding IP addressing
Lecture 5 IP, ARP, more IP and ICMP
2. IP options (extension header)
4. Dijkstra's shortest path algorithm
5. Link-state vs. Distance-vector
Lecture 8&9 Transport Layer-UDP, TCP and beyond
Lecture 10 &11 Application Layer
2.Creating network applications
Lecture 13 IP Configuration 分IP地址
2. DHCP—Dynamic Host Configuration
3. Host Configuration—SLAAC--Stateless Autoconfiguration
4. IPv6 Autoconfiguration—Plug and Play
5. Stateful and Stateless Autoconfiguration
2. NAT-Network Address Translation
Lecture 2 Link Layer
1. Basic introduction
Data Link Layer has responsibility transferring datagram between adjacent nodes over a link. (Data link layer packet is a frame, encapsulates datagram into frame.)
Link addressing: MAC address
2. Collision in Ethernet:
CSMA: Listen before sending. Half-duplex link. But it cannot avoid all collision because there is propagation delay of each frame.
CSMA/CD: Listen while sending. If collision is detected, abort transmission and retry.
No collision (nowadays used):
Bridge learns location of MAC addresses by inspecting (检查) source address field in incoming frames.
3. Ethernet (有线) address & MAC address
The both are 48-bit number used to uniquely identify each computer in a network. The address is usually written in hexadecimal form.
The Ehernet address is the most common form of MAC address.
4. Collision in Wireless LAN (Problem 1. Hidden station problem)
To avoid collision (Now we cannot use CDMA/CD), we use CDMA/CA:
Problem 2 (RTS and CTS cannot solve this problem this time.)
C have to wait to send data to D until A finish sending data to B.
5. 数据链路层还分MAC和LLC子层
MAC连接LLC子层和下级物理层。从LLC子层接受数据,附加上MAC地址和控制信息后再校验一下放到物理层去。
其中最重要的概念是MAC address。
Review of Lecture 2
Lecture 3 Network layer fundamentals - Basic forwarding IP addressing
1.In general
End-to-end delivery of packets independent of the underlying link layer technologies.
Connectionless (只规定destination, 不规定具体路线): Packets may arrive in different paths, and may not receive in order.
IP: Implemented using unicast addresses shared between several hosts.
Direct Dilivery |
Indirect Dilivery |
Host to host or router to host |
Host to router or router to router |
– Destination and sender connected to the same physical network • Last delivery is direct – Destination address and local interface have same network address (use netmask) |
– From host to router or from router to router – Destination address and forwarding table: forwarding |
2. Forwarding
The last one is using nowadays.
No.1
No.2
No.3
3. IPv4 Addressing
(IPv6 address is 128 bit long.)
|
|
– Address & Mask = NetID (network address)
– Address & !Mask = HostID (host address)
– Address | !Mask = Directed broadcast address
(limited broadcast address是都set to 1,255.255.255.255)
4. Allocate address
Address range 是从 network address 到 broadcast address 的.
Reading instruction:
Ch 5,12.2,26
Lecture 4 IP
1. IPv4&IPv6 packet
Packet contains source and destination addresses.
IPv6 没有 header length field (因为长度(不包括extension header)是固定的).
2. IPv4&IPv6 Fragmentation
MTU是数据链路层的限制,但是fragmentation发生在网络层
注意UDPheader只有8 bytes长
|
|
Flags:
– RF (Reserved Fragment) – for future use (set to 0)
– DF (Dont Fragment).
• Set to 1 if datagram should not be fragmented.
• If set and fragmentation needed, datagram will be discarded and an error message will be returned to the sender
– MF (More Fragments)
• Set to 1 for all fragments, except the last.
IPv6只能在source,不能再中间的router上面做fragmentation
3. IPv4 header vs IPv6 header
IPv4 |
IPv6 |
|
header length |
20-60 bytes |
40 bytes |
header length field |
有 |
没有 (header length fixed) |
name of down-counter lifetime of every datagram (可以自行设置, Default initial value: 64) |
TTL (8 bit) 每经过router, -1. =0时丢弃 Every router holding a datagram for more than 1 second should decrement the TTL by the number of seconds |
Hop Limit (8 bit) |
connectionless |
connection-oriented Because of the adding of flow label (textbook P830) |
IP Network layer functions |
IPv4实现方法 |
IPv6实现方法 |
Logical addressing |
Locating hosts |
|
Routing |
Path determination |
|
Forwarding |
Move Packet from input to output of the routers |
|
Fragmentation |
Adaption to lower layer |
|
Multiplexing/demultiplexing (多路复用和解复用) |
Many transport layer protocols |
|
Error detection + avoidance |
checksum |
- |
QoS (Quality of Service) |
ToS (Type of Service): 8 bit |
Traffic Class: 8 bit Flow Label: 20 bit |
[1] The flow label field allows labeling packets belonging to a particular flow for which the sender requests the same handling. A flow is identified by the source address, destination address, and a nonzero flow label, and packets belonging to a flow should be treated the same way by a router (rfc6437)
The first 6 bits of the traffic class field hold the DiffServ Code Points (DSCP), which can be used for classifying packets in order to implement priorities. The last 2 bits are used for ECN, and serve for signaling congestion in the network. (rfc3260)
Reading instruction:
Ch 6,7,27
Lecture 5 IP, ARP, more IP and ICMP
1. ARP
已知IP address,想得到MAC address:ARP (Address Resolution Protocol)
已知Name(域名,比如kth.se),想得到IP address: DNS
注意这个过程在高速缓存cache中存储了,所以第二次传输datagram的时候不需要再进行APR request (broadcast) 和APR reply (unicast)。
[2] Address Resolution的方式包括:
(用于IPv4的Address Resolution Protocol – ARP,这一部分中介绍)
(用于IPv6的Neighbor Discovery Protocol – ICMPv6,单独在3. ICMP中介绍)
代理ARP:
2. IP options (extension header)
IPv4 |
IPv6 |
|
Purpose |
Control, testing and debugging of the network functionality |
|
Length |
IPv4: Max 40 bytes (Max header length is 60 bytes in IPv4) |
IPv6: No limitations |
Option Format |
|
|
Option Type |
End of option |
Hop-by-hop options (Pad1&PadN&jumbao payload) 用于当source需要把信息传递给datagram经过的所有routers时. eg,.if the length of the datagram is more than the usual 65535 bytes.
|
No operation |
Routing |
|
Loose source route |
Fragment |
|
Timestamp |
Authentication Header |
|
Record route |
Encapsulating Security Payload |