No subnet declaration; Can't open /var/lib/dhcp/dhcpd.leases for append

A publicface at bak.rr.com
Sat Jan 27 19:06:14 UTC 2018



On 01/27/2018 05:43 AM, Bill Shirley wrote:
> This is all kinds of confusing.  You're configuring DHCP on a machine
> named 'yellow' who's address is 10.1.1.2 and has a gateway of 10.1.1.1.
> Yet 'yellow' has a WAN connection?

yellow is at 10.1.1.1.  The .2 was a typo.

>
> You've configured DHCP for subnet 10.1.1.0/24 which is on interface
> 'enp4s5' which IS NOT UP.  Can you ping anything on the LAN?
>
> Is 'yellow' the internet gateway?
>
> Also your DHCP configuration:
>        host yellow {
>             hardware ethernet f0:7d:24:c2:c4:13;
>             fixed-address 10.1.1.1;
>         }
> ^^You're defining 'yellow' (which is the DHCP server!!) and it has a
> different address that the one you defined in /etc/network/interfaces!!
> iface enp4s5 inet static
>     address 10.1.1.2/24

Nice catch!

>
> Don't define host 'yellow' in the DHCP configuration.  Add a comment if
> you like.

OK.  I also removed blue.  However I did entered them so that yellow & 
blue would each always get the same IP.  dhcp is primarily for wireless 
devices at the moment.  But, I do expect more wired devices that will 
need dhcp at some point.

>
> You need to figure out which 10.1.1.0/24 address 'yellow' is supposed to
> have and bring up interface 'enp4s5'.
>
> Is 'yellow' the gateway for 10.1.1.0/24?  Your 'option routers 10.1.1.1'
> says it's not.

Yes.  yellow is at 10.1.1.1, it is the gateway.

My updated dhcpd.conf:

ddns-update-style none;
option domain-name "myFQDN";
option domain-name-servers 10.1.1.1, 8.8.4.4, 50.23.197.95;

default-lease-time 86400;
max-lease-time 604800;

authoritative;

log-facility local7;

subnet 10.1.1.0 netmask 255.255.255.0 {
         option domain-name-servers 10.1.1.1;
         max-lease-time 7200;
         default-lease-time 600;
         range 10.1.1.10 10.1.1.250;
         option subnet-mask 255.255.255.0;
         option broadcast-address 10.1.1.255;
         option routers 10.1.1.1;
}

# ip -4 -o addr
1: lo    inet 127.0.0.1/8 scope host lo\       valid_lft forever 
preferred_lft forever
2: enp4s5    inet 10.1.1.1/24 brd 10.1.1.255 scope global enp4s5\       
valid_lft forever preferred_lft forever
3: enp6s0    inet [xx.xx.xx.xx/20 brd 255.255.255.255 scope global 
enp6s0\       valid_lft forever preferred_lft forever
4: wlp2s0    inet 10.1.1.10/24 brd 10.1.1.255 scope global wlp2s0\       
valid_lft forever preferred_lft forever


systemctl status isc-dhcp-server
root at yellow:/usr/local/src/myscripts# systemctl status isc-dhcp-server
● 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 2018-01-27 10:37:48 PST; 10min ago
      Docs: man:dhcpd(8)
  Main PID: 5804 (dhcpd)
    CGroup: /system.slice/isc-dhcp-server.service
            └─5804 dhcpd -user dhcpd -group dhcpd -f -4 -pf 
/run/dhcp-server/dhcpd.pid -cf /etc/dhcp/

Jan 27 10:37:48 yellow dhcpd[5804]: *in your dhcpd.conf file for the 
network segment*
Jan 27 10:37:48 yellow dhcpd[5804]: *to which interface enp4s5 is 
attached*. **
Jan 27 10:37:48 yellow dhcpd[5804]:
Jan 27 10:37:48 yellow dhcpd[5804]: Listening on 
LPF/wlp2s0/f0:7d:68:c1:b4:13/10.1.1.0/24
Jan 27 10:37:48 yellow dhcpd[5804]: Sending on 
LPF/wlp2s0/f0:7d:68:c1:b4:13/10.1.1.0/24
Jan 27 10:37:48 yellow sh[5804]: Listening on 
LPF/wlp2s0/f0:7d:68:c1:b4:13/10.1.1.0/24
Jan 27 10:37:48 yellow sh[5804]: Sending on 
LPF/wlp2s0/f0:7d:68:c1:b4:13/10.1.1.0/24
Jan 27 10:37:48 yellow sh[5804]: Sending on Socket/fallback/fallback-net
Jan 27 10:37:48 yellow dhcpd[5804]: Sending on Socket/fallback/fallback-net
Jan 27 10:37:48 yellow dhcpd[5804]: Server starting service.


syslog:

Jan 27 10:37:48 yellow systemd[1]: Started ISC DHCP IPv4 server.
Jan 27 10:37:48 yellow dhcpd[5804]: Internet Systems Consortium DHCP 
Server 4.3.3
Jan 27 10:37:48 yellow sh[5804]: Internet Systems Consortium DHCP Server 
4.3.3
Jan 27 10:37:48 yellow sh[5804]: Copyright 2004-2015 Internet Systems 
Consortium.
Jan 27 10:37:48 yellow sh[5804]: All rights reserved.
Jan 27 10:37:48 yellow sh[5804]: For info, please visit 
https://www.isc.org/software/dhcp/
Jan 27 10:37:48 yellow dhcpd[5804]: Copyright 2004-2015 Internet Systems 
Consortium.
Jan 27 10:37:48 yellow dhcpd[5804]: All rights reserved.
Jan 27 10:37:48 yellow dhcpd[5804]: For info, please visit 
https://www.isc.org/software/dhcp/
Jan 27 10:37:48 yellow dhcpd[5804]: Config file: /etc/dhcp/dhcpd.conf
Jan 27 10:37:48 yellow sh[5804]: Config file: /etc/dhcp/dhcpd.conf
Jan 27 10:37:48 yellow sh[5804]: Database file: /var/lib/dhcp/dhcpd.leases
Jan 27 10:37:48 yellow sh[5804]: PID file: /run/dhcp-server/dhcpd.pid
Jan 27 10:37:48 yellow dhcpd[5804]: Database file: 
/var/lib/dhcp/dhcpd.leases
Jan 27 10:37:48 yellow sh[5804]: Wrote 4 leases to leases file.
Jan 27 10:37:48 yellow dhcpd[5804]: PID file: /run/dhcp-server/dhcpd.pid
Jan 27 10:37:48 yellow dhcpd[5804]: Internet Systems Consortium DHCP 
Server 4.3.3
Jan 27 10:37:48 yellow dhcpd[5804]: Copyright 2004-2015 Internet Systems 
Consortium.
Jan 27 10:37:48 yellow dhcpd[5804]: All rights reserved.
Jan 27 10:37:48 yellow dhcpd[5804]: For info, please visit 
https://www.isc.org/software/dhcp/
Jan 27 10:37:48 yellow dhcpd[5804]: Wrote 4 leases to leases file.
Jan 27 10:37:48 yellow dhcpd[5804]:
Jan 27 10:37:48 yellow sh[5804]: No subnet declaration for enp4s5 (no 
IPv4 addresses).
Jan 27 10:37:48 yellow sh[5804]: ** Ignoring requests on enp4s5.  If 
this is not what
Jan 27 10:37:48 yellow sh[5804]:    you want, please write a subnet 
declaration
Jan 27 10:37:48 yellow sh[5804]:    in your dhcpd.conf file for the 
network segment
Jan 27 10:37:48 yellow sh[5804]:    to which interface enp4s5 is 
attached. **
Jan 27 10:37:48 yellow dhcpd[5804]: No subnet declaration for enp4s5 (no 
IPv4 addresses).
Jan 27 10:37:48 yellow dhcpd[5804]: ** Ignoring requests on enp4s5. If 
this is not what
Jan 27 10:37:48 yellow dhcpd[5804]:    you want, please write a subnet 
declaration
Jan 27 10:37:48 yellow dhcpd[5804]:    in your dhcpd.conf file for the 
network segment
Jan 27 10:37:48 yellow dhcpd[5804]:    to which interface enp4s5 is 
attached. **
Jan 27 10:37:48 yellow dhcpd[5804]:
Jan 27 10:37:48 yellow dhcpd[5804]: Listening on 
LPF/wlp2s0/f0:7d:68:c1:b4:13/10.1.1.0/24
Jan 27 10:37:48 yellow dhcpd[5804]: Sending on 
LPF/wlp2s0/f0:7d:68:c1:b4:13/10.1.1.0/24
Jan 27 10:37:48 yellow sh[5804]: Listening on 
LPF/wlp2s0/f0:7d:68:c1:b4:13/10.1.1.0/24
Jan 27 10:37:48 yellow sh[5804]: Sending on 
LPF/wlp2s0/f0:7d:68:c1:b4:13/10.1.1.0/24
Jan 27 10:37:48 yellow sh[5804]: Sending on Socket/fallback/fallback-net
Jan 27 10:37:48 yellow dhcpd[5804]: Sending on Socket/fallback/fallback-net
Jan 27 10:37:48 yellow dhcpd[5804]: Server starting service.

# cat /etc/network/interfaces

auto lo
iface lo inet loopback
     dns-nameservers 10.1.1.1 8.8.8.8 8.8.4.4 50.23.197.95
     dns-search myFQDN

auto enp6s0

iface enp6s0 inet dhcp
     dns-nameservers 10.1.1.1 8.8.8.8 8.8.4.4 50.23.197.95
     dns-search myFQDN


auto enp4s5
allow-hotplug enp4s5
iface enp4s5 inet static
     address 10.1.1.1/24
     gateway 10.1.1.1
     network 10.1.1.0
     netmask 255.255.255.0
     broadcast 10.1.1.255

     pre-up ip link set enp4s5 down
     up ip link set enp4s5 up

     #down ip link set enp4s5 down
     # post-down <insert command here>


allow-hotplug wlp2s0

iface wlp2s0 inet static
     address 10.1.1.3/24
     gateway 10.1.1.1
     network 10.1.1.0
     netmask 255.255.255.0
     broadcast 10.1.1.255

     pre-up ip link set wlp2s0 down
     up ip link set wlp2s0 up
     down ip link set wlp2s0 down

     wireless-mode master
     wireless-essid BHNDK16A0C1Z12
     wireless-channel 1
     wpa-ssid BHNDK16A0C1Z12

     # encrypted passwd
     wpa-psk [redacted]
     gateway 10.1.1.1



>
> Bill
>
> On 1/27/2018 5:57 AM, Simon Hobson wrote:
>> A<publicface at bak.rr.com>  wrote:
>>
>>>> Also in your first post:
>>>> subnet 10.1.1.0 netmask 255.255.255.0 {
>>>>          interface wlp2s0;
>>>>          option domain-name-servers 10.1.1.1;
>>>>          max-lease-time 7200;
>>>>          default-lease-time 600;
>>>>          range 10.1.1.10 10.1.1.250;
>>>>          option subnet-mask 255.255.255.0;
>>>>          option broadcast-address 10.1.1.255;
>>>>          option routers 10.1.1.1;
>>>>
>>>> As far as I know there is no interface directive.  Plus wlp2s0 is the wrong
>>>> interface.  You should remove that line.
>>>   Wrong name for the device?  Or just shouldn't be the wireless interface?  Why is it wrong?
>> There is no instruction in dhcpd.conf called "interface". The example you found probably had it as a comment to help the person keep track of what is where.
>>
>>> If that's not how to specify the interface for that subnet, then what is the proper way please?
>> You don't ! It happens automagically, and bear in mind that a subnet served by a DHCP server does NOT have to be directly connected - it can come via a relay agent.
>> The server uses the IP address(es) of the interface for directly connected clients, or the Gateway Interface Address (GIAddr) field inserted by a relay agent if the client is remote (the other side of a router). That address is used to determine which subnet a client is connected to.
>>
>>
>>>> What does 'ip -4 -o addr' show?
>>>>
>>> # ip -4 -o addr
>>> 1: lo    inet 127.0.0.1/8 scope host lo\       valid_lft forever preferred_lft forever
>>> 3: enp6s0    inet xx.xx.xx.xx/20 brd 255.255.255.255 scope global enp6s0\       valid_lft forever preferred_lft forever
>> OK, you do not have IPv4 addresses on any internal interface ! it isn't going to work like that. Or have you deleted lines from that output thinking they aren't relevant ?
>>
>> _______________________________________________
>> dhcp-users mailing list
>> dhcp-users at lists.isc.org
>> https://lists.isc.org/mailman/listinfo/dhcp-users
>
>
>
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20180127/26e41362/attachment-0001.html>


More information about the dhcp-users mailing list