Presentation is loading. Please wait.

Presentation is loading. Please wait.

5.5 网络互联 网络的不同之处 网络如何连接起来 级连虚电路 无连接的网络互连 隧道技术 互联网路由 分段

Similar presentations


Presentation on theme: "5.5 网络互联 网络的不同之处 网络如何连接起来 级连虚电路 无连接的网络互连 隧道技术 互联网路由 分段"— Presentation transcript:

1 5.5 网络互联 网络的不同之处 网络如何连接起来 级连虚电路 无连接的网络互连 隧道技术 互联网路由 分段

2 网络互联 连接两个或者多个网络被连接起来构成一个互联网 网络中共存不同的协议和硬件 互联: 网络互联就是要解决不同的网络之间如何相连的问题

3 网络互联 一组相互连接的网络.

4 网络的不同之处 网络的某些不同之处

5 网络如何连接起来 (a) Two Ethernets connected by a switch.
(b) Two Ethernets connected by routers.

6 交换式网络与路由式网络的区别 通过交换机,整个帧是以MAC地址为基础进行传输,而对于路由网络,路由器从帧中提取分组。然后利用分组中的地址来决定它的目标去向。交换机不必理解分组中所使用的网络层协议,而路由器必须要理解分组中的网络层协议。

7 级联虚电路 使用级联虚电路实现网络互连

8 级联虚电路 面向连接的虚电路子网互联 在级联虚电路模型中,建立一个到达远程网络中主机的连接所使用的方式,与建立常规连接的方式非常类似。子网看到连接的目标端在本子网以外,于是建立一条虚电路通向本子网中离目标网络最近的路由器。然后。它再建立一条从该路由器到达外部网关的虚电路,此外部网关在它的内部表中记录下这条虚电路,并且继续前行,建立另一条虚电路,到达下一个子网中的路由器,这个过程持续下去,直至到达目标主机为止。

9 A connectionless internet.
无连接的网络互联 A connectionless internet.

10 无连接的网络互联 无连接的网络互联与无连接网络中的操作类似
主机发送发送一个分组到它的邻居路由器,然后该路由器将其转发给下一个路由器,这个过程持续下去直到目的地。 和面向无连接网络一样,路由器只是尽力投递分组。

11 问题 需要解决的问题: 两个不同网络协议之间需要相互转换,然而转换总是不完全的 编址问题

12 两种网络互联方式的比较 Model Advantages Disadvantages Virtual Circuit Datagrams
Buffers can be reserved in advance Sequencing guaranteed No delayed/duplicate packets Table space required Can't avoid congestion Vulnerable to failures Impossible to implement if intervening network is unreliable Datagrams Can adapt to congestion Can handle router failures None of intervening networks need to be virtual circuits. Susceptible to congestion

13 隧道技术 隧道技术:适用于源和目标主机位于相同的类型的网络中,但是他们中间存在不同类型的网络
整个分组被封装到异类型网络的分组中,在另一侧的多协议路由器中恢复原有的分组 隧道技术避免了分组转换

14 Tunneling a packet from Paris to London.
隧道技术 Tunneling a packet from Paris to London.

15 Tunneling a car from France to England.
隧道技术(模拟) Tunneling a car from France to England.

16 (a) An internetwork. (b) A graph of the internetwork.
互联网路由 每台路由器都可以直接访问另一台跟他一样也连接到同一网络的路由器。 (a) An internetwork. (b) A graph of the internetwork.

17 互联网路由 两级路由算法 内部网关协议: 网络内部 外部网关协议: 网络之间 自治系统(AS)
一个互联网内部的每个网络都独立于所有其他的网络,所以每个网络可称为一个自治系统

18 分段 每个网络都会限制其分组的最大长度,包括: 硬件(e.g., the size of an Ethernet frame).
操作系统(e.g., all buffers are 512 bytes). 协议 (e.g., the number of bits in the packet length field). 遵从某一(国际)标准 期望将“因错误而引入的重传次数”减少到某种程度 期望防止分组占用信道时间太长

19 (a) Transparent fragmentation. (b) Nontransparent fragmentation.
分段 (a) Transparent fragmentation. (b) Nontransparent fragmentation.

20 分段编号 Fragmentation when the elementary data size is 1 byte.
Any of certain humorous axioms stating that anything that can possibly go wrong, will go wrong. 墨菲法则一种幽默的规则,它认为任何可能出错的事终将出错 Fragmentation when the elementary data size is 1 byte. (a) Original packet, containing 10 data bytes. (b) Fragments after passing through a network with maximum packet size of 8 payload bytes plus header. (c) Fragments after passing through a size 5 gateway.

21 5.6 Internet上的网络层 IP 协议 IP Addresses Internet 控制协议 OSPF BGP
IPv6

22 Internet 设计原则 RFC 1958 保证能够工作 尽可能简单 做出明确的选择 模块化 具备异构性 避免使用固定不变的选项和参数
寻找一个好的设计,它不必是最完美的 严格发送,容忍接收 考虑扩展性 考虑性能和代价

23 The Internet is an interconnected collection of many networks.
层次结构 The Internet is an interconnected collection of many networks.

24 IP 协议 Application FTP, Telnet, HTTP,… Layer Transport TCP, UDP Layer
IP, ICMP,IGMP,ARP,RARP,BOOTP,DHCP Network Layer Host-to-Network Layer Defined by other standard. Ethernet, , …

25 协议数据单元封装 TCP/IP over Ethernet Application TCP IP Ethernet Driver
User Data Application Application Message Application Header User Data TCP TCP Segment TCP Header Application Data IP IP Packet (Datagram) IP Header TCP Header Application Data Ethernet Driver Ethernet Frame Ethernet Header IP Header TCP Header Application Data Ethernet Trailer Ethernet Transmission Line 14 Bytes 20 Bytes 20 Bytes Variable Length 4 Bytes 46 to 1500Bytes TCP/IP over Ethernet

26 The IPv4 (Internet Protocol) header.

27 IPv4 头格式 Version number (4-bits): IHL: Header length (4-bits):
The current protocol version is 4. IHL: Header length (4-bits): The minimum length is 5 words = 20 bytes, but can be up to 15 words if options are used.

28 IPv4 头格式 Type-of-service (8-bits): Precedence (3-bits): 0~7 pri
Delay (1-bit): An Application can request low delay service (e.g., for interactive use). Throughput (1-bit): Application requests high throughput. Reliability (1-bit): Application requests high reliability.

29 IPv4 头格式 Total length (16-bits): Max=65535 bytes Identification
包含该数据报中所有的内容,即头和数据 Identification 让目标主机确定一个新到达的分段属于哪一个数据报。

30 IPv4 头格式 Unused (1 bit) DF (Don't Fragment , 1bit )
MF (More Fragments, 1bit) 除了最后一个分段以外其他所有分段必须设置这一位

31 IPv4 头格式 Fragment offset (13 bits) 指明该分段在当前数据报中的什么位置上。

32 IPv4 头格式 TTL (Time to Live, 8 bits) 每一跳,计数器递减,若排队时延较长,该计数器必须多倍递减。
当跳数计数器减到0,丢弃该数据报。 最初TTL域计数的时间单位为秒,因此最大的生存期为255秒. 实际使用中, TTL域是跳数计数器 TTL域可避免数据报长时间逗留在网络中

33 IPv4 头格式 Protocol (8-bits): 指明了该将完整的数据报交给哪个传输进程。
协议编号是全球统一的,可在在线数据库( ICMP IGMP TCP UDP

34 IPv4 头格式 Header Checksum (16-bits): 只校验头.

35 IPv4 头格式 Source address (32-bits): Destination address (32-bits):
Original sender's address. This is an IP address, not a MAC address. Destination address (32-bits): Datagram's ultimate destination.

36 IPv4 头格式 Some of the IP options.
option number (5 bits): A code indicating the option's type. 5-54 Some of the IP options.

37 IP 地址 所有的IP地址都是32位长,Internet上的每台主机和路由器都有一个IP地址,IP地址包含网络号和主机号,原则上,Internet上的任何两台机器不会有相同的IP地址。

38 编址方案 IP address formats.
Class A : 128 networks with 16 million hosts each Class B : 16,384 networks with up to 64K hosts each Class C: 2 million networks (e.g., LANs) with up to 256 hosts each IP address formats.

39 特殊的IP地址 Special IP addresses.

40 子网 一个网络中的所有主机必须有相同的网络号当网络规模不断增长的时候,这种特性可能会有问题
问题的根源在于一条规则:单个A、B或者C类地址只能引用一个网络,而不是一组LAN.

41 A campus network consisting of LANs for various departments.
子网 A campus network consisting of LANs for various departments.

42 A class B network subnetted into 64 subnets.
子网掩码 14 bits 6 bits 10 bits A class B network subnetted into 64 subnets. Mask: / 22

43 Subnets 考虑两个地址130.50.4.2 和 130.50.15.6,他们是同一个网络中的吗?
当发送数据给 时, 本地网关首先将该地址与子网掩码 /22相与,得到地址 ,于是将数据发给该子网 和 是两个不同的子网 对外部而言,可见的是网络地址是130.50 Subnet 1: | Subnet 2: | Subnet 3: |

44 CIDR – Classless InterDomain Routing (RFC 1519)
IP 地址将要耗尽 对于很多组织: A 类网络, 16M个地址太大了 C 类网络, 256个地址太小了 B类网络, 65,536个地址比较合适 事实上,B类地址对很多组织还是大! The Story of Goldilocks and the Three Bears Once upon a time, there was a little girl named Goldilocks. She went for a walk in the forest. Pretty soon, she came upon a house. She knocked and, when no one answered, she walked right in. At the table in the kitchen, there were three bowls of porridge. Goldilocks was hungry. She tasted the porridge from the first bowl. "This porridge is too hot!" she exclaimed. So, she tasted the porridge from the second bowl. "This porridge is too cold," she said So, she tasted the last bowl of porridge. "Ahhh, this porridge is just right," she said happily and she ate it all up. After she'd eaten the three bears' breakfasts she decided she was feeling a little tired. So, she walked into the living room where she saw three chairs. Goldilocks sat in the first chair to rest her feet. "This chair is too big!" she exclaimed. So she sat in the second chair. "This chair is too big, too!" she whined. So she tried the last and smallest chair. "Ahhh, this chair is just right," she sighed. But just as she settled down into the chair to rest, it broke into pieces! Goldilocks was very tired by this time, so she went upstairs to the bedroom. She lay down in the first bed, but it was too hard. Then she lay in the second bed, but it was too soft. Then she lay down in the third bed and it was just right. Goldilocks fell asleep. As she was sleeping, the three bears came home. "Someone's been eating my porridge," growled the Papa bear. "Someone's been eating my porridge," said the Mama bear. "Someone's been eating my porridge and they ate it all up!" cried the Baby bear. "Someone's been sitting in my chair," growled the Papa bear. "Someone's been sitting in my chair," said the Mama bear. "Someone's been sitting in my chair and they've broken it all to pieces," cried the Baby bear. They decided to look around some more and when they got upstairs to the bedroom, Papa bear growled, "Someone's been sleeping in my bed," "Someone's been sleeping in my bed, too" said the Mama bear "Someone's been sleeping in my bed and she's still there!" exclaimed Baby bear. Just then, Goldilocks woke up and saw the three bears. She screamed, "Help!" And she jumped up and ran out of the room. Goldilocks ran down the stairs, opened the door, and ran away into the forest. And she never returned to the home of the three bears.

45 分配20位给B类网络号带来的问题 路由表急剧膨胀 路由表复杂性 路由表传输问题

46 CIDR – Classless InterDomain Routing
基本思想:将剩余的IP地址以可变大小块的方式进行分配,而不管它们所属的类别。例如如果一个站点需要2000个地址,则它可以获得一个以2048作为字节边界的地址块,其中包含2048个地址。

47 Complicated Forwarding Algorithm
A set of IP address assignments. 5-59 Route Table: Address Mask C: E: O: Dest: match Oxford network

48 动态IP地址 对于那些通过拨号上网的家庭用户,采用这个方法,当计算机拨号的并登陆的时候,给用户分配一个IP 地址,会话结束,再释放。
希望永远在线的用户,这种方法失效。

49 NAT – Network Address Translation (RFC 3022)
基本思想:为每个公司分配一个IP地址(或者,最多分配少量的IP地址),用于传输Internet流量。在公司内部,每台计算机有唯一的IP地址,它使用该地址传内部流量。然而,当一个分组离开公司网络的时候,需要执行一个地址转换。

50 NAT 为了保证这种方案的可行性,有三段IP地址范围已被声明为私有地址。任何一家公司可以在他们内部随意使用这些地址。唯一的规则是,包含这些地址的分组不应该出现在Internet上。这三段保留的地址范围是: – / (16,777,216 hosts) – / 12 (1,048,576 hosts) – /16 (65,536 hosts)

51 NAT – Network Address Translation
The NAT box is often combined in a single device with a firewall, which provides security by carefully controlling what goes into the company and what comes out. It is also possible to integrate the NAT box into the company’s router. Placement and operation of a NAT box.

52 NAT – Network Address Translation
当应答分组回来的时候,NAT box如何知道该用哪个地址代替?

53 NAT – Network Address Translation
TCP/UDP 端口 大多数IP分组携带的两种净荷,即TCP或UDP 这两者的头部都包含了一个源端口和目标端口 端口是16-bit 整数,它指示TCP连接从哪里开始,以及从哪里结束。 正是这些端口域,才使得NAT能够工作。

54 Mapping 利用Source port 域, 可以解决映射问题。任何时候当一个向外发送的分组进入到NAT box的时候,源地址10.x.y.z 被公司真实的IP地址所取代,且TCP的Source port 域被一个索引值所取代,该索引值指向NAT box的地址转换表中 65,536个表项之一. 表项包含了原来的IP地址和原来的源端口。 最后NAT box重新计算IP头和TCP头的校验和,并将校验和插入到分组中。 之所以要替换source port域,是因为从机器 和 出发的连接可能碰巧使用同一个端口,因此只使用Source port 不足以唯一标示发送进程

55 NAT 问题-1 NAT违反了IP的结构模型,IP的结构模型声明了每一个IP地址均唯一标识了一台机器。Internet的软件结构也是建立在这样的事实基础之上的。然而,采用NAT以后,成千上万台机器可能会使用同一个地址.

56 NAT 问题-2 NAT 将Internet从一个面向无连接的网络变成一个面向连接的网络。一旦NAT BOX崩溃,则它的所有连接都被破坏,不使用NAT的情况下,路由器崩溃不会影响TCP连接。因此,使用了NAT以后,Internet如同电路交换网一样变得非常脆弱。

57 NAT 问题-3 NAT违反了最基本的协议分层规则:即第k层不应该对“第k+1层将在第k层的净荷域中放置什么样的内容”作任何假设。这条基本原则可以保证层之间的独立性,而NAT破坏了这种独立性。

58 NAT 问题-4 Internet 上的进程并不一定总是使用TCP和UDP,采用别的传送层协议,NAT的介入会使这些应用失效。

59 NAT 问题-5 有些应用会在正文内容中插入IP地址。然后接收方从正文中提取地址并使用它们。由于NAT对这些地址一无所知,它不可能替换这些地址,所以,远程系统若使用这样的地址就会失败。 (FTP, H.323 Internet telephony protocol)

60 NAT 问题-6 由于TCP Source port 域是16位的,所以至多只有65,536 机器可以映射到同一个IP地址上,实际上这个数值还要略小。

61 IP Addressing Final Solution
Transition to IPv6

62 Internet 控制协议 在Internet的网络层上,除了IP用于数据传输以外,还有一些其它的协议,包括ICMP,ARP,RARP,BOOTP和DHCP等

63 ICMP 差错报告: unreachable host, network, port, protocol
Transport TCP/UDP 被主机、路由器使用用于报告网络层面的信息 差错报告: unreachable host, network, port, protocol Echo 请求/应答 (used by ping) IP之上传送层之下 ICMP msgs carried in IP datagrams IP ICMP

64 Internet Control Message Protocol
Type Code description echo reply (ping) dest. network unreachable dest host unreachable dest protocol unreachable dest port unreachable dest network unknown dest host unknown source quench (congestion control - not used) echo request (ping) route advertisement router discovery TTL expired bad IP header ICMP message: type, code plus first 8 bytes of IP datagram causing error

65 ARP– The Address Resolution Protocol:用于Internet 和 Physical 地址之间的映射
Three interconnected /24 networks: two Ethernets and an FDDI ring.

66 ARP 如何找到目标主机的以太网地址: 在系统中使用一个配置文件,该配置文件包含了从IP地址到以太网地址的映射关系。
主机发送一个广播分组询问某一IP地址,只有是该IP地址的主机才会应答(用自己的以太网地址),询问和应答这两个过程所使用的协议——ARP

67 ARP– The Address Resolution Protocol
让每台机器在启动的时候广播他的地址映射关系。按理说不会有应答。如果有应答,表明什么?

68 ARP– The Address Resolution Protocol
IP Transport TCP/UDP ARP DLL

69 RARP (RFC 903) ARP解决的问题是,给定一个IP地址。如何找到对应的以太网地址。Reverse ARP 解决给定一个以太网地址,如何找到对应的IP地址的问题。 一台新启动的工作站广播它的以太网地址,并说:“我的MAC地址是: ,有人知道我的IP地址吗?” RARP服务器看到这个请求后,在它的配置文件中查找该以太网地址,然后将对应的IP 地址送回给工作站

70 RARP RARP的一个缺点: 它使用受限的广播方式跟RARP服务器进行通信。然而路由器并不会转发这样的广播消息,所以每个网络都要配一台RARP服务器。

71 BootP (RFC 951,1048,1084) 另一种启动协议 BOOTP 使用UDP消息,且可以被路由器转发.
不需要每个网络都配备服务器 它需要手工配置一张“将IP地址映射到以太网地址”的表.

72 Dynamic Host Configuration Protocol—DHCP (RFC 2131)
DHCP 既允许手工分配IP地址,也允许自动分配IP地址,基本上已经取代了RARP 和BOOTP. DHCP的基本思想:用一台专门的服务器来为每一台发出请求的主机分配IP地址。该服务器与发出请求的主机可以不在同一个LAN上。 由于广播消息可能无法到达DHCP服务器,因此每个LAN上需要一个DHCP中继代理。

73 Dynamic Host Configuration Protocol
Operation of DHCP.

74 Dynamic Host Configuration Protocol
IP 租用 “从一个IP地址池中自动为主机分配一个地址”带来的问题是,所分配的IP地址可以使用多长时间?为了避免丢失IP地址,IP地址分配的有效周期只能是一段固定长的时间(leasing).在到达租用期之前。主机必须向DHCP服务器申请续租,如果一台主机未发出请求或者被DHCP服务器拒绝,则它就不能使用原来的IP地址。

75 OSPF-Open Shortest Path First(内部网关协议)
必须发表在公开的文献中 必须支持多种距离矢量 必须是动态算法,能够适应拓扑的变化 必须支持建立在服务类型基础上的路由选择。 必须要实现负载均衡,即把负载分散到多条线路上 支持分层次的系统 要求提供适度的安全性

76 OSPF OSPF 支持三种类型的网络 两台路由器之间的点到点线路 支持广播传送的多路访问网络(LANs).
不支持广播传送的多路访问网络(packet switched WANs ). multiaccess network:由多台路由器构成,每台路由器可以直接与其它所有的路由器进行通信。

77 (a) An autonomous system. (b) A graph representation of (a).
OSPF (a) An autonomous system. (b) A graph representation of (a).

78 OSPF Areas 把AS划分成编号的区域(Areas) Area 是一个网络或者一组邻近的网络。
区域不能相互重叠,但是也不必覆盖所有的网络或路由器 区域是子网的一种泛化形式 在一个区域外部它的拓扑结构和细节是不可见的。

79 OSPF Backbone Area 每个AS都有一个backbone area, 称为0号区域. 所有的区域都连接到骨干上。
同时连接到两个或多个区域的路由器都属于骨干区域. 骨干区域的拓扑结构对于其外部也是不可见。

80 OSPF Link state algorithm 区域内部使用 link-state algorithm
每个路由器都有同样的链路状态数据库,并运行同样的最短路径算法,它的任务计算他到同一区域其它任何一台路由器之间的最短路径。

81 OSPF 正常情况下,需要三种路由路径 Intra-area Inter-area Inter-AS
go from the source to the backbone go across the backbone to the destination area go to the destination. Inter-AS

82 The relation between ASes, backbones, and areas in OSPF.

83 OSPF OSPF 区分4种路由器 它们之间可以有重叠 内部路由器,完全在一个区域的内部 区域边界路由器,连接两个或多个区域
骨干路由器,位于骨干区域上 AS 边界路由器,与其他AS中的路由器进行通信 它们之间可以有重叠

84 OSPF step 1 当一台路由器启动的时候,它在所有的点到点线路上发送HELLO消息,并在LAN上将HELLO消息多播到一个包含其它路由器的组。在WAN网,需要一些配置信息,以便知道该与谁通信。每台路由器从应答消息中得知谁是他的邻居。同一个LAN上的路由器都是邻居。

85 OSPF step 2 adjacent routers之间的信息交互
在LAN中为了避免路由器之间相互通话,OSPF要求选出一个路由器作为指派路由器. Designated router 与该LAN上其它的路由器都是邻接的,并且与它们之间交换信息。

86 OSPF step 3 Link State Update
为了保证可靠性,这些消息需要被确认 当链路状态发生变化时,路由器也要发送LINK STATE UPDATE 消息 所有这些消息都是以原始的IP分组被发送出去。

87 The five types of OSPF messages.
5-66 The five types of OSPF messages.

88 BGP – 外部网关路由协议 BGP: Border Gateway Protocol AS之间的路由

89 BGP 典型的路由策略可能会涉及到政治、安全或者经济方面的考虑因素。 几个路由限制的例子:
No transit traffic through certain ASes. Never put Iraq on a route starting at the Pentagon. Do not use the United States to get from British Columbia to Ontario. Only transit Albania if there is no alternative to the destination. Traffic starting or ending at IBM should not transit Microsoft.

90 BGP 根据BGP对于中转流量的用途,可以将网络分成三大类: 多连接网络(Multiconnected networks)
末端网络(Stub networks) 与 BGP 图只有一条连接 中转流量不可能使用这些网络,因为另一端没有路由器接应。 多连接网络(Multiconnected networks) 除非这些网络拒绝中转流量,否则就利用它们来传输中转流量 穿越网络(Transit networks) 比如骨干网

91 (a) A set of BGP routers. (b) Information sent to F.
BGP Example After all the paths come in from the neighbors, F examines them to see which is the best. It quickly discards the paths from I and E, since these paths pass through F itself. The choice is then between using B and G. Every BGP router contains a module that examines routes to a given destination and scores them, returning a number for the ''distance'' to that destination for each route. Any route violating a policy constraint automatically gets a score of infinity. The router then adopts the route with the shortest distance. The scoring function is not part of the BGP protocol and can be any function the system managers want. BGP easily solves the count-to-infinity problem that plagues other distance vector routing algorithms. For example, suppose G crashes or the line FG goes down. F then receives routes from its three remaining neighbors. These routes are BCD, IFGCD, and EFGCD. It can immediately see that the two latter routes are pointless, since they pass through F itself, so it chooses FBCD as its new route. Other distance vector algorithms often make the wrong choice because they cannot tell which of their neighbors have independent routes to the destination and which do not. The definition of BGP is in RFCs 1771 to 1774. (a) A set of BGP routers (b) Information sent to F.

92 IPv6 动机:IPv4的地址将被耗尽已经为期不远,尽管NAT可以赢得多年的时间。 设计目标:最好有用不完的地址
即使地址空间分配效率不高,也可以支持几十亿台主机 降低路由表的大小 对协议进行简化 提供比当前IP更好的安全性 更加关注于服务的类型 允许通过制定范围来支持多播 允许主机在不改变地址的情况下就可以实现漫游 允许协议未来还可以发展 允许新老协议共存多年

93 The IPv6 fixed header (required).
The Main IPv6 Header The IPv6 fixed header (required).

94 The Main IPv6 Header 流量类别域:按照各种不同的实时递交需要将分组区分开。
流标签:可以建立一个具有特殊属性和需求的伪连接 净荷长度:指明跟在40字节头之后还有多少字节数 下一个头:指示扩展头类型 跳数限制:类似TTL

95 Extension Headers IPv6 extension headers.

96 The hop-by-hop extension header for large datagrams (jumbograms).
Extension Headers (2) The hop-by-hop extension header for large datagrams (jumbograms).

97 The extension header for routing.
Extension Headers (3) The extension header for routing.

98 一些争议 地址长度的争论 跳数限制域的长度 最大分组长度 去掉IPv4校验和 移动主机 安全性


Download ppt "5.5 网络互联 网络的不同之处 网络如何连接起来 级连虚电路 无连接的网络互连 隧道技术 互联网路由 分段"

Similar presentations


Ads by Google