-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Working Client #2
Comments
What would you want the client to do? Simply negotiate itself a lease and allow you to try to renew it? If a hypothetical client negotiated successfully, it would simply report the details of its lease as JSON -- it wouldn't be able to actually configure an interface from within Node. |
It just needs to be able to obtain the lease and renew it. A JSON type blob would be perfect. I have a working, but far from polished module for configuring network interfaces at src-sockios. I am one DHCP client short of automatically bootstrapping a functional network OS using only Node. I would like to create a dhcp-service module that combines |
Not a full solution (yet), but I just added some basic support and an example that sends |
What's the current status? I've tried
Shouldn't it give also the response from the DHCP server? |
Are you running it as |
Yes, I'm executing it as root. If not, it gives a permissions problem, and
|
Silly question -- did you change the |
No, I didn't, I used the package as it got downloaded. Should I change it?
|
Don't know if it's v0.12 only, but the build-in > var os = require('os')
undefined
> os.getNetworkInterfaces()
getNetworkInterfaces is now called `os.networkInterfaces`.
{ lo:
[ { address: '127.0.0.1',
netmask: '255.0.0.0',
family: 'IPv4',
mac: '00:00:00:00:00:00',
internal: true },
{ address: '::1',
netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
family: 'IPv6',
mac: '00:00:00:00:00:00',
scopeid: 0,
internal: true } ],
wlan0:
[ { address: '192.168.1.184',
netmask: '255.255.255.0',
family: 'IPv4',
mac: '10:9a:dd:b0:c2:c4',
internal: false },
{ address: 'fe80::129a:ddff:feb0:c2c4',
netmask: 'ffff:ffff:ffff:ffff::',
family: 'IPv6',
mac: '10:9a:dd:b0:c2:c4',
scopeid: 3,
internal: false } ] } This could be used to fetch the MAC address automatically so the example client can work without modifying the code. Only thing that network interfaces must be up (with an IP?) so they can be listed there. Maybe the |
Yes, that is what a real DHCP client would do -- only it would have the logic for which network interface to use. The example code in the repository has a dummy MAC address in it because it is just an example. If you'd like to see it working, then just replace the MAC address with the one associated with your |
I see. Then if it's so simple, for example purposses I think it should use the MAC address of the machine where it's running instead of having a hardcoded one... I'll try to test it and do a pull-request later. Should I modify any other thing? Transaction ID, maybe? bind call? |
getNetworkInterfaces is now called `os.networkInterfaces`.
listening on 0.0.0.0:68
bound to 0.0.0.0:68
dhcpDiscover (wlan0): sent
dhcpDiscover (wlan0): sent
dhcpOffer: { op: { [Number: 2] value: 2, name: 'BOOTPREPLY' },
hlen: 6,
hops: 0,
xid: 1,
secs: 0,
flags: 0,
ciaddr: undefined,
yiaddr: '10.1.70.89',
siaddr: undefined,
giaddr: undefined,
chaddr:
{ type: { [Number: 1] value: 1, name: 'HW_ETHERNET' },
address: '10:9a:dd:b0:c2:c4' },
sname: '',
file: '',
magic: 1669485411,
options:
{ dhcpMessageType: { [Number: 2] value: 2, name: 'DHCPOFFER' },
serverIdentifier: '1.1.1.1',
ipAddressLeaseTime: 14400,
routerOption: [ '10.1.64.1' ],
domainNameServerOption: [ '193.147.69.2', '193.147.184.11' ],
domainName: 'urjc.es',
subnetMask: '255.255.248.0' } } That's WAY better... :-D So with that info, seems it would be really easy to craft a real DHCP client... :-) |
nodejs/node-v0.x-archive#9029 Ok, |
The front-end Node/io.js issues are just fronts for the change, which would have to happen in libuv/libuv#158 The change is currently pending review. |
I've left as task for the reader to follow the rabbit hole... ;-) |
Hey, I'm very interested in finding a working DHCP client in Node. Correct me if I'm wrong, but the client doesn't actually seem to work.
The project seems to have taken some big steps forward however, can you point me in a direction where I could contribute to getting the client working?
The text was updated successfully, but these errors were encountered: