penguins-eggs icon indicating copy to clipboard operation
penguins-eggs copied to clipboard

DHCP patch

Open infusion opened this issue 6 years ago • 5 comments

Hi Piero,

I'm the author of the dhcp package and found penguin-eggs as you use it as a dependency. I was curious, how you use it and found

ATTENTION PATCH node_modules/dhcp
file lib/dhcp.js.js
replace: in line 320 and 365
search
file: '',
replace
file: this.config('bootFile'),

in your code. Do you think this should be permanent?

Robert

infusion avatar Feb 04 '18 11:02 infusion

Hi Robert,

Just now saw your mail, it went in the forum section of my Gmail, so escluse for the delay.

As I remember yes, but are same days who I don't look the code and so, let me to check again.

I want to ask you also if It Is possibile to add in your code the functionality of dhcp-proxy. This can be very usefull in the case we need to add a boot server in a LAN whith pre-existent dhcp (the majority off use cases). In this situation the server Need to listen all the requests, but answer only with the parameter "next" to indicate pxe boot host.

Thanx for your interest Robert, it is very nice to receive feedback.

Piero

Il 04 feb 2018 12:40 PM, "Robert Eisele" [email protected] ha scritto:

Hi Piero,

I'm the author of the dhcp package and found penguin-eggs as you use it as a dependency. I was curious, how you use it and found

ATTENTION PATCH node_modules/dhcp file lib/dhcp.js.js replace: in line 320 and 365 search file: '', replace file: this.config('bootFile'),

in your code. Do you think this should be permanent?

Robert

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pieroproietti/penguins-eggs/issues/4, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6glbfFFkkkl487s-oGHaIuEPFjZFCpks5tRZcXgaJpZM4R4ibC .

pieroproietti avatar Feb 17 '18 11:02 pieroproietti

Well Robert,

today I checked penguins-eggs, and using your actual code 0.2.10 and following your trace in example/server.js the program is running OK.

If can be interesting for you, this are the changement I made today:

https://github.com/pieroproietti/penguins-eggs/commit/827794d0cd1277e340ab514d8ce43f69eb8b5b51#diff-1fdf421c05c1140f6d71444ea2b27638

If you can try to add proxy-dhcp in your code, for my pourposes (bootserver) will be very nice! :-D

Thanx again

Piero

2018-02-17 12:25 GMT+01:00 Piero Proietti [email protected]:

Hi Robert,

Just now saw your mail, it went in the forum section of my Gmail, so escluse for the delay.

As I remember yes, but are same days who I don't look the code and so, let me to check again.

I want to ask you also if It Is possibile to add in your code the functionality of dhcp-proxy. This can be very usefull in the case we need to add a boot server in a LAN whith pre-existent dhcp (the majority off use cases). In this situation the server Need to listen all the requests, but answer only with the parameter "next" to indicate pxe boot host.

Thanx for your interest Robert, it is very nice to receive feedback.

Piero

Il 04 feb 2018 12:40 PM, "Robert Eisele" [email protected] ha scritto:

Hi Piero,

I'm the author of the dhcp package and found penguin-eggs as you use it as a dependency. I was curious, how you use it and found

ATTENTION PATCH node_modules/dhcp file lib/dhcp.js.js replace: in line 320 and 365 search file: '', replace file: this.config('bootFile'),

in your code. Do you think this should be permanent?

Robert

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pieroproietti/penguins-eggs/issues/4, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6glbfFFkkkl487s-oGHaIuEPFjZFCpks5tRZcXgaJpZM4R4ibC .

-- Piero Proietti Via Pio Joris 15, 00155 Roma

Internet MAIL: [email protected] [email protected] sito: h [email protected]ttp://pi http://piojoris15.comeroproietti.github.com http://eroproietti.github.com

pieroproietti avatar Feb 18 '18 15:02 pieroproietti

No worries, I'm a little late here as well. Could you open an issue for me and propose an API syntax for the dhcp proxy? I would also be happy if you could supply RFC's or technical descriptions on how dhcp proxies work in detail, since I couldn't find too detailed material with 1min of googling. Nice to hear that the recent version of dhcp.js simplifies your code and your diff looks good as well :)

infusion avatar Feb 20 '18 10:02 infusion

OK Robert,

I forked your repository to write the issue, yes I know I can write on yours directly, but prefere to not expose so much my ignorance :-) It is my first issue!

In all the way if you can like it, you can copy it as issue 7 on your repo, if not write me where I can do better.

Have nice time

Piero

This is the link https://github.com/pieroproietti/node-dhcp/issues/1 https://github.com/pieroproietti/node-dhcp/issues/1

DHCP-PROXY

I followed this PXE specification http://www.pix.net/software/pxeboot/archive/pxespec.pdf to write this document Services involved

  • DHCP port 67
  • DHCP-PROXY port 67 or 4011
  • PXE-CLIENT port 68
  • TFTP port

Use cases

  • One server with DHCP (Not necessary: we can fill the option 67 with id TFPT and option 68 with fileName)
  • One server with DHCP and DHCP-PROXY (Not necessary, we can use the default dhcp as before)
  • Two servers preesistent with DHCP and other with DHCP-PROXY (the most usefull, probably we can use port 67 alternative port 4011)

That happen with two server dhcp + dhcp-proxy

PXE-CLIENT -> DHCP (DHCP Discover to port 67 Contains “PXEClient” extension) DHCP -> PXE-CLIENT (DHCP Offer to port 68 Contains [other DHCP option tags] + Client IP addr) PXE-CLIENT -> DHCP (DHCP Request to port 67) DHCP -> PXE-CLIENT (DHCP Ack to port 68)

PXE-CLIENT -> DHCP-PROXY (Discover to port 67 Contains “PXEClient” extension) * initial DHCPREQUEST DHCP-PROXY -> PXE-CLIENT (DHCP Offer to port 68 Client IP addr set to 0.0.0.0) PXE-CLIENT -> DHCP-PROXY (DHCP Request to port 4011 Contains “PXEClient” extension) DHCP-PROXY -> PXE-CLIENT (DHCP Ack reply to port client’s port Contains “PXEClient” extension tags + pxelinux.0 file)

PXE-CLIENT -> TFTP (pxelinux.0 download request to TFTP port 69 or MTFTP port assigned in DHCP Ack w/ pxelinux.0 file) TFTP -> PXE-CLIENT (pxelinux.0 download to client’s port)

The PXE client knows to interrogate the Proxy DHCP service because the DHCPOFFER from the DHCP service contains an Option #60 “PXEClient” tag without corresponding Option #43 tags or a boot file name

CodeVariables involved

  • csa refer to option 93 // Sent by client to specify their system artchitecture
  • tftpserver refer to option 66 // RFC 2132: PXE option
  • filename refer to option 67 // RFC 2132: PXE option

Codeoptions.js

93: { name: 'Client system architecture.', type: 'UInt8', enum: { 0: 'IA_X86_PC', 1: 'NEC98_PC', 2: 'IA_64_PC', 3: 'ALPHA', 4: 'ARC_X86', 5: INTEL_LEAN_CLIENT }, attr: 'csa' },

examples/proxy.js

This is just an example, I introduced the variables dhcpProxy and req.csa (client system architecture)

var dhcpd = require('../lib/dhcp.js'); var p = dhcpd.createServer({ dhcpProxy: true, range: [ "192.168.3.10", "192.168.3.99" ], server: '192.168.3.2', // This is bootserverbootFile: function (req, res) { if (req.csa === '0') { return 'x86linux.0'; } else { return 'x64linux.0'; } } }); p.on('message', function (data) { console.log(data); }); p.on('bound', function(state) { console.log("BOUND:"); console.log(state); }); p.on("error", function (err, data) { console.log(err, data); }); s.on("listening", function (sock) { var address = sock.address(); console.info('Server Listening: ' + address.address + ':' + address.port); }); p.on("close", function () { console.log('close'); }); p.listen(); process.on('SIGINT', () => { p.close(); });

2018-02-20 11:11 GMT+01:00 Robert Eisele [email protected]:

No worries, I'm a little late here as well. Could you open an issue for me and propose an API syntax for the dhcp proxy? I would also be happy if you could supply RFC's or technical descriptions on how dhcp proxies work in detail, since I couldn't find too detailed material with 1min of googling. Nice to hear that the recent version of dhcp.js simplifies your code and your diff looks good as well :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pieroproietti/penguins-eggs/issues/4#issuecomment-366929660, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6glUcxkw5DuHym-5Q_JmOjos3470FMks5tWppcgaJpZM4R4ibC .

-- Piero Proietti Via Pio Joris 15, 00155 Roma

Internet MAIL: [email protected] [email protected] sito: h [email protected]ttp://pi http://piojoris15.comeroproietti.github.com http://eroproietti.github.com

pieroproietti avatar Feb 20 '18 14:02 pieroproietti

@infusion

Actually eggs is running on Debian, Devuan, Ubuntu and from same days on Manjaro Linux!

I imagine you are really busy with your plans, but ...

We did many steps from time ago. Today I was checking at this issue and re-open your message, It will be a great thing to enable for eggs the capacity to run as pxe server too. One can build a custom version of his preferred distro, and let to users to install it in minutes, not days, not hours.

That we need it's just a dhcp proxy in javascript...

I wish you good new year Robert

pieroproietti avatar Jan 09 '22 17:01 pieroproietti