+ -

1.08: Basic TCP/IP Networking

时间:2007-04-03

来源:austin22

在手机上看
手机扫描阅读
Certification Objective 1.08: Basic TCP/IP Networking
认证目的 1.08: 基本传输控制协议/IP 连网

TCP/IP is a series of protocols organized in layers, known as a protocol suite.
传输控制协议/IP 是在层中被组织的一系列的协定,他们[她们] 即是一个协定程序组。

 It was developed for Unix and eventually adopted as the standard for communication on the Internet.
 它为 Unix 和最后被发展当做标准采用为通信在因特网上。

 With IP addresses, it can help you organize your network.
 藉由 IP 位址,它能帮助你组织你的网络。

 Then, there are a number of TCP/IP tools and configurations that can help you manage your network.
 然后,有一些传输控制协议/IP 工具和能帮助你处理你的网络的配置。

As with the previous sections in this chapter, the statements here are oversimplifications.
关于这一个章节的早先区段,这里的指述是过度简化。

 So if you find this section overwhelming, read the references cited at the beginning of the chapter.
 因此如果你找这一个区段压倒性的, 读参考引证从最初的地方章节。

 Linux is built for networking, and there is no practical way to pass either the RHCT or the RHCE exams unless you understand networking in some detail.
 除非你了解一些明细的连网,否则 Linux 为连网被建造,而且没有实际的方法要通过 RHCT 或 RHCE 考试。

IP Numbers and Classes
IP 编号和类别

Every computer that communicates on a network needs its own IP address.
在一个网络上沟通的每部计算机需要它自己的 IP 位址。

 Some addresses are assigned permanently to a particular computer;
 一些位址长备地被指定给一部特别的计算机;

 these are known as static addresses.
 这些即是静态的位址。

 Others are leased from a DHCP server for a limited amount of time;
 其他从一个 DHCP 服务器被出租有限制量的时间;

 these are also known as dynamic IP addresses.
 这些也即是动态的 IP 位址。

Two standards for IP addresses are in use today, IP version 4 (IPv4) and IP version 6 (IPv6).
对于 IP 位址的二个标准今天在使用中, IP 4 版 (IPv4) 和 IP 6 版 (IPv6).

 IPv4 addresses have 32 bits and are set up in octets in dotted decimal notation.
 IPv4 位址有 32 位元而且在有点的十位标志的八位[位]组中被建立。

 The range of possible IPv4 addresses is between 0.0.0.0 to 255.255.255.255.
 多种的可能 IPv4 位址是在 0.0.0.0-255.255.255.255之间.

 While over four billion IP addresses are available, that is not nearly enough for the current Internet.
 超过四十亿个 IP 位址是可得的,不过那对目前的因特网是不几乎充足的。

IPv6 addresses have 128 bits and are set up in hexadecimal notation.
IPv6 位址有 128 位元而且在十六进记法中被建立。

 An IPv6 address is normally organized in eight groups of four hexadecimal numbers each, and it may look like 4abe:03e2:c132:69fa:0000:0000:c0b8:2148.
 一个 IPv6 位址通常每个在八群四个十六进位编号中被组织,而且它可能看起来像 4 abe 一样:03 e 2:c 132:69 fa:0000:0000:c 0 b 8:2148.

 More than 340,000,000,000,000,000,000,000,000,000,000,000,000 IPv6 addresses are available.
 超过 340,000,000,000,000,000,000,000,000,000,000,000,000个 IPv6 位址是可得的。

To ease the transition, specific IPv6 addresses have been assigned for every one of the four billion IPv4 addresses.
为了要减轻过渡,特定的 IPv6 位址已经为这四十亿个 IPv4 位址之中的每一个被分配。

 There are still over 3.4x1038 addresses left over.
 仍然有结束被留下的超过 3.4 x 1038个位址。

 While actual routing on the Internet now commonly uses IPv6, network configuration in Linux is still normally based on IPv4 addresses.
 在因特网上的真实的路由选择现在普遍使用 IPv6, 网络配置在 Linux 仍然通常以 IPv4 位址为基础。

IPv4 addresses are organized into five different classes, as shown in Table 1-7.
IPv4 位址被编入五个不同的类别,如表 1-7 所示。

 The academics among you may note that this is different from the official addresses in each IPv4 class as specified in RFC 1518 from the Internet Engineering Task Force (www.ietf.org).
 在你之中的学者可能注意这在如来自因特网工程特别工作小组 (www.ietf.org) 的 RFC 1518 所指定的每个 IPv4 类别中不同于官方的位址。

 The assignable address range includes those IP addresses that can be assigned to a specific computer on a network.
 可分配的位址范围包括那些 IP 能在一个网络上被指定给一部特定的计算机的位址。

Table 1-7: IP Address Classes
表 1-7: IP 位址分类

 Class
类别

 Assignable Address Range
 可分配的位址系列

 Note
 注意

A

 1.1.1.1-126.255.255.254

 Allows networks of up to 16 million computers
 允许达一千六百万部计算机的网络

B

 128.0.0.1-191.255.255.254

 Allows networks of up to 65,000 computers
 允许达 65,000部计算机的网络

C

 192.0.0.1-223.255.255.254

 Allows networks of up to 254 computers
 允许达 254部计算机的网络

D

 224.0.0.1-239.255.255.254

 Reserved for multicasts
 为多播保留

E

 240.0.0.1-255.255.255.254

 Reserved for experimental use
 为实验的使用保留

In addition, there are a number of private IP addresses that are not to be assigned to any computer that is directly connected to the Internet.
除此之外,有一些私人的 IP 位址哪一是不被指定给任何的直接地被连接到因特网的计算机。

 They are associated with network addresses 10.0.0.0, 172.168.0.0, and 192.168.0.0 through 192.168.255.0.
 他们与网络位址 10.0.0.0,172.168.0.0 有关, 和 192.168.0.0 直到 192.168.255.0.

IP Addresses Define a Network
IP 位址定义一个网络

Three key IP addresses define a network:
三主要 IP 位址定义一个网络:

 the network address, the broadcast address, and the subnet mask.
 网络位址, 广播定址, 和子网路遮罩。

 The network address is always the first IP address in a range;
 网络位址总是一个范围的第一个 IP 位址;

 the broadcast address is always the last address in the same range.
 广播的位址总是相同的范围的最后一个位址。

 The subnet mask helps your computer define the difference between the two addresses.
 子网路遮罩帮助你的计算机定义在这二个位址之间的差。

 You can assign IP addresses between the network and broadcast addresses (not including these addresses) to any computer on the network.
 你能在网络上分配网络和广播的位址 (不包括这些位址) 之间的 IP 位址到任何的计算机。

As an example, let's define the range of addresses for a private network.
为例,让我们为一个私人的网络定义多种的位址。

 Start with the private network address 192.168.122.0.
 从私人的网络位址 192.168.122.0 开始。

 Use the standard subnet mask for a class C network, 255.255.255.0.
 使用标准的子网路遮罩作为一个类别 C网路, 255.255.255.0.

 Based on these two addresses, the broadcast address is 192.168.122.255, and the range of IP addresses that you can assign on that particular network is 192.168.122.1 through 192.168.122.254.
 基于这些二个位址,广播的位址是 192.168.122.255, 和多种的 IP 位址你能在特别的网络是 192.168.122.1 直到 192.168.122.254 上分配.

If this is confusing to you in any way, please refer to the IP Sub-Networking Mini-HOWTO of the Linux Documentation Project at www.tldp.org.
如果这正在以任何方式对你困惑, 请提及 IP 子网络迷你-在 www.tldp.org 的 Linux 文件编写计画的 HOWTO。

Tools and Commands
工具和指令

You have a substantial number of tools available to manage the TCP/IP protocol suite on your Linux computer.
你有可得的很多工具在你的 Linux 计算机上处理传输控制协议/IP 协定程序组。

 Three of the more important commands are ping, ifconfig, and netstat.
 比较重要指令中的三个是查验, ifconfig 、和 netstat。

ping

The ping command allows you to test connectivity-locally, within your network, and on the Internet.
乒声指令让你测试连接-地方性地,在你的网络里面, 和在因特网上。

 For the purpose of this section, assume your IP address is 192.168.122.43, and the gateway address on your network is 192.168.122.99.
 为了这一个区段,承担你的 IP 位址是 192.168.122.43 ,而且通道位址在你的网络上是 192.168.122.99 。

 If you're having problems connecting to a network, you should use the ping command in the following order.
 如果你有对一个网络的问题接,你应该在下列的命令中使用乒声指令。

 The first step is to test the integrity of TCP/IP on your computer:
 第一个步将在你的计算机上测试传输控制协议/IP 的完整性:

# ping 127.0.0.1

Normally, ping works continuously on Linux; you'll need to press CTRL-C to stop this command.
通常,乒声连续地在 Linux 上工作; 你将会需要按 CTRL-C语言停止这指令。

 If you need to see if you're properly connected to your LAN, you should ping your own IP address:
 如果如果你适当地被连接到你的区域网络,你需要见到,你应该查验你自己的 IP 位址:

# ping 192.168.122.43

If that works, ping the address of another computer on your network.
如果那工作,在你的网络上查验另外的一部计算机的位址。

 Then start tracing the route to the Internet.
 然后启动追踪对因特网的路由。

 ping the address for your gateway, in this case, 192.168.122.99.
 为你的通道查验位址,在这情况, 192.168.122.99.

 If possible, ping the address of your network's connection to the Internet.
 如果可能的, 查验你网络和因特网的关联的位址。

 And finally, ping the address of a computer that you know is active on the Internet.
 而且最后,查验你知道的计算机的位址在因特网上是活跃的。

You can substitute host names such as www.google.com for an IP address.
你能替换主机名称如此的当做为一个 IP 位址的 www.google.com。

 If the host name doesn't work, there's a problem with the database of host names and IP addresses, more commonly known as a DNS, BIND, or nameserver.
如果主机名称不工作,有主机名称的数据库和 IP 的问题位址, 更普遍知道当一个 DNS,绑之时, 或 nameserver。

ifconfig

The ifconfig command can help you check and configure network adapters.
ifconfig 指令能帮助你检查而且配置网络转接器。

 Run the ifconfig command by itself to see the detected adapters on your computer.
 独自运行 ifconfig 指令在你的计算机上见到被发现的转接器。

 You can also use ifconfig to assign IP address or hardware port information as well.
 你也能使用 ifconfig 也分配 IP 位址或硬件埠信息。

 For example, if you want to assign IRQ 10 to the second Ethernet adapter, run the following command:
 举例来说,如果你想要分配 IRQ 10 到第二个以太网络转接器, 运行下列的指令:

# ifconfig eth1 irq 10

For more information on ifconfig, refer to Chapter 4.
对于关于 ifconfig 的较多资讯,提及第 4 章。

netstat

The netstat command is versatile; it can help you see the channels available for network connections, interface statistics, and more.
netstat 指令是用途广泛的; 它能帮助你见到网络连接可用的波道, 介面统计学、和更多。

 One important version of this command, netstat -r, displays routing tables that can tell you if your computer knows where to send a message.
 一个重要这指令的版本, netstat-r,显示如果你的计算机知道该哪里传达一个信息,能告诉你的路由选择表。

 More information on this command is available in Chapter 4.
 关于这指令的较多资讯在第 4 章是可得的。

Name Resolution
名字解析度

When I used a static IP address on my high-speed Internet connection, I could sometimes memorize those numbers.
当我在我的高速因特网连接上用了一个静态的 IP 位址的时候,我可以有时记住那些数目。

 But how can anyone memorize the IP addresses of every Web site you need on the Internet?
 但是任何人如何能记住你在因特网上需要的每个网站的 IP 位址?

 Using four configuration files, Linux can help you translate computer host names to IP addresses.
 使用四个配置文件, Linux 能帮助你将计算机主机名称翻译成 IP 位址。

/etc/hosts

The first database of host names and IP addresses was set up in a static text file, /etc/hosts.

主机名称和 IP 位址的第一个数据库在一个静态的文字档中被建立, /及其他/主机。

 When there were just a few nodes on the network that eventually turned into the Internet, it was possible to maintain identical /etc/hosts files on each computer.
 当确实有一些波节在最后变成了因特网的网络上的时候,维持是可能的同一 /及其他/在每部计算机上的主机文件。
 
 Here's a typical line in /etc/hosts, which lists the IP address, fully qualified domain name, and alias for one computer connection:
 在这里是一个典型的线在 /etc/hosts,列出 IP 位址, 完全取得资格网域名称, 和别名为一部计算机连接:

192.168.132.32    linux1.mommabears.com  laptop

/etc/resolv.conf

There are millions of hosts on the Internet.
有数以百万计的主机在因特网上。

 Even if it were possible to collect all domain names and IP addresses into a /etc/hosts file, the file would overwhelm every computer.
 即使收集所有的网域名称是可能的和 IP 位址进入一 /及其他/主机文件之内,文件会淹没每部计算机。

 And it would overwhelm every network administrator who would have to make sure that all the /etc/hosts files on the Internet match-and get updated every time a new Web site appears.
 而且它会淹没每个网络会必须确定的系统管理师所有的那 /etc/hosts 在因特网比赛上申请-而且拿每一次更新一个新的网站出现。

 That's why the Domain Name System (DNS) was developed, based on the Berkeley Internet Name Domain (BIND).
 那有网域名称系统 (DNS) 为什么被发展, 基于柏克莱因特网名字网域了.(绑)

 In /etc/resolv.conf, the IP address of each DNS server is listed with a simple line similar to:
 在 /etc/resolv.conf, 每个 DNS 服务器的 IP 位址与一个简单的线一起列出类似:

nameserver 192.168.0.1

/etc/host.conf

Many networks configure an /etc/hosts file for the local network and a DNS server for other networks and/or the Internet.
许多网络配置一 /etc/hosts 文件为当地的网络和一个 DNS 服务器为其他的网络以及/ 或因特网。

 When your computer looks for an IP address, this file determines whether it searches through /etc/hosts or DNS first.
 当你的计算机找寻一个 IP 位址的时候,这一个文件决定是否它搜寻过 /etc/hosts 或者 DNS 优先。

 This is usually a one-line file:
 这通常是一个单一线的文件:

order hosts,bind
命令主机,绑

A computer with this line looks through /etc/hosts first.
一部计算机用这一个线看过 /etc/hosts 首先。

 If it can't find the computer name that you want in that file, it next looks to the DNS server (bind) for the computer name.
如果它不能找你在那一个文件中想要的计算机名字,它然后期待 DNS 服务器 (绑) ,计算机命名。

/etc/nsswitch.conf

This file relates to the configuration on a network of Linux- and Unix-type computers, which are configured to communicate using the Network File System (NFS).
这一个文件在一个 Linux 的网络上与配置有关- 而且 Unix类型计算机, 配置成使用网络文件系统 (NFS) 沟通.

 When it is used in concert with the Network Information System (NIS), networks can maintain a single database of usernames and passwords for all NFS-enabled computers on that network.
 当它共同地被网络信息制度 (NIS) 所用的时候,网络能在那网络上为所有的 NFS 计算机能够的维持使用者名称和口令[字] 的一个数据库。