11 · Introducing the TCP_IP Internet Layer, IPv4 Addressing, and Subnets認識 TCP/IP 網際網路層、IPv4 定址與子網路

Reserved IPv4 Addresses保留 IPv4 位址

Certain IPv4 addresses are reserved and cannot be assigned to individual devices on a network. Reserved IPv4 addresses include a network address used to identify the network itself and a broadcast address, which is used for broadcasting packets to all the devices on a network.

某些 IPv4 位址是保留位址,不能指派給網路上的個別裝置。保留的 IPv4 位址包括用來識別網路本身的網路位址,以及用於向網路上所有裝置廣播封包的廣播位址。

Network Address

網路位址

The network address is a standard way to refer to a network. An IPv4 address that has binary zeros in all the host bit positions is reserved for the network address.

網路位址是用來指稱一個網路的標準方式。所有主機位元位置皆為二進位 0 的 IPv4 位址,保留作為網路位址。

For example, in a Class A network, 10.0.0.0 is the IPv4 address of the network containing the host 10.1.2.3. All hosts in 10.0.0.0 will have the same network bits. The IPv4 address 172.16.0.0 is a Class B network address, and 192.168.1.0 is a Class C network address. A router uses the network IPv4 address when it searches its IPv4 routing table for the destination network location.

舉例來說,在一個 A 級網路中,10.0.0.0 是包含主機 10.1.2.3 之網路的 IPv4 位址。10.0.0.0 中的所有主機都會有相同的網路位元。IPv4 位址 172.16.0.0 是 B 級網路位址,而 192.168.1.0 是 C 級網路位址。路由器在其 IPv4 路由表中搜尋目的網路位置時,會使用網路 IPv4 位址。

When networks are subnetted, the IPv4 address with binary zeros in all the host bit positions is still reserved for the address of the subnet. For example, 172.16.1.0/24 is the address of a subnet.

當網路被劃分子網路時,所有主機位元位置皆為二進位 0 的 IPv4 位址,仍保留作為該子網路的位址。舉例來說,172.16.1.0/24 就是某個子網路的位址。

Local Broadcast Address

本地廣播位址

If an IPv4 device wants to communicate with all the devices on the local network, it sets the destination address to all ones (255.255.255.255) and transmits the packet. For example, hosts that do not know their network number will use the 255.255.255.255 broadcast address to ask a server for the network address. The local broadcast is never routed beyond the local network or subnet.

若一部 IPv4 裝置想要與本地網路上的所有裝置通訊,它會將目的位址設為全部為 1(255.255.255.255)並傳送封包。舉例來說,不知道自己網路號碼的主機,會使用 255.255.255.255 廣播位址向伺服器詢問網路位址。本地廣播絕不會被路由到本地網路或子網路之外。

Directed Broadcast Address

導向廣播位址

The broadcast IPv4 address of a network is a special address for each network that allows communication to all the hosts in that network. To send data to all the hosts in a network, a host can send a single packet that is addressed to the broadcast address of the network. The broadcast address uses the highest address in the network range, which is the address in which all of the bits in the host portion are all ones. For network 10.0.0.0/8, with 8 network bits, the broadcast address would be 10.255.255.255. This address is also referred to as the directed broadcast.

網路的廣播 IPv4 位址,是每個網路用來與該網路中所有主機通訊的特殊位址。若要將資料傳送給網路中的所有主機,主機可以傳送一個定址到該網路廣播位址的單一封包。廣播位址使用該網路範圍中最高的位址,也就是主機部分所有位元皆為 1 的位址。以擁有 8 個網路位元的網路 10.0.0.0/8 為例,其廣播位址會是 10.255.255.255。此位址也稱為導向廣播(directed broadcast)。

Assuming a hypothetical network in which every IPv4 host address was in use on the 10.0.0.0/8 network, a ping to 10.255.255.255 would receive a response from all 16,777,214 hosts.

假設在一個假想網路中,10.0.0.0/8 網路上的每個 IPv4 主機位址都已被使用,對 10.255.255.255 進行 ping,將會收到所有 16,777,214 台主機的回應。

For the network address 172.16.0.0/16, the last 16 bits make up the host field (or host part of the address). The broadcast that would be sent out to all the devices on that network would have a destination address of 172.16.255.255.

以網路位址 172.16.0.0/16 為例,最後 16 個位元構成主機欄位(或位址的主機部分)。要傳送給該網路上所有裝置的廣播,目的位址會是 172.16.255.255。

For the network address 192.168.11.0/24, the last 8 bits make up the host field (or host part of the address). The broadcast that would be sent out to all the devices on that network would have a destination address of 192.168.11.255.

以網路位址 192.168.11.0/24 為例,最後 8 個位元構成主機欄位(或位址的主機部分)。要傳送給該網路上所有裝置的廣播,目的位址會是 192.168.11.255。

For the subnet address 192.168.11.32/28, the last 4 bits are the host bits, so the directed broadcast address would be 192.168.11.47.

以子網路位址 192.168.11.32/28 為例,最後 4 個位元是主機位元,因此導向廣播位址會是 192.168.11.47。

Local Loopback Address

本地回送位址

A local loopback address is used to let the system send a message to itself for testing. The loopback address creates a shortcut method for TCP/IP applications and services that run on the same device to communicate with one another. A typical local loopback IPv4 address is 127.0.0.1. You can ping any IPv4 address in the 127.0.0.0/8 range to test the local TCP/IP stack on a Microsoft Windows host. This is typically done to make sure that the system's network software and hardware is functioning correctly.

本地回送位址(loopback address)用於讓系統將訊息傳送給自己以進行測試。回送位址為執行於同一裝置上的 TCP/IP 應用程式與服務提供一種相互通訊的捷徑方法。典型的本地回送 IPv4 位址是 127.0.0.1。你可以對 127.0.0.0/8 範圍內的任何 IPv4 位址執行 ping,以測試 Microsoft Windows 主機上的本地 TCP/IP 堆疊。這麼做通常是為了確認系統的網路軟體與硬體運作正常。

Autoconfiguration IPv4 Addresses

自動設定 IPv4 位址

When neither a statically nor a dynamically configured IPv4 address is found on startup, those hosts supporting IPv4 link-local addresses (RFC 3927) will generate an address in the 169.254.0.0/16 range. This address can be used only for local network connectivity and operates with many caveats, one of which is that it will not be routed. You will mostly see this address as a failure condition when a PC fails to obtain an address via DHCP. This feature called Automatic Private IP Addressing (APIPA) is implemented in Microsoft and Apple operating systems.

當開機時既找不到靜態設定也找不到動態設定的 IPv4 位址時,支援 IPv4 鏈路本地位址(RFC 3927)的主機會在 169.254.0.0/16 範圍內產生一個位址。此位址只能用於本地網路連線,且有許多限制,其中之一是不會被路由。你多半會在 PC 無法透過 DHCP 取得位址時,看到這個位址作為失敗狀況出現。這項名為自動私有 IP 定址(APIPA)的功能,已在 Microsoft 及 Apple 作業系統中實作。

IPv4 Addresses for Documentation

供文件使用的 IPv4 位址

Address blocks 198.51.100.0/24 and 203.0.113.0/24 are assigned for use in documentation and example code. They are often used along with example.com or example.net domain names in vendor and protocol documentation. As described in RFC 5737, addresses within these blocks do not legitimately appear on the public internet and can be used without any coordination with IANA or an internet registry.

位址區塊 198.51.100.0/24 與 203.0.113.0/24 保留供文件與範例程式碼使用。這些位址通常會與 example.com 或 example.net 網域名稱一起,出現在廠商及協定文件中。如 RFC 5737 所述,這些區塊內的位址不會合法出現在公開網際網路上,且可在不需與 IANA 或網際網路註冊機構協調的情況下使用。

All Zeros Address

全零位址

The address 0.0.0.0 indicates the host in "this" network and is used only as a source address. An example use case is the DHCP assignment process before the host has a valid IPv4 address.

位址 0.0.0.0 表示「此」網路中的主機,僅作為來源位址使用。一個範例情境是主機尚未取得有效 IPv4 位址前的 DHCP 指派程序。

For more information about reserved IPv4 addresses, refer to RFC 5735.

如需保留 IPv4 位址的更多資訊,請參閱 RFC 5735。

Which type of reserved IPv4 address is 127.0.0.1?127.0.0.1 屬於哪一種保留 IPv4 位址?