Closed evacomm-mmacadams closed 6 years ago
+1
Did you guys try to pass a net you want to listen on to the listen
-method like so?
// dhcp.listen(port, net, callback)
dhcp.listen(null, '192.168.3.0');
Ah yes, thanks!
I edited lib/node_modules/dhcp/bin/dhcpd-cli.js and ended up with: //server.listen(); server.listen(null,'10.10.10.1');
root@guestshell ~/Python_DHCP: netstat -an | grep :67 udp 0 0 0.0.0.0:67 0.0.0.0: root@guestshell ~/Python_DHCP: netstat -an | grep :67 udp 0 0 10.10.10.1:67 0.0.0.0: root@guestshell ~/Python_DHCP:
thanks!
Yeah! You're welcome :) Do you have any suggestions to make things better for others too?
Passing it on the CLI at startup under the options list would be ideal, unless I somehow missed that completely. --interface
FYI, In my situation I'm running this within a guest shell on a Nexus 9000 switch since NXOS doesn't provide the ability to run a DHCP server locally.
I quickly added the bind option to the CLI daemon. Could you check it out, if that's the way you would like to have it? (with --bind 10.10.10.1)
slick. Works well for IP addr yes, thanks!
For binding to an interface name (such as Vlan400, or Eth1/x) it doesn't but that's ok for me, I can work with it. Thanks so much!
It's typically IP based, since its the only way to make it work across platforms, especially Windows. Under Linux you need to use SO_BINDTODEVICE, under OSX you need to use IP_BOUND_IF, but as far as I know there is no option to pass this info to the OS using nodejs.
There is a hacky solution using ffi: https://github.com/nodejs/node/issues/3625
For a DHCP server, it would be ideal to be able to bind an instance to an interface . (or perhaps a group of interfaces). If you were building a router, you only wan DHCP offered on LAN ports, not the WAN ports.
Thanks for taking the time to build this project, it's been very helpful!