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