게이트웨이 서버의 Ubuntu 18.04에서 isc-dhcp-server를 설치하고 구성했지만 재부팅 후 enp2s0에 연결된 것이 없으면 시작되지 않습니다(즉, 시작에 실패합니다).
참고로 "어떤 인터페이스에서도 수신하도록 구성되지 않았습니다!"
$ service isc-dhcp-server status
● isc-dhcp-server.service - ISC DHCP IPv4 server
Loaded: loaded (/lib/systemd/system/isc-dhcp-server.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2020-01-18 19:05:34 GMT; 1s ago
Docs: man:dhcpd(8)
Process: 3475 ExecStart=/bin/sh -ec CONFIG_FILE=/etc/dhcp/dhcpd.conf; if [ -f /etc/ltsp/dhcpd.conf ]; then CONFIG_FILE=/etc/ltsp/dhcpd.conf; fi; [ -e /var/lib/dhcp/dhcpd.leases ] || touch /v
Main PID: 3475 (code=exited, status=1/FAILURE)
Jan 18 19:05:34 user-Default-string dhcpd[3475]:
Jan 18 19:05:34 user-Default-string dhcpd[3475]: Not configured to listen on any interfaces!
Jan 18 19:05:34 user-Default-string dhcpd[3475]:
Jan 18 19:05:34 user-Default-string dhcpd[3475]: If you think you have received this message due to a bug rather
Jan 18 19:05:34 user-Default-string dhcpd[3475]: than a configuration issue please read the section on submitting
Jan 18 19:05:34 user-Default-string dhcpd[3475]: bugs on either our web page at www.isc.org or in the README file
Jan 18 19:05:34 user-Default-string dhcpd[3475]: before submitting a bug. These pages explain the proper
Jan 18 19:05:34 user-Default-string dhcpd[3475]: process and the information we find helpful for debugging..
Jan 18 19:05:34 user-Default-string dhcpd[3475]:
Jan 18 19:05:34 user-Default-string dhcpd[3475]: exiting.
내 게이트웨이 서버에는 enp1s0 및 enp2s0이라는 두 개의 이더넷 포트가 있습니다. 나는 라우터를 통한 인터넷 액세스를 위해 enp1s0을 사용하고, 이더넷에 연결된 노트북에 웹 앱을 제공하기 위해 enp2s0을 사용합니다. enp2s0은 DHCP 서버가 IP 주소를 할당하는 것입니다(웹 앱이 필요한 노트북의 경우). 나원하다enp1s0은 192.168.1.0 서브넷의 인터넷 연결 라우터에서 임의의 IP 주소를 가져오므로 해당 인터페이스는 isc-dhcp-server에 의해 관리되지 않고 enp2s0에서만 관리됩니다.
enp2s0에 아무것도 연결되지 않은 "ip 경로"가 도움이 된다면...
$ ip route
default via 192.168.1.254 dev enp1s0 proto dhcp metric 100
169.254.0.0/16 dev enp1s0 scope link metric 1000
192.168.1.0/24 dev enp1s0 proto kernel scope link src 192.168.1.76 metric 100
내 dhcpd.conf 설정은 다음과 같습니다.
default-lease-time 600;
max-lease-time 7200;
# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-update-style none;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# This is a very basic subnet declaration.
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.200 192.168.2.250;
# option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
option broadcast-address 192.168.2.255;
}
내 isc-dhcp-server 설정은 다음과 같습니다.
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACESv4="enp2s0"
INTERFACESv6=""
한 가지 해결책은 노트북을 enp2s0에 연결한 후 isc-dhcp-server를 다시 시작하는 것입니다. 하지만 재부팅할 때마다 또는 누군가 노트북을 enp2s0에 연결할 때마다 그렇게 하고 싶지는 않습니다. 서비스를 다시 시작한 후 DHCP 서버가 작동합니다.
$ sudo service isc-dhcp-server restart
$ service isc-dhcp-server status
● isc-dhcp-server.service - ISC DHCP IPv4 server
Loaded: loaded (/lib/systemd/system/isc-dhcp-server.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2020-01-18 18:22:01 GMT; 14min ago
Docs: man:dhcpd(8)
Main PID: 2437 (dhcpd)
Tasks: 1 (limit: 2016)
CGroup: /system.slice/isc-dhcp-server.service
└─2437 dhcpd -user dhcpd -group dhcpd -f -4 -pf /run/dhcp-server/dhcpd.pid -cf /etc/dhcp/dhcpd.conf enp2s0
어떤 아이디어가 있나요? 제가 놓친 구성이 있을 거라고 확신합니다. 그러면 이 문제가 해결될 것입니다...
편집하다: "nmcli Connection show lan"(일명: nmcli cs lan) 명령의 출력
$ nmcli connection show lan
connection.id: lan
connection.uuid: 96fbb458-1178-4af2-a1b7-ccce301176e0
connection.stable-id: --
connection.type: 802-3-ethernet
connection.interface-name: enp2s0
connection.autoconnect: yes
connection.autoconnect-priority: 0
connection.autoconnect-retries: -1 (default)
connection.auth-retries: -1
connection.timestamp: 1579379514
connection.read-only: no
connection.permissions: --
connection.zone: --
connection.master: --
connection.slave-type: --
connection.autoconnect-slaves: -1 (default)
connection.secondaries: --
connection.gateway-ping-timeout: 0
connection.metered: unknown
connection.lldp: default
connection.mdns: -1 (default)
802-3-ethernet.port: --
802-3-ethernet.speed: 0
802-3-ethernet.duplex: --
802-3-ethernet.auto-negotiate: no
802-3-ethernet.mac-address: --
802-3-ethernet.cloned-mac-address: --
802-3-ethernet.generate-mac-address-mask:--
802-3-ethernet.mac-address-blacklist: --
802-3-ethernet.mtu: auto
802-3-ethernet.s390-subchannels: --
802-3-ethernet.s390-nettype: --
802-3-ethernet.s390-options: --
802-3-ethernet.wake-on-lan: default
802-3-ethernet.wake-on-lan-password: --
ipv4.method: manual
ipv4.dns: --
ipv4.dns-search: --
ipv4.dns-options: ""
ipv4.dns-priority: 0
ipv4.addresses: 192.168.2.2/24
ipv4.gateway: --
ipv4.routes: --
ipv4.route-metric: -1
ipv4.route-table: 0 (unspec)
ipv4.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-timeout: 0 (default)
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.dhcp-fqdn: --
ipv4.never-default: no
ipv4.may-fail: yes
ipv4.dad-timeout: -1 (default)
ipv6.method: auto
ipv6.dns: --
ipv6.dns-search: --
ipv6.dns-options: ""
ipv6.dns-priority: 0
ipv6.addresses: --
ipv6.gateway: --
ipv6.routes: --
ipv6.route-metric: -1
ipv6.route-table: 0 (unspec)
ipv6.ignore-auto-routes: no
ipv6.ignore-auto-dns: no
ipv6.never-default: no
ipv6.may-fail: yes
ipv6.ip6-privacy: -1 (unknown)
ipv6.addr-gen-mode: stable-privacy
ipv6.dhcp-send-hostname: yes
ipv6.dhcp-hostname: --
ipv6.token: --
proxy.method: none
proxy.browser-only: no
proxy.pac-url: --
proxy.pac-script: --
EDIT2: "nmcli -f name,autoconnect 연결 표시"의 출력이 추가되었습니다.
$ nmcli -f name,autoconnect connection show
NAME AUTOCONNECT
Wired connection 1 yes
lan yes
EDIT3: "cat /etc/NetworkManager/system-connections/lan"의 출력이 추가되었습니다.
[connection]
id=lan
uuid=96fbb458-1178-4af2-a1b7-ccce301176e0
type=ethernet
interface-name=enp2s0
permissions=
timestamp=1579379263
[ethernet]
mac-address-blacklist=
[ipv4]
address1=192.168.2.2/24
dns-search=
method=manual
[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto
답변1
인터페이스(enp2s0)가 작동합니까? IPv4 주소를 추가한 다음 시작해야 합니다.
클라이언트가 허브/스위치에 연결되어 있는지 여부는 중요하지 않습니다.
편집: 네트워크 관리자 ?
나는 그것을 열정적으로 싫어하지만 어느 쪽이든: iface가 올바른 주소로 설정되어 있지 않으면 dhcpd가 시작되지 않으므로 nmcli를 사용하여 항상 작동되는 정적 구성을 생성하는 방법을 알아내야 합니다.
편집: 이것이 무엇을 보여줍니까?
nmcli connection show lan
Connection.autoconnection 속성이 흥미롭습니다.
편집: 이것을 보여주는 내용은 다음과 같습니다.
nmcli -f name,autoconnect connection show
응, 상태는 어때?
nmcli -f name,autoconnect connection show
해킹 없이 재부팅한 후? 자동 연결 속성은 인터페이스를 불러오기에 충분해야 합니다... 기본적으로 매우 간단한 일에서 왜 실패하는지 알지 못하는 것은 NetworkManager에 대한 제가 싫어하는 것 중 하나입니다(알 수 없는 이점 때문에 복잡성이 너무 높기 때문에 클라이언트가 지속적으로 이동 중이지만 단순히 작동해야 하는 서버??)
편집: etc/NetworkManger/system-connections에 파일이 있습니까? 이것이 적어도 내 시스템에서 장치를 구성한 방법(브리지 구성)이므로 NetworkManager를 사용하여 시스템을 불러옵니다. 머신은 세 명의 게스트를 위한 호스트이므로 enp1s0 장치는 슬레이브입니다.
편집: LAN 장치를 정의하면(먼저 완전히 제거) 다음과 같이 됩니다.
nmcli connection down lan
nmcli connection delete lan
nmcli connection add type ethernet ifname enp2s0 con-name lan autoconnect on
nmcli connection modify lan ipv4.method manual ipv4.addresses 192.168.2.2/24
nmcli connection lan up
답변2
더 나은 솔루션이 없다면 현재로서는 이 방법이 적합합니다. 웹 앱이 시작되면 웹 앱이 수행하는 처음 두 가지 작업은 다음과 같습니다.
- sudo nmcli conn위로lan('lan'은 enp2s0에 할당된 NetworkManager 연결 이름입니다)
- sudo 서비스 isc-dhcp-서버재시작
웹 앱은 @reboot를 시작하도록 cron으로 예약되어 있으므로 해당 시점에 NetworkManager가 시작되었습니다.
enp2s0이 아직 "작동"되지 않은 경우 isc-dhcp-server는 항상 실패하므로 "작동"으로 설정한 다음 isc-dhcp-server 서비스를 다시 시작해야 합니다. 그다지 우아하지는 않지만 지금은 그 역할을 합니다.
답변3
누구에게나 도움이 될 경우 저는 Pi Zero W의 DietPi(Debian Buster)에서 이 짜증나는 문제를 해결했고 문제를 해결했습니다.
isc-dhcp-server는 훌륭하지만 위의 원래 문의자가 언급한 것처럼 이러한 문제가 있습니다. 문제를 해결했습니다. 이는 버그가 아닙니다. 자세한 이유는 다음과 같습니다.
isc-dhcp-server는 시작 시 UP 이더넷 네트워크 서브넷을 볼 수 없으면 거부합니다(오류 발생). (일부 해설자와는 달리) 연결된 이더넷 포트에 대한 실제 연결이 필요하지 않습니다.
WiFi 핫스팟 장치를 개발할 때 일반적으로 Hostapd를 AP 서버 기능(AP 모드로 전환하도록 WiFi 하드웨어를 재구성)으로 사용하고, Hostapd와 함께 제공하려면 isc-dhcp-server와 같은 DHCP 서버가 필요합니다. IP 주소 임대 서비스입니다.
SO: 일반적으로 시작점은 부팅 시 CLIENT 장치로 구성되었지만 핫스팟으로 작동하려면 HOST 모드로 전환해야 하는 WiFi 장치입니다. 따라서 초기 단계는 Hostapd를 시작하기 전에 wlan0(또는 무엇이든)을 DOWN으로 설정하는 것입니다.
그러나 그 상황은 isc-dhcp-server가 좋아하지 않는 상황 중 하나입니다. Hostapd보다 먼저 시작하려고 하면 실패하고 수신 대기할 서브넷이 없다고 불평합니다.
따라서 wlan0(또는 동등)에 새 IP 주소(호스트용)를 추가하고 다시 시도하여 순진하게 시도해 볼 수 있습니다. 이제 이더넷 포트에 새 IP가 연결되어 있더라도 작동하지 않습니다. 또한 'UP'으로 설정할 수 없다는 것을 알게 될 것입니다(ip 링크 설정 wlan0은 실패할 것입니다). 이는 포트가 여전히 활성 상태인 오래된 주소와 이를 사용하고 있던 wpa-supplicant 프로세스에 의해 '오염'되었기 때문입니다.
간단한 이야기: 이전 주소를 "해제"하려면 wpa-supplicant를 종료해야 합니다. / 포트의 IP 설정을 플러시하고 / 그런 다음 호스트의 새 IP 주소를 추가해야 합니다. 그럼에도 불구하고 아직 인터페이스를 설정할 수 없기 때문에 isc-dhcp-server가 여전히 시작되지 않는다는 것을 알게 될 것입니다. 마지막으로 isc 이전에 지금 hostapd를 실행하면 IT가 (칩셋 재구성 시) wlan0 인터페이스도 UP으로 설정합니다. 이제 마지막으로 isc-dhcp-server를 실행할 수 있으며, 깔끔하게 시작되고 핫스팟이 작동됩니다.
약 5시간 정도 걸렸습니다. 누군가의 시간을 절약할 수 있기를 바랍니다. 내 증류된 메모:
HOSTAPD와 함께 ISC-DHCP-SERVER 정렬: 솔루션
다음 순서를 따라야 합니다.
다음과 같이 wpa-supplicant 프로세스(클라이언트 연결을 유지함)를 종료합니다.
kill -2 $( cat /run/wpa_supplicant.wlan0.pid ) sleep 1 kill -9 $( cat /run/wpa_supplicant.wlan0.pid )
다음을 사용하여 WLAN IP 설정을 플러시합니다.
ip addr flush dev wlan0
다음을 사용하여 새 호스트 IP 주소를 추가합니다.
ip addr add 10.1.1.1/24 dev wlan0
wlan0도 UP으로 설정하는 호스트apd를 시작하세요.
/usr/sbin/hostapd /etc/hostapd/hostapd.conf &
START isc-dhcp-server (WLAN이 현재 호스트로 작동 중입니다):
sudo service isc-dhcp-server restart
그러면 액세스 포인트가 작동되어 클라이언트를 받아들일 준비가 되어 있어야 합니다.
물론 그것은 내 주소입니다/귀하의 필요에 맞게 편집하세요.
두 가지 추가 팁: 구성 파일인 hostapd.conf 및 dhcp.conf도 사용자를 화나게 만들 수 있습니다. -여기에 작업 샘플이 있습니다. 중요: Hostapd.conf에서 'drivername'을 애쓰지 마십시오. 필요하지 않습니다. '주석 처리'는 괜찮습니다.
Hostapd.conf
interface=wlan0
#driver=brcmfmac
ssid=THIS-IS-MY-AP
country_code=US
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
wpa_group_rekey=86400
ieee80211n=1
wme_enabled=1
dhcpd.conf
# COMMENT OUT BOTH OF THE TEMPLATES' 'option domain..' lines..
# then ADD THIS AT BOTTOM
#
#
subnet 10.1.1.0 netmask 255.255.255.0 {
range 10.1.1.100 10.1.1.109;
option broadcast-address 10.1.1.255;
option routers 10.1.1.1;
default-lease-time 600;
max-lease-time 7200;
option domain-name "mynetwork.org";
option domain-name-servers 8.8.8.8, 8.8.4.4;
}
#
#
Pi에 대한 이 작업은 데비안인 DietPi에 관한 것이므로 이 동일한 조언은 다양한 종류의 Ububtus를 포함하여 많은 Linux에 적합해야 합니다.
모두 행운을 빌어요