Closed ccoenen closed 5 years ago
for reference: I'm using node.js 11.0.7 (current version at time of writing). NPM 6.4.1 and dhcp 0.2.18 from npm packages.
I'm reading the source to figure out what could go wrong on windows that it's not finding an entry on the object. This is really strange and you did nothing wrong, so it should be a bug somehow.
Does this also happen with examples/server.js
? You should be able to execute it without any problems. Here for me on OSX with node 11.5.0:
➜ examples git:(master) ✗ sudo node server.js
Server Listening: 0.0.0.0:67
interestingly, i can run the server example with no problem at all right from master. It also completes a full cycle until "BOUND" when I reset wifi on my smartphone.
Okay, then the example in the readme seems to be broken somehow. I'll look into that.
I verified that I have the same problem with master
.
I just saw, server.js has also set the server
config:
perhaps it's just missing from the minimal readme example.
funnily, I didn't alter that (so on my network this would be the wrong IP) yet it didn't create any problem as far as I can tell right now.
This does not throw an error since that option is sent to the client in the dhcp package only. The server is bound on INADDR_ANY per default. I updated the readme, sorry for that mistake.
not a problem. I have a fine dhcpd running in JS right now. Many thanks for that :-)
I added server
and also broadcast
and dns
to my script and it works spectacularly!
Next up: auto configure new clients (think: ssh-copy-id
and setting serialised hostnames for a bunch of raspberry-pis). I'll let you know how it goes!
You're welcome!
I was too lazy to document all options. You can have a look into the options.js file if you need more things you can push to your PI's :)
But configuring a PI was also my initial motivation for this project. I also loved the idea of setting the hostname, but this is/was a bit tricky with the standard dhcp client running on the PI. I found 1000 sites on the net that did not work to set the hostname and ultimately found one that did. But don't ask which :D
I'm not sure if this is expected or not, on windows 10 with the example dhcpd from the readme, it will fail
The error goes away if I specify my computer's IP in createServer:
I went to dhcp.js around line 345 and tried reading
config('server')
, but it was simply0
. I didn't find where and if this should be set manually under normal circumstances.If this is expected, I would like to request adding it to the readme. If this is unexpected, I would like find and squish that bug.