Unix Sockets 简明教程
Unix Socket - Network Addresses
在我们继续进行实际操作之前,让我们简要讨论一下网络地址 − IP 地址。
Before we proceed with the actual stuff, let us discuss a bit about the Network Addresses − the IP Address.
IP 主机地址,或更通俗的说 IP 地址,用于识别连接到互联网的主机。IP 代表互联网协议,是指互联网的整体网络架构中的互联网层。
The IP host address, or more commonly just IP address, is used to identify hosts connected to the Internet. IP stands for Internet Protocol and refers to the Internet Layer of the overall network architecture of the Internet.
IP 地址是一个 32 位量,被解释为四个 8 位数或八位字节。每个 IP 地址唯一标识参与用户网络、网络上的主机以及用户网络的类。
An IP address is a 32-bit quantity interpreted as four 8-bit numbers or octets. Each IP address uniquely identifies the participating user network, the host on the network, and the class of the user network.
IP 地址通常以点分十进制表示法 N1.N2.N3.N4 编写,其中每个 Ni 都是一个介于 0 到 255 的十进制数字(00 到 FF 十六进制)。
An IP address is usually written in a dotted-decimal notation of the form N1.N2.N3.N4, where each Ni is a decimal number between 0 and 255 decimal (00 through FF hexadecimal).
Address Classes
IP 地址由互联网号码分配局 (IANA) 管理和创建。有五种不同的地址类。您可以通过检查 IP 地址的前四个位来确定 IP 地址属于哪个类。
IP addresses are managed and created by the Internet Assigned Numbers Authority (IANA). There are five different address classes. You can determine which class an IP address is in by examining the first four bits of the IP address.
-
Class A addresses begin with 0xxx, or 1 to 126 decimal.
-
Class B addresses begin with 10xx, or 128 to 191 decimal.
-
Class C addresses begin with 110x, or 192 to 223 decimal.
-
Class D addresses begin with 1110, or 224 to 239 decimal.
-
Class E addresses begin with 1111, or 240 to 254 decimal.
以 01111111 或 127 十进制开头的地址保留用于环回和本地计算机的内部测试 [您可以测试这一点:您应该始终能够 ping 127.0.0.1 ,它指向您自己];D 类地址保留用于多播;E 类地址保留供将来使用。不应将其用于主机地址。
Addresses beginning with 01111111, or 127 decimal, are reserved for loopback and for internal testing on a local machine [You can test this: you should always be able to ping 127.0.0.1, which points to yourself]; Class D addresses are reserved for multicasting; Class E addresses are reserved for future use. They should not be used for host addresses.
Subnetting
子网划分为或子网划定基本上意味着分支网络。出于各种原因可以进行此操作,例如组织中的网络、使用不同的物理媒体(例如以太网、FDDI、WAN 等)、保留地址空间和安全性。最常见的原因是控制网络流量。
Subnetting or subnetworking basically means to branch off a network. It can be done for a variety of reasons like network in an organization, use of different physical media (such as Ethernet, FDDI, WAN, etc.), preservation of address space, and security. The most common reason is to control network traffic.
子网划分的基本思路是将 IP 地址的主机标识符部分划分为两部分——
The basic idea in subnetting is to partition the host identifier portion of the IP address into two parts −
-
A subnet address within the network address itself; and
-
A host address on the subnet.
例如,常见的 B 类地址格式为 N1.N2.S.H,其中 N1.N2 标识 B 类网络,8 位 S 字段标识子网,8 位 H 字段标识子网上的主机。
For example, a common Class B address format is N1.N2.S.H, where N1.N2 identifies the Class B network, the 8-bit S field identifies the subnet, and the 8-bit H field identifies the host on the subnet.