Koozali.org: home of the SME Server

Alter dhcpd.conf with tftp and group settings

Offline bhamail

  • ***
  • 46
  • +0/-0
Alter dhcpd.conf with tftp and group settings
« on: July 11, 2007, 01:59:45 AM »
Noobie warning.

I'm trying to permanently alter my /etc/dhcpd.conf file with settings like those shown below:

Code: [Select]

#------------------------------------------------------------
# mvpmc dhcp, tftp boot Entries
#------------------------------------------------------------
group {
    next-server 10.6.18.2; # IP address of your TFTP server
    host mvp.rollocos.com {
        hardware ethernet 00:00:00:00:00:00; # MAC address of your MediaMVP
        fixed-address 10.6.18.25; # IP address you want to assign the MediaMVP
        filename "dongle.bin.mvpmc"; # arbitrary, but must match filename in /tftboot
        option root-path "/home/mvp,rsize=4096,wsize=4096,nolock";
    }
}


This is for an appliance (set top box) that uses the tftp server to boot. Once I managed to get the changes written and the device worked great. Then I started trying to figure out the correct way to make the changes persist across restarts.

I noticed the dhcpd service automatically restarts itself when I stop it via the command line. Also, the /etc/dhcpd.conf file gets re-written when this happens (as the text of that file clearly warns).

I tried changing the file: /etc/e-smith/templates/etc/dhcpd.conf/60StaticEntries to include the settings above, but that didn't result in an altered /etc/dhcpd.conf.

I also tried creating a new file (/etc/e-smith/templates/etc/dhcpd.conf/65MVPMCEntries) to try and add the settings.

I also tried changing some other scripts that do run at boot, but since /etc/dhcpd.conf gets rewritten whenever dhcpd is restarted AND dhcpd doesn't appear to reread it's conf after it is running, I'm not sure what to do.

Could someone point me to an existing sme script that I could alter OR some other way to get this working? (I'm still not up to speed with how actions/events/conf db all interact in sme - so please remember the noobie warning).

Thanks!
Dan

Offline Franco

  • *
  • 1,171
  • +0/-0
    • http://contribs.org
Alter dhcpd.conf with tftp and group settings
« Reply #1 on: July 11, 2007, 03:11:52 AM »
This works for me, you would need to try with your device.
The functionality is the same:
http://wiki.contribs.org/Tftp_server

Offline bhamail

  • ***
  • 46
  • +0/-0
Alter dhcpd.conf with tftp and group settings
« Reply #2 on: July 12, 2007, 02:42:01 AM »
Hi Stuntshell,

I probably wasn't clear - tftp is working fine (in fact I'm using the contrib you mention). What I need is to alter the dhcpd.conf settings to instruct the network booting device to use the tftp service on my sme box.

In short, the issue I have is not with tftp - tftp is working fine and verified. My problem is how to add the settings I mentioned in my original post to the dhcpd.conf.

Dan

Offline Franco

  • *
  • 1,171
  • +0/-0
    • http://contribs.org
Alter dhcpd.conf with tftp and group settings
« Reply #3 on: July 12, 2007, 03:07:26 AM »
With this contrib you get a panel where you can configure each Individually Controlled Workstation by it's MAC, this is exactly how it does, it modifies the dhcp.conf to suite your needs.

Offline TrevorB

  • *
  • 259
  • +0/-0
    • http://www.batley.id.au
Re: Alter dhcpd.conf with tftp and group settings
« Reply #4 on: July 12, 2007, 06:15:45 AM »
Quote from: "bhamail"
Code: [Select]

#------------------------------------------------------------
# mvpmc dhcp, tftp boot Entries
#------------------------------------------------------------
group {
    next-server 10.6.18.2; # IP address of your TFTP server
    host mvp.rollocos.com {
        hardware ethernet 00:00:00:00:00:00; # MAC address of your MediaMVP
        fixed-address 10.6.18.25; # IP address you want to assign the MediaMVP
        filename "dongle.bin.mvpmc"; # arbitrary, but must match filename in /tftboot
        option root-path "/home/mvp,rsize=4096,wsize=4096,nolock";
    }
}
What stuntshell is saying is that this WILL be generated (except the option root-path "/home/mvp,rsize=4096,wsize=4096,nolock"; line) by smeserver-thinclient if you create an 'Individually Controlled Workstation' with (you shouldn't need the fully qualified name):
*Name = mvp
*mac address = 00:00:00:00:00:00
*Distribution = mvpmc
*Status = enabled
and a Distribution with:
*Distribution = mvpmc
*Base Directory = /tftproot/mvpmc
*Executable = dongle.bin.mvpmc
*Type = Manual

and put all your bits and peices in /tftproot/mvpmc

You could make a copy of /etc/e-smith/templates/etc/dhcpd.conf/40PXEClients in /etc/e-smith/templates-custom/etc/dhcpd.conf and alter to your requirements.
Quote from: "bhamail"
This is for an appliance (set top box) that uses the tftp server to boot. Once I managed to get the changes written and the device worked great. Then I started trying to figure out the correct way to make the changes persist across restarts.
You could just create a fragment (/etc/e-smith/templates-custom/etc/dhcpd.conf/41mvp) that just copies out those lines.
Quote from: "bhamail"
I noticed the dhcpd service automatically restarts itself when I stop it via the command line. Also, the /etc/dhcpd.conf file gets re-written when this happens (as the text of that file clearly warns).
dhcpd is a 'supervised' process and will be restarted automagically (regenerating /etc/dhcpd.conf file as part of it's startup) unless you do a
Code: [Select]
config setprop dhcpd status disabled
Quote from: "bhamail"
I tried changing the file: /etc/e-smith/templates/etc/dhcpd.conf/60StaticEntries to include the settings above, but that didn't result in an altered /etc/dhcpd.conf.

I also tried creating a new file (/etc/e-smith/templates/etc/dhcpd.conf/65MVPMCEntries) to try and add the settings.
You should ALWAYS make a copy of the original template in templates-custom (any update CAN/WILL overwrite /etc/e-smith/templates).

Hmmm... Well then you have a mistake or potentially the dhcpd.conf was regened & then overwritten. When playing, stop dhcpd (config setprop dhcpd status disabled & /etc/init.d/dhcpd stop). Do your changes and then run
Code: [Select]
expand-template /etc/dhcpd.conf and look at the results

Quote from: "bhamail"
Could someone point me to an existing sme script that I could alter OR some other way to get this working?
smeserver-thinclient does just that.

If you run mc you can look into any rpm and see the files used (everything installed on your smeserver should be in the yum cache /var/cache/yum). smeserver-thinclient will be in the smedev cache directory.

In the case of smeserver-thinclient the fragments are
*28NextServer
*28PXEFilename
*40PXEClients

Good Luck
Trevor B

Offline bhamail

  • ***
  • 46
  • +0/-0
Alter dhcpd.conf with tftp and group settings
« Reply #5 on: July 13, 2007, 09:20:34 AM »
Stuntshell and TrevorB,

Thanks so much for the help!

I only had the "tftp" contrib installed (not the "thinclient"), so the admin pages didn't show the things mentioned by stuntshell.

The hints about how to handle a 'supervised' process (and others) were a great help.

I banged my head against the wall many times trying all suggestions. I was looking at tftpd log and dhcpd log, but only when I finally thought to look at the main messages log did I see a connection being refused for the tftpd:

Jul 13 02:56:17 rocosme in.tftpd[17912]: connection refused from 10.6.18.25

Then I started to wonder if the firewall had been properly opened. After I ran:

signal-event tftpd-conf

everything started working! I don't know if this signals a possible problem in signaling/installation. Here's the order in which I installed/uninstalled things:
1. installed the tftpd contrib (should have opened port 69???)
2. installed the thinclient contrib
3. un-installed the thinclient contrib
4. installed the thinclient contrib.

Anyway, once I did the "signal-event tftpd-conf", then the "connection refused" messages stopped and my device booted just fine. Thanks again for you help!

Dan

Offline TrevorB

  • *
  • 259
  • +0/-0
    • http://www.batley.id.au
Alter dhcpd.conf with tftp and group settings
« Reply #6 on: July 13, 2007, 11:33:29 AM »
Quote from: "bhamail"
Anyway, once I did the "signal-event tftpd-conf", then the "connection refused" messages stopped and my device booted just fine.
Did you read the HowTo?
Quote
The tftpd status is controlled via the Thin Clients server-manager panel if you have installed my smeserver-thinclient contrib.

If you haven't, you'll need to enable the tftp server and expand all the templates etc.
Code: [Select]
config setprop tftpd status enabled
signal-event tftpd-conf

If for any reason the tftp server isn't running, try:
Code: [Select]
/etc/init.d/supervise/tftpd restart

Trevor B  :)

Offline bhamail

  • ***
  • 46
  • +0/-0
Alter dhcpd.conf with tftp and group settings
« Reply #7 on: July 17, 2007, 06:52:31 AM »
Hi TrevorB,

Actually, I did read the howto. It states:

"You shouldn't need to play with any parameters (except status). The defaults and allowed values are listed below."... a table of settings, then:

"These settings can be set/changed via

config setprop tftpd <prop> <value>
signal-event tftpd-conf"

When I first installed the tftpd config, I did change the "status" and issued the "signal-event tftpd-conf". The point being, the final time I ran "signal-event tftpd-conf" was definitely not the first time I'd run that command.

What's strange to me is that, as I stated in my original post, tftp (as installed via your contrib) was working fine at one point, since I was able to get the device to boot once via tftp. Somewhere along the way, tftp stopped working (and I'm pretty sure it's because the required port was closed in the firewall somehow - the 'connection refused' in dmesg, while tftpd logs show some activity), though I have no idea how that could happen.

Thanks again for all your help, and my little settop boxes are booting nicely now.

Dan

Offline TrevorB

  • *
  • 259
  • +0/-0
    • http://www.batley.id.au
Alter dhcpd.conf with tftp and group settings
« Reply #8 on: July 17, 2007, 08:41:48 AM »
Quote from: "bhamail"
What's strange to me is that, as I stated in my original post, tftp (as installed via your contrib) was working fine at one point, since I was able to get the device to boot once via tftp. Somewhere along the way, tftp stopped working (and I'm pretty sure it's because the required port was closed in the firewall somehow - the 'connection refused' in dmesg, while tftpd logs show some activity), though I have no idea how that could happen.
the 'connection refused' message could happen if the listener wasn't running (tftpd doesn't run all the time itself. A 'listener' program monitors the port for activity & then kicks off tftpd for a pre-defined time).

This 'listener' should be under service control, so will be restarted if it fails for any reason. The only way it shouldn't be running if is tftpd status is set to disabled (or there is a bug...).

The status can be reset to disabled if smerserver-tftpd is re-installed or unistalled/installed. I'll look to see that smeserver-thinclient isn't inadvertently resetting it either.

Glad to see you have everything working :-)

Trevor B