Data Communication Computer Network 简明教程
Network Layer Protocols
网络中的每台计算机都有一个 IP 地址,可通过该地址对其进行唯一标识和寻址。IP 地址是第 3 层(网络层)的逻辑地址。此地址在每次计算机重启时都可能更改。计算机在某一时间可以有一个 IP,在另一时间可以有另一个 IP。
Every computer in a network has an IP address by which it can be uniquely identified and addressed. An IP address is Layer-3 (Network Layer) logical address. This address may change every time a computer restarts. A computer can have one IP at one instance of time and another IP at some different time.
Address Resolution Protocol(ARP)
在通信时,主机需要属于同一广播域或网络的目的地计算机的第 2 层(MAC)地址。MAC 地址物理刻录在计算机的网络接口卡 (NIC) 中,并且永远不会更改。
While communicating, a host needs Layer-2 (MAC) address of the destination machine which belongs to the same broadcast domain or network. A MAC address is physically burnt into the Network Interface Card (NIC) of a machine and it never changes.
另一方面,公有域的 IP 地址很少更改。如果在出现某些故障的情况下更换了网卡,MAC 地址也会更改。这样,为了进行第 2 层通信,需要对两者进行映射。
On the other hand, IP address on the public domain is rarely changed. If the NIC is changed in case of some fault, the MAC address also changes. This way, for Layer-2 communication to take place, a mapping between the two is required.
为了得知广播域中远程主机的 MAC 地址,希望启动通信的计算机发送一个 ARP 广播消息,询问“谁拥有这个 IP 地址?”由于是广播,网络段(广播域)上的所有主机都会接收并处理此数据包。ARP 数据包包含目标主机的 IP 地址,发送主机希望与此主机通信。当一台主机收到发往自己的 ARP 数据包时,它会用自己的 MAC 地址回复。
To know the MAC address of remote host on a broadcast domain, a computer wishing to initiate communication sends out an ARP broadcast message asking, “Who has this IP address?” Because it is a broadcast, all hosts on the network segment (broadcast domain) receive this packet and process it. ARP packet contains the IP address of destination host, the sending host wishes to talk to. When a host receives an ARP packet destined to it, it replies back with its own MAC address.
一旦主机获取了目标 MAC 地址,它就可以使用第 2 层链路协议与远程主机通信。此 MAC 到 IP 的映射将保存到发送和接收主机的 ARP 缓存中。下次如果需要通信,它们可以直接引用各自的 ARP 缓存。
Once the host gets destination MAC address, it can communicate with remote host using Layer-2 link protocol. This MAC to IP mapping is saved into ARP cache of both sending and receiving hosts. Next time, if they require to communicate, they can directly refer to their respective ARP cache.
反向 ARP 是一种机制,其中主机知道远程主机的 MAC 地址,但需要知道 IP 地址才能进行通信。
Reverse ARP is a mechanism where host knows the MAC address of remote host but requires to know IP address to communicate.
Internet Control Message Protocol (ICMP)
ICMP 是一种网络诊断和错误报告协议。ICMP 属于 IP 协议套件,并使用 IP 作为载波协议。在构造 ICMP 数据包后,它会封装在 IP 数据包中。因为 IP 本身就是一种尽力而为的不可靠协议,所以 ICMP 也是如此。
ICMP is network diagnostic and error reporting protocol. ICMP belongs to IP protocol suite and uses IP as carrier protocol. After constructing ICMP packet, it is encapsulated in IP packet. Because IP itself is a best-effort non-reliable protocol, so is ICMP.
任何有关网络的反馈都将发回源主机。如果网络中发生某些错误,将通过 ICMP 报告。ICMP 包含数十个诊断和错误报告消息。
Any feedback about network is sent back to the originating host. If some error in the network occurs, it is reported by means of ICMP. ICMP contains dozens of diagnostic and error reporting messages.
ICMP-echo 和 ICMP-echo-reply 是最常用的 ICMP 消息,用于检查端到端主机的可达性。当主机收到 ICMP-echo 请求时,它会向回发送 ICMP-echo-reply。如果中转网络中出现任何问题,ICMP 都会报告该问题。
ICMP-echo and ICMP-echo-reply are the most commonly used ICMP messages to check the reachability of end-to-end hosts. When a host receives an ICMP-echo request, it is bound to send back an ICMP-echo-reply. If there is any problem in the transit network, the ICMP will report that problem.
Internet Protocol Version 4 (IPv4)
IPv4 是用作 TCP/IP 主机寻址机制的 32 位寻址方案。IP 寻址使 TCP/IP 网络上的每个主机都可以唯一标识。
IPv4 is 32-bit addressing scheme used as TCP/IP host addressing mechanism. IP addressing enables every host on the TCP/IP network to be uniquely identifiable.
IPv4 提供了分层寻址方案,可以将其网络划分为子网络,每个子网络都有明确定义的主机数量。IP 地址分为许多类别:
IPv4 provides hierarchical addressing scheme which enables it to divide the network into sub-networks, each with well-defined number of hosts. IP addresses are divided into many categories:
-
Class A - it uses first octet for network addresses and last three octets for host addressing
-
Class B - it uses first two octets for network addresses and last two for host addressing
-
Class C - it uses first three octets for network addresses and last one for host addressing
-
Class D - it provides flat IP addressing scheme in contrast to hierarchical structure for above three.
-
Class E - It is used as experimental.
IPv4 还拥有明确定义的地址空间,可作为私有地址(无法在互联网上路由)和公共地址(由 ISP 提供并可以在互联网上路由)使用。
IPv4 also has well-defined address spaces to be used as private addresses (not routable on internet), and public addresses (provided by ISPs and are routable on internet).
虽然 IP 不是可靠的,但它提供了“尽力而为的交付”机制。
Though IP is not reliable one; it provides ‘Best-Effort-Delivery’ mechanism.
Internet Protocol Version 6 (IPv6)
IPv4 地址枯竭催生了下一代互联网协议版本 6。IPv6 使用 128 位宽地址对节点进行寻址,为未来在整个地球或更远的地方使用提供了充足的地址空间。
Exhaustion of IPv4 addresses gave birth to a next generation Internet Protocol version 6. IPv6 addresses its nodes with 128-bit wide address providing plenty of address space for future to be used on entire planet or beyond.
IPv6 引入了 Anycast 地址指定,但去掉了广播概念。IPv6 使设备能够自动获取 IPv6 地址并在子网内通信。这种自动配置消除了对动态主机配置协议 (DHCP) 服务器的依赖。这样一来,即使该子网上的 DHCP 服务器宕机,主机也能相互通信。
IPv6 has introduced Anycast addressing but has removed the concept of broadcasting. IPv6 enables devices to self-acquire an IPv6 address and communicate within that subnet. This auto-configuration removes the dependability of Dynamic Host Configuration Protocol (DHCP) servers. This way, even if the DHCP server on that subnet is down, the hosts can communicate with each other.
IPv6 提供了 IPv6 移动性这一新特性。具备移动 IPv6 的机器可以在无需更改其 IP 地址的情况下漫游。
IPv6 provides new feature of IPv6 mobility. Mobile IPv6 equipped machines can roam around without the need of changing their IP addresses.
IPv6 仍处于过渡阶段,预计在未来几年将完全取代 IPv4。目前,只有少数网络在运行 IPv6。有一些过渡机制可用于使启用了 IPv6 的网络在 IPv4 上轻松地相互通信和漫游。这些机制包括:
IPv6 is still in transition phase and is expected to replace IPv4 completely in coming years. At present, there are few networks which are running on IPv6. There are some transition mechanisms available for IPv6 enabled networks to speak and roam around different networks easily on IPv4. These are:
-
Dual stack implementation
-
Tunneling
-
NAT-PT