《自定向下计算机网络》其四 Network Layer
文章目录
Router
two key router functions
①run routing algorithm/protocol(RIP,OSPF,BGP)
②forwarding datagram form incoming to outgoing link
router 每个port 既是input port 也是 output port
router每个port 都有对应的IP address
What is Subnet?
①device interfaces with same subnet part of IP address
②can physically reach each other without interveing router
DHCP
Dynamic Host configuration Protocol
DHCP overview
①host brocasts “DHCP discover” msg
②DHCP server responds with “DHCP offer” msg
③host requests IP address “DHCP request”msg
④DHCP server sends address “DHCP ack” msg
NAT
Network Address Translation
NAT router的争议
private IP + port ID → NAT router
router设计之初作为第三层的产品,只涉及物理层,链路层和网络层
NAT router涉及port,port原本是属于传输层,NAT router会让网络变得复杂
但是NAT的好处是可以提高IP的利用率,同时增加网络安全性
ICMP
Internet Control Message Protocol
used by host and routers to communicate network-level information
主要用于:
①error reporting
②echo request
ICMP构建在IP之上,电脑上使用的ping命令使用的就是ICMP
IPV6
特性:
①fixed-length 40 byte header 固定长度
②no fragmentation allowed 在传输过程中不做切分,在发送源时已经切分好
③兼容IPV4采用Tunneling技术,讲IPV6数据包封装在IPV4 data 数据中
Routing Algorithm
routing algorithm classification
Global
(1)all router have complete topology link cost info
(2)”link state” algorithm
decentralized
(1)router knows physically-connected neighbors,link costs to neighbors
(2)iterative process of compatation,exchange of info with neighbors
(3)“distance vector” algoriths
A link-state routing algorithm
Dijkstras algorithm
A distance vector algorithm
Bellman-Ford equation
Network layer connection and connection-less service
两种网络
①datagram network provide network-layer connectionless service
②virtual circuits provide network-layer connection service
Virtual Circuits
source-to-dest path behaves much like telephone circute
①通信前建立连线,此时需要双方IP
②建立路线之后,每个packet 携带一个VC ID,不带IP
③查表,查forwarding table
Datagram network
①不需要建连线
②没有路线一说,每个封包都是独立的个体
③封包没有VC ID,取而代之的时source-pair IP address
④查表,查routing table
Routing protocol 介绍
RIP
Routing Information Protocol
①use distance vector algorithm
②固定30s交换一次
③如果180s内没手动→neighbor/link declared dead
④广播信息使用UDP发布
⑤相邻router间的cost是1
OSPF
open shortest path first
①use link state algorithm
②OSPF封包直接在IP的data 中,不经UDP也不经TCP
③OSPF 需要认证
④允许在存在多条same-cost 路径(RIP 只有一条)
⑤不同的服务有不同的cost标准⑦
BGP
Border Gateway Protocol
①跨AS protocol
②通过TCP交换信息
③使用BGP的router必须保证广播的信息是真实的
④BGP message type
(1)OPEN: 打开TCP连接并进行认证
(2)UPDATE:广播新的路径
(3)KEEPALIVE: 保持连接存活
BGP
Border Gateway Protocol
①跨AS protocol
②通过TCP交换信息
③使用BGP的router必须保证广播的信息是真实的
④BGP message type
(1)OPEN: 打开TCP连接并进行认证
(2)UPDATE:广播新的路径
(3)KEEPALIVE: 保持连接存活
(4)NOTIFICATION:通知一些连接错误,也用来关闭连接