DHCP web interface shows wrong status

Hi!

I tried to “Add a new fixed lease” and something went wrong. DHCP crashed and nothing worked. I rebooted Ipfire, but still no go. But after some fiddeling, I have found that:

Now in dhcp.cgi when “Green Interface Enabled:” is NOT checked

  • In dhcp.cgi it shows NO info about leased IPs, the “Current dynamic leases” header is not shown.
  • services.cgi says " [DHCP Server] RUNNING"
  • DHCP works OK for all clients

If I in dhcp.cgi check “Green Interface Enabled:”

  • In dhcp.cgi it shows old info about leased IPs
  • services.cgi says " [DHCP Server] STOPPED"
  • DHCP do not work

So the “Green Interface Enabled” inverted somehow. I have tried reboots, but maybe there is a config file with wrong info somewhere?

:thinking: Have you analyzed the contents of the var/ipfire/dhcp folder and the files contained there?

Thanks for the suggestion! Maybe the error is in the settings file? This is when DHCP is working (not enabled in web GUI):

[root@ipfire ~]# cd /var/ipfire/dhcp
[root@ipfire dhcp]# ls -la
total 24
drwxr-xr-x  2 nobody nobody 4096 Sep 28 21:22 .
drwxr-xr-x 47 root   root   4096 Aug  9 12:08 ..
-rw-r--r--  1 nobody nobody    0 Jun 29  2018 advoptions
-rw-r--r--  1 nobody nobody 2381 Jun 29  2018 advoptions-list
-rw-r--r--  1 nobody nobody  106 Sep 28 21:22 dhcpd.conf
-rw-r--r--  1 nobody nobody  399 Nov 14  2018 dhcpd.conf.local
-rw-r--r--  1 nobody nobody    0 Sep 28 20:21 fixleases
-rw-r--r--  1 nobody nobody  509 Sep 28 21:22 settings



[root@ipfire dhcp]# cat settings
ENABLE_GREEN=off
DNS_UPDATE_ENABLED=off
WINS1_GREEN=
DNS_UPDATE_KEY_SECRET_GREEN=
SORT_FLEASELIST=FIPADDR
DNS_UPDATE_KEY_ALGO_GREEN=hmac-md5
DOMAIN_NAME_GREEN=localdomain
DNS_UPDATE_KEY_NAME_GREEN=
NEXT_GREEN=
NTP1_GREEN=192.168.222.254
START_ADDR_GREEN=192.168.222.51
DNS1_GREEN=192.168.222.254
END_ADDR_GREEN=192.168.222.150
WINS2_GREEN=
MAX_LEASE_TIME_GREEN=120
ENABLEBOOTP_GREEN=off
FILE_GREEN=
DENY_KNOWN_CLIENTS_GREEN=off
SORT_LEASELIST=IPADDR
DNS2_GREEN=8.8.8.8
DEFAULT_LEASE_TIME_GREEN=60
NTP2_GREEN=



[root@ipfire dhcp]# cat dhcpd.conf
deny bootp;     #default
authoritative;
ddns-update-style none;

include "/var/ipfire/dhcp/dhcpd.conf.local";



[root@ipfire dhcp]# cat dhcpd.conf.local
subnet 192.168.222.0 netmask 255.255.255.0 #GREEN
{
        range 192.168.222.50 192.168.222.150;
        option subnet-mask 255.255.255.0;
        option domain-name "localdomain";
        option routers 192.168.222.254;
        option domain-name-servers 192.168.222.254, 8.8.8.8;
        option ntp-servers 192.168.222.254;
        default-lease-time 3600;
        max-lease-time 7200;
} #GREEN



[root@ipfire dhcp]# cat advoptions-list
option all-subnets-local flag;
option arp-cache-timeout uint32;
option bootfile-name string;
option boot-size uint16;
option broadcast-address ip-address;
option cookie-servers ip-address [, ip-address... ];
option default-ip-ttl uint8;
option default-tcp-ttl uint8;
option dhcp-client-identifier data-string;
option finger-server ip-address [, ip-address... ];
option font-servers ip-address [, ip-address... ];
option host-name string;
option ieee802-3-encapsulation flag;
option ien116-name-servers ip-address [, ip-address... ];
option impress-servers ip-address [, ip-address... ];
option interface-mtu uint16;
option ip-forwarding flag;
option irc-server ip-address [, ip-address... ];
option log-servers ip-address [, ip-address... ];
option lpr-servers ip-address [, ip-address... ];
option mask-supplier flag;
option max-dgram-reassembly uint16;
option merit-dump string;
option mobile-ip-home-agent ip-address [, ip-address... ];
option netbios-dd-server ip-address [, ip-address... ];
option netbios-node-type uint8;
option netbios-scope string;
option nis-domain string;
option nisplus-domain string;
option nisplus-servers ip-address [, ip-address... ];
option nis-servers ip-address [, ip-address... ];
option nntp-server ip-address [, ip-address... ];
option non-local-source-routing flag;
option ntp-servers ip-address [, ip-address... ];
option path-mtu-aging-timeout uint32;
option path-mtu-plateau-table uint16 [, uint16... ];
option perform-mask-discovery flag;
option policy-filter ip-address ip-address [, ip-address ip-address... ];
option pop-server ip-address [, ip-address... ];
option resource-location-servers ip-address [, ip-address... ];
option root-path string;
option router-discovery flag;
option router-solicitation-address ip-address;
option smtp-server ip-address [, ip-address... ];
option static-routes ip-address ip-address [, ip-address ip-address... ];
option streettalk-directory-assistance-server ip-address [, ip-address... ];
option streettalk-server ip-address [, ip-address... ];
option swap-server ip-address;
option tcp-keepalive-garbage flag;
option tcp-keepalive-interval uint32;
option tftp-server-name string;
option time-offset int32;
option time-servers ip-address [, ip-address... ];
option trailer-encapsulation flag;
option www-server ip-address [, ip-address... ];
option x-display-manager ip-address [, ip-address... ];

What is the contents of /var/ipfire/dhcp/dhcpd.conf.local ?

The content of dhcpd.conf.local is above, is’nt it? (and content of dhcpd.conf twice :wink: removed one of them)

Red IP is not the 192, it is a real public IP

Sorry, didn’t read really thoroughly. :wink:

But remains the question, why your network definition is in dhcpd.conf.local.
It should be in dhcpcd.conf if DHCP on green is enabled.

Maybe because the Web GUI thinks it is disabled, but en reality it is running and working OK:



Maybe if I manually kill the DHCP service, and then enable it in Web GUI? (but I don’t know how to kill it the right way)
Or maybe edit the settings file so it reflects reality?

Delete the contents of dhcpd.conf.local and try again.
I’m not sure, but a first look at the WUI files and the control files shows that dhcpd is in the same running state as at boot time. The enable/disable switch does a restart of the server. Whether a interface is listened on is decided by dhcpd.conf ( and indirectly dhcpd.conf.local ).

3 Likes

You are my savior, thank you very much :smiling_face_with_three_hearts:
That solution was really easy, but I would never have thought about it.

I did this (if anyone get the same problem). First I did nothing in Web GUI, at this point DHCP worked and all was as in the pictures above. But I did this with SSH

[root@ipfire dhcp]# ls -la
total 24
drwxr-xr-x  2 nobody nobody 4096 Sep 28 21:22 .
drwxr-xr-x 47 root   root   4096 Aug  9 12:08 ..
-rw-r--r--  1 nobody nobody    0 Jun 29  2018 advoptions
-rw-r--r--  1 nobody nobody 2381 Jun 29  2018 advoptions-list
-rw-r--r--  1 nobody nobody  106 Sep 28 21:22 dhcpd.conf
-rw-r--r--  1 nobody nobody  399 Nov 14  2018 dhcpd.conf.local
-rw-r--r--  1 nobody nobody    0 Sep 28 20:21 fixleases
-rw-r--r--  1 nobody nobody  509 Sep 28 21:22 settings
[root@ipfire dhcp]# cp dhcpd.conf.local dhcpd.conf.local.old
[root@ipfire dhcp]# nano dhcpd.conf.local

In nano I deleted everything, then checked the files

[root@ipfire dhcp]# ls -la
total 24
drwxr-xr-x  2 nobody nobody 4096 Sep 29 14:26 .
drwxr-xr-x 47 root   root   4096 Aug  9 12:08 ..
-rw-r--r--  1 nobody nobody    0 Jun 29  2018 advoptions
-rw-r--r--  1 nobody nobody 2381 Jun 29  2018 advoptions-list
-rw-r--r--  1 nobody nobody  106 Sep 28 21:22 dhcpd.conf
-rw-r--r--  1 nobody nobody    0 Sep 29 14:26 dhcpd.conf.local
-rw-r--r--  1 root   root    399 Sep 29 14:26 dhcpd.conf.local.old
-rw-r--r--  1 nobody nobody    0 Sep 28 20:21 fixleases
-rw-r--r--  1 nobody nobody  509 Sep 28 21:22 settings

Then I went to dhcp.cgi, checked “Green Interface Enabled:” and clicked on the Save button. The page services.cgi still showed “[DHCP Server] RUNNING” :partying_face:
I checked the files again


[root@ipfire dhcp]# ls -la
total 24
drwxr-xr-x  2 nobody nobody 4096 Sep 29 14:27 .
drwxr-xr-x 47 root   root   4096 Aug  9 12:08 ..
-rw-r--r--  1 nobody nobody    0 Jun 29  2018 advoptions
-rw-r--r--  1 nobody nobody 2381 Jun 29  2018 advoptions-list
-rw-r--r--  1 nobody nobody  463 Sep 29 14:27 dhcpd.conf
-rw-r--r--  1 nobody nobody    0 Sep 29 14:26 dhcpd.conf.local
-rw-r--r--  1 root   root    399 Sep 29 14:26 dhcpd.conf.local.old
-rw-r--r--  1 nobody nobody    0 Sep 29 14:27 enable_green
-rw-r--r--  1 nobody nobody    0 Sep 28 20:21 fixleases
-rw-r--r--  1 nobody nobody  500 Sep 29 14:27 settings
[root@ipfire dhcp]# cat dhcpd.conf
deny bootp;     #default
authoritative;
ddns-update-style none;

subnet 192.168.222.0 netmask 255.255.255.0 #GREEN
{
pool {
        range 192.168.222.51 192.168.222.150;
     }
        option subnet-mask 255.255.255.0;
        option domain-name "localdomain";
        option routers 192.168.222.251;
        option domain-name-servers 192.168.222.251, 8.8.8.8;
        option ntp-servers 192.168.222.254;
        default-lease-time 3600;
        max-lease-time 7200;
} #GREEN

include "/var/ipfire/dhcp/dhcpd.conf.local";
[root@ipfire dhcp]# cat settings
DNS_UPDATE_ENABLED=off
ENABLE_GREEN=on
NTP2_GREEN=
DNS1_GREEN=192.168.222.251
DOMAIN_NAME_GREEN=localdomain
FILE_GREEN=
SORT_LEASELIST=IPADDR
DNS_UPDATE_KEY_SECRET_GREEN=
DENY_KNOWN_CLIENTS_GREEN=off
DNS_UPDATE_KEY_ALGO_GREEN=
SORT_FLEASELIST=FIPADDR
NEXT_GREEN=
DNS2_GREEN=8.8.8.8
NTP1_GREEN=192.168.222.254
END_ADDR_GREEN=192.168.222.150
ENABLEBOOTP_GREEN=off
MAX_LEASE_TIME_GREEN=120
DNS_UPDATE_KEY_NAME_GREEN=
WINS2_GREEN=
START_ADDR_GREEN=192.168.222.51
WINS1_GREEN=
DEFAULT_LEASE_TIME_GREEN=60
[root@ipfire dhcp]#


And still running

1 Like