запускать dhcpcd только на определенных интерфейсах явно

На моей машине есть несколько интерфейсов, на которых часто работает DHCP-сервер. Теперь я хочу по-разному реагировать на различные «настройки»:

  • когда есть Wi-Fi, используйте Wi-Fi
  • , когда есть Ethernet, используйте Ethernet (у меня там тоже есть дополнительный профиль)
  • , когда есть оба, используйте один из них (или оба, или что-то еще ..просто работайте)
  • при появлении интерфейса usb0 или usb1 включайте dhcp на них только тогда, когда кто-то выдает dhcpcd

My current dhcpcd. conf выглядит как

# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
#clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private


interface eth0
arping 192.168.1.77

profile 192.168.1.77
static ip_address=192.168.1.65
static routers=192.168.1.77
static domain_name_servers=192.168.1.77


interface usb0
nogateway

interface usb1
nogateway

Часть Wi-Fi / Ethernet, похоже, работает, хотя я не тестировал ее полностью. Но я не знаю, как настроить мои USB-интерфейсы, чтобы они отвечали только на DHCP по команде. nogateway предназначен только для того, чтобы USB-интерфейсы не испортили мои маршруты по умолчанию для ATM.

Как мне настроить dhcpcd ?

Редактировать 1: Я использую систему Gentoo, и у меня нет конфигурации сети, кроме моего wpa_supplicant.conf

0
12.12.2016, 16:02
2 ответа

Если вы используете дистрибутив на основе Debian , просто посмотрите последние строки / etc / default / isc-dhcp-server :

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#       Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth1"
0
28.01.2020, 04:49

Рассмотрите возможность использования настройки allowinterfacesи/или denyinterfacesв /etc/dhcpcd.conf. Изman dhcpcd.conf

 allowinterfaces pattern
         When discovering interfaces, the interface name must match
         pattern which is a space or comma separated list of patterns
         passed to fnmatch(3).  If the same interface is matched in
         denyinterfaces then it is still denied.

 denyinterfaces pattern
         When discovering interfaces, the interface name must not match
         pattern which is a space or comma separated list of patterns
         passed to fnmatch(3).

Также возможно, хотя IMO менее желательно в производстве, с args для dhcpcd, [-Z, --denyinterfaces pattern], [-z, --allowinterfaces pattern].

3
20.04.2020, 16:39

Теги

Похожие вопросы