Difference between revisions of "Networking/ru"

Updating to match new version of source page
(Created page with "Сохраните файл с таким содержимым")
(Updating to match new version of source page)
Line 39: Line 39:
==/etc/resolvconf.conf==
==/etc/resolvconf.conf==


<div lang="en" dir="ltr" class="mw-content-ltr">
The resolvconf.conf file is a shell script that is sourced by resolvconf, meaning that resolvconf.conf must contain valid shell commands. Take a look at its [https://jlk.fjfi.cvut.cz/arch/manpages/man/resolvconf.conf.5 man page] for more details and commands. The file is located at {{ic|/etc/resolvconf.conf}} and will require root privelege to edit.  For more information on how to edit a configuration file owned by root, please review [[Viewing_and_editing_configuration_files|this article]].
The resolvconf.conf file is a shell script that is sourced by resolvconf, meaning that resolvconf.conf must contain valid shell commands. Take a look at its [https://jlk.fjfi.cvut.cz/arch/manpages/man/resolvconf.conf.5 man page] for more details and commands. The file is located at {{ic|/etc/resolvconf.conf}} and will require root privelege to edit.  For more information on how to edit a configuration file owned by root, please review [[Viewing_and_editing_configuration_files|this article]].
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
As an example, we will prepend OpenDNS nameservers to the top of our resolvconf file whenever called. We can achieve this by adding the following lines to the bottom of resolvconf.conf.
As an example, we will prepend OpenDNS nameservers to the top of our resolvconf file whenever called. We can achieve this by adding the following lines to the bottom of resolvconf.conf.
  # OpenDNS servers
  # OpenDNS servers
  name_servers="208.67.222.222 208.67.220.220"
  name_servers="208.67.222.222 208.67.220.220"
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
After making any changes simply update and apply your settings with the following command
After making any changes simply update and apply your settings with the following command
sudo resolvconf -u
{{UserCmd|command=sudo resolvconf -u}}
 
</div>


==dhcpcd и resolv.conf.head/tail==
==dhcpcd и resolv.conf.head/tail==


<div lang="en" dir="ltr" class="mw-content-ltr">
{{note|Most Manjaro installs will not be using dhcpd by default}}
{{note|Most Manjaro installs will not be using dhcpd by default}}
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
An alternative solution if you are using dhcpd is to input our settings to the {{ic|/etc/resolv.conf.head}} file. If this file does not exist then create it. The contents of {{ic|/etc/resolv.conf.head}} get sent to the top of {{ic|/etc/resolv.conf}} during the boot process.
An alternative solution if you are using dhcpd is to input our settings to the {{ic|/etc/resolv.conf.head}} file. If this file does not exist then create it. The contents of {{ic|/etc/resolv.conf.head}} get sent to the top of {{ic|/etc/resolv.conf}} during the boot process.
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
Following our previous example, if we want to use the OpenDNS servers with this method, we could place the following in the file:
Following our previous example, if we want to use the OpenDNS servers with this method, we could place the following in the file:
  # OpenDNS servers
  # OpenDNS servers
  nameserver 208.67.222.222
  nameserver 208.67.222.222
  nameserver 208.67.220.220
  nameserver 208.67.220.220
</div>




Line 70: Line 81:
==Использование графической утилиты==
==Использование графической утилиты==


<div lang="en" dir="ltr" class="mw-content-ltr">
Most editions of Manjaro come with some type a GUI tool or applet to manage NetworkManager.  This is the easiest way to set a static IP.  Simply go into the tool, usually in the system tray or menu, and input the required parameters for your network.
Most editions of Manjaro come with some type a GUI tool or applet to manage NetworkManager.  This is the easiest way to set a static IP.  Simply go into the tool, usually in the system tray or menu, and input the required parameters for your network.
</div>




==Использование systemd==
==Использование systemd==


<div lang="en" dir="ltr" class="mw-content-ltr">
If you don't want to use NetworkManager the next easiest thing is to configure a static IP in systemd.
If you don't want to use NetworkManager the next easiest thing is to configure a static IP in systemd.
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
First, make sure you aren't running NetworkManager
First, make sure you aren't running NetworkManager
sudo systemctl disable --now NetworkManager.service
{{UserCmd|command=sudo systemctl disable --now NetworkManager.service}}
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
Next you will need to find the name of your network device.  To locate the name, use the command {{ic|ip a}} as seen here:
Next you will need to find the name of your network device.  To locate the name, use the command {{ic|ip a}} as seen here:
<pre>ip a
<pre>ip a
Line 97: Line 115:
       valid_lft forever preferred_lft forever
       valid_lft forever preferred_lft forever
</pre>
</pre>
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
lo is the loopback device which can be ignored for the purposes of this article.  The device we need here is identified above as {{ic|ens33}}.  We will need this name in the next step.
lo is the loopback device which can be ignored for the purposes of this article.  The device we need here is identified above as {{ic|ens33}}.  We will need this name in the next step.
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
Now create or edit a file to hold the network configuration at {{ic|/etc/systemd/network/devicename.network}}.  Using the example above, the file would be called {{ic|/etc/systemd/network/ens33.network}}.  This file will need to be created/edited as root.  For more information on how to do that please review [[Viewing_and_editing_configuration_files|this article]].  An example of the contents of the file would look like this:
Now create or edit a file to hold the network configuration at {{ic|/etc/systemd/network/devicename.network}}.  Using the example above, the file would be called {{ic|/etc/systemd/network/ens33.network}}.  This file will need to be created/edited as root.  For more information on how to do that please review [[Viewing_and_editing_configuration_files|this article]].  An example of the contents of the file would look like this:
<pre>[Match]
<pre>[Match]
Name=enp0s3
Name=enp0s3
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
[Network]
[Network]
Address=192.168.1.101/24
Address=192.168.1.101/24
Line 112: Line 136:
DNS=208.67.220.220
DNS=208.67.220.220
</pre>
</pre>
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
All that remains is to start and enable the service using:
All that remains is to start and enable the service using:
sudo systemctl enable --now systemd-networkd.service
{{UserCmd|command=sudo systemctl enable --now systemd-networkd.service}}
 
</div>


=Использование dhcpcd вместо NetworkManager=
=Использование dhcpcd вместо NetworkManager=


<div lang="en" dir="ltr" class="mw-content-ltr">
NetworkManager is the default solution for networking on most Manjaro editions.  If you would prefer to use dhcpcd, that is also supported.
NetworkManager is the default solution for networking on most Manjaro editions.  If you would prefer to use dhcpcd, that is also supported.
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
First, ensure NetworkManager is disabled and not running
First, ensure NetworkManager is disabled and not running
sudo systemctl disable --now NetworkManager.service
{{UserCmd|command=sudo systemctl disable --now NetworkManager.service}}
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
Next, start and enable the dhcpcd service
Next, start and enable the dhcpcd service
sudo systemctl start --now dhcpcd.service
{{UserCmd|command=sudo systemctl start --now dhcpcd.service}}
 
</div>


=Смотрите также=
=Смотрите также=
8,560

edits