CSC8021_computer network_The Network Layer

Store and forward packet switching

在这里插入图片描述

Network Layer – challenges

• Internetworking: connect heterogeneous subnets
– Enable long distance point-to-point communication [Wide area network (WAN)]
– Shield Transport Layer from type, size and topology of network, and router technology
• Routing: provide optimal direction to packets and maintain accounting information
• Congestion control: diffuse traffic when there are too many messages in transit and offer Quality of Service (QoS) guarantees
·互联:连接异构网络

  • 实现远距离点对点通信[广域网(WAN)]
  • 保护传输层不受网络类型、规模和拓扑以及路由器技术的影响
    ·路由:为数据包提供最佳方向并维护计费信息
    ·拥塞控制:当有太多消息在传输时扩散流量,并提供服务质量(QoS)保证

Services provided

• Virtual Circuit – connection-oriented service
– A single route is chosen for all packets
– Routers must keep state about connection
• Datagram network – connectionless service
– Packets are routed independently of each other
– Packets contain the destination address
·虚拟电路-面向连接的服务
- 为所有数据包选择单一路由
- 路由器必须保持连接状态
·数据报网络-无连接服务
- 数据包相互独立地路由
- 数据包包含目的地址

Most widely used protocol is the IP protocol (datagram). It is the common language spoken by nodes that glues much of the Internet together.
最广泛使用的协议是IP协议(数据报)。它是节点所说的共同语言,将互联网的大部分内容粘合在一起。

Datagram Networks

在这里插入图片描述Each packet carries the addresses of the source (A) and destination (G) hosts. At each node, the packet is forwarded in the direction of its destination according to its routing table (which can change over time). Packets can take different routes.
每个数据包携带源主机(A)和目的主机(G)的地址。在每个节点上,数据包根据其路由表(可以随时间变化)向其目的地的方向转发。数据包可以采用不同的路由。

Virtual-circuit Networks

在这里插入图片描述Each packet contain a VC number indicating their order on the connection. Once the connection is established the packets goes through, independently from routing table updates.
每个数据包都包含一个VC编号,表示它们在连接上的顺序。一旦连接建立,数据包就会通过,而不受路由表更新的影响。
在这里插入图片描述

The Internet and internetworking

Internetworking is the process of forming connections between different networks to provide internet services.
互联网是在不同网络之间形成连接以提供互联网服务的过程。
在这里插入图片描述在这里插入图片描述
在这里插入图片描述

Tunneling隧穿

在这里插入图片描述

Fragmentation

在这里插入图片描述If incoming packets are too large for intermediate networks Packets broken down by multi-protocol routers (G)
In (a) multi-protocol routers reassemble packet at boundary
(transparent fragmentation)
In (b) packet is only reassembled at destination
(non-transparent fragmentation)
如果传入的数据包对于中间网络来说太大,则多协议路由器(G)分解数据包
在(a)中,多协议路由器在边界处重组分组
(透明的碎片化)
在(B)中,数据包仅在目的地重新组装
(非透明碎片)

在这里插入图片描述

Fragmentation Pros and Cons

• the more fragments means more extra headers, more bandwidth required
• if you lose one fragment then resend all the data
• easier to break into fragments than to reassembling them together again
• Source/sender do not know the route and network capacity, so router break the packets into fragments
• Approach (a) need to do a lot of fragmentation and reassembly and may not find optimal path but less chance of packet loss whereas in (b) less work for router but more chance of packets loss, consequently high resending overhead
·更多的片段意味着更多的额外报头,需要更多的带宽
·如果丢失了一个片段,则重新发送所有数据
·更容易破碎成碎片,而不是重新组装在一起
·源/发送方不知道路由和网络容量,因此路由器将数据包分解为碎片
·方法(a)需要进行大量的分段和重组,并且可能找不到最佳路径,但分组丢失的机会较小,而在(b)中,路由器的工作较少,但分组丢失的机会较多,因此重发开销较高。
在这里插入图片描述

The Internet Protocol (IP)

• The Internet is a (very large) collection of different kinds of subnets.
• IP is the “glue” that allows all these subnets to exchange data – giving the impression of a single,global net.
• IP provides delivery of packets from one host in The Internet to any other host in the Internet, even if the hosts are on different networks (with possibly different protocols).
• Internet packets may be up to 64 kilobytes in length(although they are typically much smaller).
• Typically a maximum frame size will be 1500 bytes(Ethernet).
·互联网是一个(非常大的)不同类型的网络的集合。
IP是一种“粘合剂”,使所有这些互联网能够交换数据-给人一种单一的全球网络的印象。
IP提供从互联网中的一个主机到互联网中的任何其他主机的数据包传递,即使主机在不同的网络上(可能具有不同的协议)。
互联网数据包的长度可能高达64字节(尽管它们通常要小得多)。
·通常,最大帧大小为1500字节(以太网)。

在这里插入图片描述

The IPv4 format

• Version: The IP version number, currently 4, called IPv4. A new version, IPv6, is already in use.
• IHL: IP Header Length.
• Type of Service: Contains priority information.
• Total Length: The total length of the datagram including header.
• Identification: when an IP packet is segmented into multiple fragments, each fragment is given the same identification. This field is used to reassemble the fragments.
版本:IP版本号,目前为4,称为IPv4。新版本IPv6已经在使用中。
· IHL:IP报头长度。
·服务类型:包含优先级信息。
·总长度:包括报头的数据报的总长度。
·标识:当IP分组被分段成多个片段时,每个片段被给予相同的标识。此字段用于重新组装片段。

• DF: Don’t Fragment. Packets must be sent in one piece.
• MF: More Fragments. When a packet is fragmented,all fragments except the last one have this bit set.
• Fragment offset: The fragment’s position within the original packet.
• Time to Live: Hop count, decremented each time the packet reaches a new router. When hop count =0, the packet is discarded.
• Protocol: Identifies which transport layer protocol is being used for this packet
· DF:不要碎片化。数据包必须完整地发送。
· MF:更多碎片。当数据包被分段时,除了最后一个片段之外的所有片段都设置了此位。
·片段偏移:片段在原始分组内的位置。
·生存时间:跳数,每次数据包到达新路由器时递减。当跳数=0时,数据包被丢弃。
·协议:确定哪个传输层协议正用于此数据包

• Header Checksum: Verifies the contents of the IP header.
• Source and Destination Addresses: Uniquely identify sender and receiver of the packet.
• Options: Used to extend the functionality of IP.
Examples: source routing, security.
·报头校验和:验证IP报头的内容。
·源和目的地标识符:唯一地标识分组的发送者和接收者。
·选项:用于扩展IP的功能。
例如:源路由、安全性。

Addressing

• Each host is assigned a unique 32-bit Internet (IP) address that is used in all communication with that host.
• Each address consists of a(netid,hostid) pair where netid identifies a network and hostid identifies the host on that network by its connection to the network.
• IP addresses are binary numbers,usually displayed in human readable
notation
每个主机都分配有一个唯一的32位Internet(IP)地址,用于与该主机的所有通信。
·每个地址由一对(netid,hostid)组成,其中netid标识网络,hostid通过其与网络的连接标识该网络上的主机。
· IP地址是二进制数字,通常以人类可读的方式显示符号
在这里插入图片描述
There are three primary classes of identifier distinguished by the two
higher order bits of the address:
Class A: first bit 0. Used for very large networks with a very large number of hosts: 7 bit netid and 24 bit hostid. Over 16 million hosts per net, 1.0.0.0 to 127.255.255.255.

Class B: first bit 1 second bit 0. Used for moderate to large sized networks with between 28 and 216 hosts: 14 bit netid and 16 bit hostid. About 65 thousand hosts, 128.0.0.0 to 191.255.255.255.

Class C: first bit 1, second bit 1, and third bit 0. Used for small networks with up to 28 (256) hosts: 21 bit netid and 8 bit hostid. 192.0.0.0 to 223.255.255.255.

Class D: Special case (multicast), 224.0.0.0 to 239.255.255.255.

Class E: Broadcast: 255.255.255.255 (i.e. all ‘1’s in binary).
有三个主要类别的标识符区分的两个地址的高阶位:
A类:第一位0。用于具有大量主机的超大型网络:7位netid和24位hostid。每个网络超过1600万台主机,1.0.0.0到127.255.255.255。

B类:第一位1第二位0。用于28到216台主机的中型到大型网络:14位netid和16位hostid。大约6.5万个主机,128.0.0.0到191.255.255.255。

C类:第一位1,第二位1,第三位0。用于最多28(256)台主机的小型网络:21位netid和8位hostid。192.0.0.0到223.255.255.255。

D类:特殊情况(多播),224.0.0.0到239.255.255.255。

E类:广播:255.255.255.255(即二进制中的所有“1”)。

在这里插入图片描述在这里插入图片描述
在这里插入图片描述在这里插入图片描述

Classless Inter-Domain Routing (CIDR)

• In order to make the remaining address space last longer; CIDR was
introduced instead of the previous 3 classes.
• CIDR has no class structure, instead each network
– Is assigned a block of addresses as big (or small) as needed
·为了使剩余的地址空间持续更长时间; CIDR被取代了之前的三个类。
CIDR没有类结构,而是每个网络
- 根据需要分配一个大(或小)的地址块

10.1.0.1/29
Subnet mask of 255.255.255.248(11111111.11111111.11111111.11111000)
Number of devices available to connect
10.1.0.0 through 10.1.0.7
(number of hosts/devices 5, 1 netid, 1 broadcast network)

Network Address Translation (NAT)

• Most networks only communicate through a single point (the firewall).
• As a result most of their address space is unused on the Internet itself.
• NAT exploits this by only assigning one (or very few)addresses to an entire network.
• All incoming and outgoing messages must therefore go through this address.
• The network must translate this address into the host destination:
– Private IP address space inside the network, e.g10.0.0.0 to 10.255.255.255
– Actual host stored in TCP header.
大多数网络只通过一个点(防火墙)进行通信。
因此,他们的大部分地址空间在互联网上都没有使用。
NAT通过只为整个网络分配一个(或很少)地址来利用这一点。
·所有传入和传出的消息都必须通过此地址。
·网络必须将此地址转换为主机目的地:
10.255.255.255 – Private IP address space inside the network, e.g10.0.0.0 to

  • TCP报头中存储的实际主机。

在这里插入图片描述
• How does a machine (echo.ncl.ac.uk) which has the address 10.4.127.133 connect to the Internet?
• Addresses in the range 10.0.0.0 to 10.255.255.255 are private IP address space inside the network, they are not used for communication on the public Internet.
• The internal machine (echo) cannot connect directly outside its private
network without going through a proxy server. This involves a process referred to as Network Address Translation (NAT).
• The private IP address (10.4.127.133) is stored in the TCP pseudo header and the source in the IP header will give the IP address of the proxy server.
• When a reply arrives back at the proxy server, the internal private IP address is recovered from the TCP proxy header and the datagram delivered to echo.
·地址为echo.ncl.ac.uk的机器( 10.4.127.133)如何连接到Internet?
·10.0.0.0到10.255.255.255范围内的IP地址是网络内部的私有IP地址空间,它们不用于公共互联网上的通信。
·内部机器(echo)不能直接连接到其私有机器之外无需通过代理服务器。这涉及到一个称为网络地址转换(NAT)的过程。
·私有IP地址(10.4.127.133)存储在TCP伪报头中,IP报头中的源将给予代理服务器的IP地址。
·当回复返回到代理服务器时,内部私有IP地址从TCP代理报头中恢复,并将数据报传递给echo。

The IPv6 format

Header has fixed length
Flexibility through “next header”
Class field supports prioritization/QoS
Flow label not yet fully defined
Payload length refers to data
Hop limit same as time to live in IPv4
Source/destination addresses are
16 bytes each (4 bytes in IPv4)
- one IP address per molecule on
Earth! - every device can have their own IP addres
- addresses with first 12 bytes as zero are interpreted as IPv4 addresses so IPv4 and IPv6 can coexist
Note no CRC – this is assumed to be handled by other layers
Header有固定长度
通过“下一个标题”实现灵活性
Class字段支持优先级/QoS
流标签尚未完全定义
有效载荷长度参考数据
跳数限制与IPv4中的生存时间相同
源/目标地址为
每个16字节(IPv4中为4字节)
- 每个分子一个IP地址
地球!- 每个设备都可以有自己的IP地址
- 前12个字节为零的地址被解释为IPv4地址,因此IPv4和IPv6可以共存
请注意,没有CRC -假设由其他层处理
在这里插入图片描述
在这里插入图片描述

  • 16
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值