WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: DHCP Server with udhcpd; why /tmp/udhcpd.leases is empty?  (Read 5546 times)

Offline Adam

  • Full Member
  • ***
  • Posts: 121
DHCP Server with udhcpd; why /tmp/udhcpd.leases is empty?
« on: February 04, 2017, 08:17:42 PM »
Hi all,

I've successfully setup simple DHCP server with udhcpd.
Everything is fine except /tmp/udhcpd.leases is empty.
I assume this is the folder where we can see which IP Address has been assigned by the server.
Let me know if you need more info.

Here is what I did
1. Prepare DHCP Server Config file
Code: [Select]
tc@Server:/$ cat /etc/udhcpd.conf
start 10.1.1.10
end 10.1.1.20
interface eth2
option subnet 255.255.255.0
option router 10.1.1.1
option lease 259200
option dns 10.1.1.1
lease_file /tmp/udhcpd.leases
option domain home
pidfile /tmp/udhcpd.pid
tc@Server:/$

2. Start the DHCP Server
Code: [Select]
tc@Server:/$ sudo udhcpd /etc/udhcpd.conf &
tc@Server:/$ ps -ef | grep udhcpd
 2524 root     udhcpd /etc/udhcpd.conf
 2526 tc       grep udhcpd
[1]+  Done                       sudo udhcpd /etc/udhcpd.conf
tc@Server:/$

3. Client to get new DHCP IP
Code: [Select]
tc@Client:~$ sudo udhcpc -i eth2
udhcpc (v1.24.2) started
Sending discover...
Sending discover...
Sending discover...
Sending discover...
Sending select for 10.1.1.10...
Lease of 10.1.1.10 obtained, lease time 259200
deleting routers
route: SIOCDELRT: No such process
route: SIOCADDRT: Network is unreachable
adding dns 10.1.1.1
tc@Client:~$

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: DHCP Server with udhcpd; why /tmp/udhcpd.leases is empty?
« Reply #1 on: February 05, 2017, 01:17:36 AM »
Try asking on the busybox mailing list, more udhcpd users there.
The only barriers that can stop you are the ones you create yourself.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 662
Re: DHCP Server with udhcpd; why /tmp/udhcpd.leases is empty?
« Reply #2 on: February 05, 2017, 01:36:39 AM »
You could just delete the leases file and use strace to see if the file is being created when starting the daemon.
And also see if there are some another file in another location, being created.
Or maybe there some rights problem, even if the daemon starts through root.
Some daemons runs some child process through another users.


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: DHCP Server with udhcpd; why /tmp/udhcpd.leases is empty?
« Reply #3 on: February 05, 2017, 07:21:39 AM »
Hi Adam
Quote
2. Start the DHCP Server
Code: [Select]
tc@Server:/$ sudo udhcpd /etc/udhcpd.conf &
tc@Server:/$ ps -ef | grep udhcpd
 2524 root     udhcpd /etc/udhcpd.conf
 2526 tc       grep udhcpd
[1]+  Done                       sudo udhcpd /etc/udhcpd.conf
tc@Server:/$
Is it possible another instance of  udhcpd  was already running? I might be mistaken, but I think that line that reads  [1]+  Done
means your command terminated and is no longer running.