Results 1 to 4 of 4

Thread: General DHCP TFTP Question

  1. #1

    Default General DHCP TFTP Question

    Evening, All.
    A long way from being a networking techie, I have, in a moment of hubris, taken on the development of a web-based config tool for powerline network devices for a local client. Basic workflow is:
    i) user enters MAC in web form; ii) user fills in config values in next screen; iii) a PHP script saves the device config values to a file, call it 'plc.conf', edits the dhcpd.conf file, adding a host entry for the new device, then restarts the dhcp service. All that works fine and the device is getting its new address. Here's the hard bit:
    When the device gets a response from the DHCP server, it is supposed to download its config file over TFTP on the basis of info it gets from the DHCP server. Is anyone familiar with this kind of workflow? My PHP script is adding a host entry like this (within the subnet entry):

    host HE1{
    fixed-address 10.0.0.3;
    hardware ethernet 00:12:22:13:41:AB; whatever
    filename "/fullpath/to/plc.conf";
    server-name "10.0.0.1";
    next-server 10.0.0.1
    }
    IF there's a syntax error there it's because I'm typing in from the other screen - DHCP restarts and assigns the address fine. AS far as I can see there's no conf file going over. Where would the TFTP log be on OpenSuse 10.3?
    Xinetd log tells me nowt. If anyone has got this kind of workflow working I'd be grateful of some pointers. I've been to lots of sites purporting to explain all this but seen very few worked examples. This is certainly the most concrete: 4.3. Preparing Files for TFTP Net Booting

    Anyway, any thoughts appreciated.

    Mark

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: General DHCP TFTP Question

    First thing you have to realise is that DHCP and TFTP are separate services and have separate daemons running. What you are doing is in fact similar to netbooting. The main step you are missing is that you don't have a TFTP server running. Install one (tftpd, or atftpd from the distro) and configure it to listen to requests from the client.

    There is however a daemon called dnsmasq, which combines 3 functions: DNS proxy, DHCP server and TFTP server. Functions not used can be turned off. It may or may not be easier to use than a combination of dhcpd and tftpd.

  3. #3

    Default Re: General DHCP TFTP Question

    Thanks for the reply. Yes, I realise that TFTP and DHCP are two separate services. As I undersand this process, the DHCP server tells the newly-connected device where the TFTP server is and which file to download. My question is what's the firing order of events and how does that translate into code? Earlier, I was trying to do this in two separate steps: i) let the DHCP server assign the address and then ii) use a TFTP PUT, in a separate script / step to send the conf file to the device. However, I had misunderstood the semantics of PUT. You can PUT to a TFTP server, if the file already exists (is that right?). You can't PUT to a TFTP client a file that does not exist.

    I thought the device asked for (GET) the config file from the TFTP server specified in the DHCP response?

    Thanks

    Mark

  4. #4
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: General DHCP TFTP Question

    TFTP is a pull protocol, not a push protocol. There is no provision for making clients accept files. You have to get the client to request the file. The sequence in netbooting goes like this:

    1. Device is reset
    2. Requests and gets DHCP info
    3. Requests a file by TFTP
    4. Boots with file (usually the OS)

    So you will have to get your client to somehow fetch the file after getting the info.

    Also a TFTP server is "loaded" simply by depositing the files in the directory that it serves. You don't "install" files using upload like HTTP or FTP. There is a TFTP PUT command, but that requires that the file already exist, for security reasons, because TFTP is an unauthenticated protocol.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •