Dhcpcd

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Dhcpcd and the translation is 70% complete.
Outdated translations are marked like this.

Демон клиента динамической конфигурации хоста (Dynamic Host Configuration Protocol Client Daemon) (net-misc/dhcpcd) — это популярный DHCP клиент, способный работать как с IPv4, так и с IPv6 конфигурациями.

Установка

USE-флаги

USE flags for net-misc/dhcpcd A fully featured, yet light weight RFC2131 compliant DHCP client

+embedded Embed the definitions of dhcp options in the dhcpcd executable
+udev Enable virtual/udev integration (device discovery, power and storage device support, etc)
debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
ipv6 Add support for IP version 6
privsep Enable support for privilege separation

Emerge

Используйте следующую команду для установки dhcpcd:

root #emerge --ask net-misc/dhcpcd

Конфигурация

Файлы

Всю конфигурацию dhcpcd можно выполнить в файле /etc/dhcpcd.conf, но для большинства установок dhcpcd будет работать из коробки, если предположить что большинство современных компьютеров находятся за маршрутизатором или точкой доступа с работающим DHCP сервером. Хотя, будет полезно прочитать man 5 dhcpcd.conf[1], если требуется расширенная конфигурация.

Статический IP-адрес

В случае если сетевая карта должна быть сконфигурирована статическим IP-адресом, добавьте свои данные в /etc/dhcpcd.conf.[1] Ниже приведен пример ручного добавления статического адреса, маршрута и DNS путем редактирования файла конфигурации DHCPCD с помощью любимого редактора:

ФАЙЛ /etc/dhcpcd.conf
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

IPv6 Prefix Request

ФАЙЛ /etc/dhcpcd.confRequest a prefix for eth0.lan and eth0.management to be routed publicly with eth0.wan.
# Disable router solicitations for all interfaces, enable only for selected ones
noipv6rs
 
# Interface configuration for the wan vlan on the eth0 interface
interface eth0.wan
  # Enable router solicitation for this interface
  ipv6rs
  # Request a normal address usins iaid 1 for interface eth0.wan
  ia_na 1
  # Request a prefix using iaid 2 and assign it to the eth0.lan interface using sla_id 0 and prefix size of 64
  ia_pd 2 eth0.lan/0/64
  # Request a prefix using iaid 3 and assign it to the eth0.management interface using sla_id 0 and prefix size of 64
  ia_pd 3 eth0.management/0/64

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

Введение

root #dhcpcd --help

Запуск как сервис

Смотрите статью управление сетью с помощью DHCPCD.

Одноразовый запуск DHCP

dhcpd can be manually started on a specific interface, such as enp1s0 with:

root #dhcpcd eth0

Убедитесь, что изменили eth0, в команде выше, на необходимый сетевой интерфейс.

Обновление аренды

To renew the lease on enp1s0, --rebind or -n can be used:

root #dhcpcd -k eth0
root #dhcpcd eth0

Release a lease

To release a lease on enp1s0, --release or -k can be used:

root #dhcpcd -k enp1s0

Устранение проблем

Смотрите также

Внешние ресурсы

Ссылки

  1. Jump up to: 1.0 1.1 Roy Marples. DHCPCD.CONF(5), Roy Marples's personal blog, March 9th, 2015. Retrieved on May 07th, 2015.