특정 인터페이스에서만 dhcpcd를 명시적으로 시작합니다.

특정 인터페이스에서만 dhcpcd를 명시적으로 시작합니다.

내 컴퓨터에는 여러 인터페이스가 있고 일반적으로 DHCP 서버가 실행 중입니다. 이제 다양한 "설정"에 다르게 반응하고 싶습니다.

  • Wi-Fi가 있을 때는 Wi-Fi를 사용하세요.
  • 이더넷이 있으면 이더넷을 사용하십시오(거기에 추가 구성 파일도 있습니다).
  • 둘 다 있는 경우 둘 중 하나를 사용하십시오(또는 둘 다 또는 다른 하나... 그냥 작동합니다).
  • 인터페이스 usb0또는 문제가 발생할 때 usb1누군가가 질문을 발행하는 경우에만 dhcp를 활성화하십시오.dhcpcd <interface>

나의 현재 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/이더넷 부분은 작동하는 것 같습니다. 하지만 USB 인터페이스가 DHCP 명령에만 응답하도록 설정하는 방법을 모르겠습니다. nogatewayUSB 포트가 ATM 기본 라우팅을 망가뜨리는 것을 방지하기 위한 것입니다 .

어떻게 구성해야 합니까 dhcpcd?

편집 1: 젠투 시스템을 사용하고 있는데 내 네트워크 외에는 더 이상 네트워크 구성이 없습니다.wpa_supplicant.conf

답변1

사용 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).

[-Z, --denyinterfaces pattern]IMO가 프로덕션 환경에서는 이상적이지는 않지만 dhcpcd의 인수인 , 를 사용하는 것도 가능합니다 [-z, --allowinterfaces pattern].

관련 정보