Translated page network

This commit is contained in:
Poltern 2023-06-05 02:10:42 +05:00
parent 9604b33c8e
commit a5c7a53011

View File

@ -8,44 +8,39 @@
<sect1 id="ch-config-network" revision="sysv"> <sect1 id="ch-config-network" revision="sysv">
<?dbhtml filename="network.html"?> <?dbhtml filename="network.html"?>
<title>General Network Configuration</title> <title>Настройка сети</title>
<indexterm zone="ch-config-network"> <indexterm zone="ch-config-network">
<primary sortas="d-network">network</primary> <primary sortas="d-network">network</primary>
<secondary>configuring</secondary></indexterm> <secondary>configuring</secondary></indexterm>
<sect2> <sect2>
<title>Creating Network Interface Configuration Files</title> <title>Создание файлов конфигурации сетевого интерфейса</title>
<para>Which interfaces are brought up and down by the network script <para>Какие интерфейсы активируются и отключаются сетевым скриптом
usually depends on the files in <filename обычно зависит от файлов в <filename
class="directory">/etc/sysconfig/</filename>. This directory should class="directory">/etc/sysconfig/</filename>. Этот каталог должен содержать файл для каждого
contain a file for each interface to be configured, such as настраиваемого интерфейса, например, <filename>ifconfig.xyz</filename>, где <quote>xyz</quote>
<filename>ifconfig.xyz</filename>, where <quote>xyz</quote> should describe должен описывать сетевую карту. Имя интерфейса (например, eth0) обычно является подходящим.
the network card. The interface name (e.g. eth0) is usually appropriate. Внутри этого файла находятся атрибуты этого интерфейса, такие как его IP-адрес (адреса), маска
Inside this file are attributes to this interface, such as its IP подсети и так далее. Необходимо, чтобы у файла было следующее имя: <emphasis>ifconfig</emphasis>.</para>
address(es), subnet masks, and so forth. It is necessary that the stem of
the filename be <emphasis>ifconfig</emphasis>.</para>
<note> <note>
<para>If the procedure in the previous section was not used, udev <para>Если процедура именования из предыдущего раздела не использовалась, udev будет назначать
will assign network card interface names based on system physical имена интерфейсов сетевых карт на основе физических характеристик системы, например, enp2s1. Если
characteristics such as enp2s1. If you are not sure what your interface вы не знаете имя вашего интерфейса, вы всегда можете запустить <command>ip link</command>
name is, you can always run <command>ip link</command> or <command>ls или <command>ls /sys/class/net</command> после загрузки системы.
/sys/class/net</command> after you have booted your system.
</para> </para>
<para>The interface names depend on the implementation and <para>Имена интерфейсов зависят от реализации и конфигурации демона udev, запущенного в системе.
configuration of the udev daemon running on the system. The udev Udev-демон для LFS (установленный в <xref linkend="ch-system-eudev"/>) не будет запускаться до тех
daemon for LFS (installed in <xref linkend="ch-system-eudev"/>) will пор, пока не загрузится система LFS. Таким образом, ненадежно определять имена интерфейсов,
not run until the LFS system is booted. So it's unreliable to используемых в системе LFS, путем запуска этой команды в хост-дистрибутиве, <emphasis>даже в среде
determine the interface names being used in LFS system by running chroot</emphasis></para>
those commands on the host distro,
<emphasis>even though in the chroot environment</emphasis>.</para>
</note> </note>
<para>The following command creates a sample file for the <para>Следующая команда создает пример конфигурационного файла для
<emphasis>eth0</emphasis> device with a static IP address:</para> устройства <emphasis>eth0</emphasis> со статическим IP-адресом:</para>
<!-- jhalfs relies on the values for IFACE, IP, etc. If you want to change <!-- jhalfs relies on the values for IFACE, IP, etc. If you want to change
them, please inform the jhalfs maintainer(s). --> them, please inform the jhalfs maintainer(s). -->
<screen><userinput>cd /etc/sysconfig/ <screen><userinput>cd /etc/sysconfig/
@ -59,110 +54,98 @@ PREFIX=<replaceable>24</replaceable>
BROADCAST=<replaceable>192.168.1.255</replaceable></literal> BROADCAST=<replaceable>192.168.1.255</replaceable></literal>
EOF</userinput></screen> EOF</userinput></screen>
<para>The values in italics must be changed in every file to match <para>Значения, выделенные курсивом, должны быть заменены соответствующими правильными значениями</para>
the proper setup.</para>
<para>If the <envar>ONBOOT</envar> variable is set to <quote>yes</quote> the <para>Если переменной <envar>ONBOOT</envar> присвоено значение <quote>yes</quote>, сценарий загрузки сети
System V network script will bring up the Network Interface Card (NIC) during System V вызовет сетевую карту (NIC) в процессе загрузки системы. Если задано значение, отличное от <quote>yes</quote>
the system boot process. If set to anything but <quote>yes</quote> the NIC сетевой адаптер будет проигнорирован сетевым скриптом и не будет вызываться автоматически. Интерфейс можно
will be ignored by the network script and not be automatically brought up. запустить или остановить вручную с помощью команд
The interface can be manually started or stopped with the <command>ifup</command> и <command>ifdown</command>.</para>
<command>ifup</command> and <command>ifdown</command> commands.</para>
<para>The <envar>IFACE</envar> variable defines the interface name, <para>Переменная <envar>IFACE</envar> определяет имя сетевого интерфейса, например,
for example, eth0. It is required for all network device configuration eth0. Она необходима для всех файлов конфигураций сетевых устройств. Расширение
files. The filename extension must match this value.</para> файла должно соответствовать этому значению.</para>
<para>The <envar>SERVICE</envar> variable defines the method used for <para>Переменная <envar>SERVICE</envar> определяет метод получения IP-адреса. Пакет
obtaining the IP address. The LFS-Bootscripts package has a modular IP LFS-Bootscripts имеет модульный формат назначения IP, а создание дополнительных файлов
assignment format, and creating additional files in the <filename в каталоге <filename class="directory">/lib/services/</filename> позволит использовать
class="directory">/lib/services/</filename> directory allows other IP другие методы назначения IP. Переменная обычно используется для протокола DHCP
assignment methods. This is commonly used for Dynamic Host Configuration (Dynamic Host Configuration Protocol), который рассматривается в книге BLFS</para>
Protocol (DHCP), which is addressed in the BLFS book.</para>
<para>The <envar>GATEWAY</envar> variable should contain the default <para>Переменная <envar>GATEWAY</envar> должна содержать IP-адрес шлюза по умолчанию, если
gateway IP address, if one is present. If not, then comment out the таковой имеется. Если нет, то закомментируйте эту строку.</para>
variable entirely.</para>
<para>The <envar>PREFIX</envar> variable contains the number of <para>Переменная <envar>PREFIX</envar> содержит количество бит, используемых в подсети. Каждый
bits used in the subnet. Each octet in an IP address is 8 bits. If the октет в IP адресе составляет 8 бит. Если маска подсети равна 255.255.255.0, тогда используется
subnet's netmask is 255.255.255.0, then it is using the first three octets первые три октета (24 бита) для указания маски сети. Если маска подсети 255.255.255.240, то будут
(24 bits) to specify the network number. If the netmask is 255.255.255.240, использованы первые 28 бит. Префиксы длиннее 24 бит обычно используются DSL и кабельными
it would be using the first 28 bits. Prefixes longer than 24 bits are интернет-провайдерами (ISP). В этом примере (PREFIX=24) маска подсети 255.255.255.0. Измените переменную
commonly used by DSL and cable-based Internet Service Providers (ISPs). <envar>PREFIX</envar> в соответствии конфигурацией вашей подсети. Если этот параметр опущен, по умолчанию
In this example (PREFIX=24), the netmask is 255.255.255.0. Adjust the используется значение 24.</para>
<envar>PREFIX</envar> variable according to your specific subnet.
If omitted, the PREFIX defaults to 24.</para>
<para>For more information see the <command>ifup</command> man page.</para> <para>Для получения дополнительной информации смотрите справочную страницу <command>ifup</command>.</para>
</sect2> </sect2>
<sect2 id="resolv.conf"> <sect2 id="resolv.conf">
<title>Creating the /etc/resolv.conf File</title> <title>Создание файла /etc/resolv.conf</title>
<indexterm zone="resolv.conf"> <indexterm zone="resolv.conf">
<primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary> <primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary>
</indexterm> </indexterm>
<para>The system will need some means of obtaining Domain Name Service <para>Системе потребуются дополнительные настройки службы доменных имен (DNS) для преобразования
(DNS) name resolution to resolve Internet domain names to IP addresses, and имен сети Интернет в IP-адреса и наоборот. Это достигается путем указания IP-адреса DNS-сервера,
vice versa. This is best achieved by placing the IP address of the DNS доступного от провайдера или администратора сети, в <filename>/etc/resolv.conf</filename>. Создайте файл,
server, available from the ISP or network administrator, into выполнив следующие действия:</para>
<filename>/etc/resolv.conf</filename>. Create the file by running the
following:</para>
<screen><userinput>cat &gt; /etc/resolv.conf &lt;&lt; "EOF" <screen><userinput>cat &gt; /etc/resolv.conf &lt;&lt; "EOF"
<literal># Begin /etc/resolv.conf <literal># Begin /etc/resolv.conf
domain <replaceable>&lt;Your Domain Name&gt;</replaceable> domain <replaceable>&lt;Ваше доменное имя&gt;</replaceable>
nameserver <replaceable>&lt;IP address of your primary nameserver&gt;</replaceable> nameserver <replaceable>&lt;IP-адрес вашего основного DNS-сервера&gt;</replaceable>
nameserver <replaceable>&lt;IP address of your secondary nameserver&gt;</replaceable> nameserver <replaceable>&lt;IP-адрес вашего дополнительного DNS-сервера&gt;</replaceable>
# End /etc/resolv.conf</literal> # End /etc/resolv.conf</literal>
EOF</userinput></screen> EOF</userinput></screen>
<para>The <varname>domain</varname> statement can be omitted <para>Оператор <varname>domain</varname> может быть опущен
or replaced with a <varname>search</varname> statement. See the man page for или заменён оператором <varname>search</varname>. Смотрите справочную страницу resolv.conf для
resolv.conf for more details.</para> получения подробной информации.</para>
<para>Replace <replaceable>&lt;IP address of the nameserver&gt;</replaceable> <para>Замените <replaceable>&lt;IP-адрес вашего основного DNS-сервера&gt;</replaceable>
with the IP address of the DNS most appropriate for the setup. There will адресом наиболее подходящего DNS сервера. DNS серверов, может быть указано более одной записи
often be more than one entry (requirements demand secondary servers for (дополнительные серверы необходимы для возможности резервного переключения). Если вам нужен
fallback capability). If you only need or want one DNS server, remove the только один DNS-сервер, удалите вторую строку <emphasis>nameserver</emphasis> из файла. DNS-сервер
second <emphasis>nameserver</emphasis> line from the file. The IP address также может быть выступать шлюзом в локальной сети.</para>
may also be a router on the local network.</para>
<note> <note>
<para>The Google Public IPv4 DNS addresses are 8.8.8.8 and 8.8.4.4.</para> <para>Адреса общедоступных DNS серверов Google - 8.8.8.8 и 8.8.4.4.</para>
</note> </note>
</sect2> </sect2>
<sect2 id="ch-config-hostname"> <sect2 id="ch-config-hostname">
<title>Configuring the system hostname</title> <title>Настройка имени хоста</title>
<indexterm zone="ch-config-hostname"> <indexterm zone="ch-config-hostname">
<primary sortas="d-hostname">hostname</primary> <primary sortas="d-hostname">hostname</primary>
<secondary>configuring</secondary> <secondary>configuring</secondary>
</indexterm> </indexterm>
<para>During the boot process, the file <filename>/etc/hostname</filename> <para>В процессе загрузки файл <filename>/etc/hostname</filename> используется для
is used for establishing the system's hostname.</para> настройки имени хоста системы.</para>
<para>Create the <filename>/etc/hostname</filename> file and enter a <para>Создайте файл <filename>/etc/hostname</filename> и внесите имя хоста, выполнив команду:</para>
hostname by running:</para>
<screen><userinput>echo "<replaceable>&lt;lfs&gt;</replaceable>" &gt; /etc/hostname</userinput></screen> <screen><userinput>echo "<replaceable>&lt;lfs&gt;</replaceable>" &gt; /etc/hostname</userinput></screen>
<para><replaceable>&lt;lfs&gt;</replaceable> needs to be replaced with the <para><replaceable>&lt;lfs&gt;</replaceable> замените на имя вашего компьютера. Не вносите сюда
name given to the computer. Do not enter the Fully Qualified Domain Name полное доменное имя(FQDN). Эта информация помещается в файл <filename>/etc/hosts</filename>.</para>
(FQDN) here. That information is put in the
<filename>/etc/hosts</filename> file.</para>
</sect2> </sect2>
<sect2 id="ch-config-hosts"> <sect2 id="ch-config-hosts">
<title>Customizing the /etc/hosts File</title> <title>Настройка файла /etc/hosts</title>
<indexterm zone="ch-config-hosts"> <indexterm zone="ch-config-hosts">
<primary sortas="e-/etc/hosts">/etc/hosts</primary> <primary sortas="e-/etc/hosts">/etc/hosts</primary>
@ -178,32 +161,29 @@ EOF</userinput></screen>
<secondary>/etc/hosts</secondary> <secondary>/etc/hosts</secondary>
</indexterm> </indexterm>
<para>Decide on the IP address, fully-qualified domain name (FQDN), and <para>Укажите IP-адрес, полное доменное имя (FQDN) и возможные псевдонимы для использования в
possible aliases for use in the <filename>/etc/hosts</filename> file. The файле <filename>/etc/hosts</filename>. Синтаксис строки:</para>
syntax is:</para>
<screen><literal>IP_address myhost.example.org aliases</literal></screen> <screen><literal>IP_address myhost.example.org aliases</literal></screen>
<para>Unless the computer is to be visible to the Internet (i.e., there is <para>Если компьютер не должен быть виден в Интернете (т. е. нет зарегистрированного домена
a registered domain and a valid block of assigned IP addresses&mdash;most и действительного блока назначенных IP-адресов&mdash;у большинства пользователей этого нет),
users do not have this), make sure that the IP address is in the private убедитесь, что IP-адрес находится в диапазоне внутренних сетевых IP-адресов. Допустимые диапазоны:</para>
network IP address range. Valid ranges are:</para>
<screen><literal>Private Network Address Range Normal Prefix <screen><literal>Private Network Address Range Normal Prefix
10.0.0.1 - 10.255.255.254 8 10.0.0.1 - 10.255.255.254 8
172.x.0.1 - 172.x.255.254 16 172.x.0.1 - 172.x.255.254 12
192.168.y.1 - 192.168.y.254 24</literal></screen> 192.168.y.1 - 192.168.y.254 16</literal></screen>
<para>x can be any number in the range 16-31. y can be any number in the <para>x может быть любым числом в диапазоне 16-31. y может быть любым числом в диапазоне 0-255.</para>
range 0-255.</para>
<para>A valid private IP address could be 192.168.1.1. A valid FQDN for <para>Правильный IP адрес может быть 192.168.1.1. Правильный FQDN для этого IP
this IP could be lfs.example.org.</para> адреса может быть lfs.example.org.</para>
<para>Even if not using a network card, a valid FQDN is still required. <para>Даже если сетевая карта не используется, всё равно требуется указание полного доменного
This is necessary for certain programs to operate correctly.</para> имени. Это необходимо для правильной работы некоторых программ.</para>
<para>Create the <filename>/etc/hosts</filename> file by running:</para> <para>Создайте файл <filename>/etc/hosts</filename>, выполнив команду:</para>
<screen><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF" <screen><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
<literal># Begin /etc/hosts <literal># Begin /etc/hosts
@ -218,12 +198,12 @@ ff02::2 ip6-allrouters
# End /etc/hosts</literal> # End /etc/hosts</literal>
EOF</userinput></screen> EOF</userinput></screen>
<para>The <replaceable>&lt;192.168.1.1&gt;</replaceable>, <para>Значения <replaceable>&lt;192.168.1.1&gt;</replaceable>,
<replaceable>&lt;FQDN&gt;</replaceable>, and <replaceable>&lt;FQDN&gt;</replaceable>, и
<replaceable>&lt;HOSTNAME&gt;</replaceable> values need to be <replaceable>&lt;HOSTNAME&gt;</replaceable> должны быть изменены в соответствии
changed for specific uses or requirements (if assigned an IP address by a с предпочтениями пользователя или требованиями сети (если имеется IP-адрес выданный
network/system administrator and the machine will be connected to an сетевым/системным администратором и машина подключена к существующей сети). Необязательные
existing network). The optional alias name(s) can be omitted.</para> параметры могут быть опущены.</para>
<!-- This is not very useful <!-- This is not very useful