Difference between revisions of "Tftp server"
(use systemctl rather than service (for restart)) |
|||
(9 intermediate revisions by 4 users not shown) | |||
Line 3: | Line 3: | ||
== smeserver-tftp-server == | == smeserver-tftp-server == | ||
Maintainer: [mailto:smeserver@batley.id.au Trevor Batley]<br> | Maintainer: [mailto:smeserver@batley.id.au Trevor Batley]<br> | ||
− | {{ #smeversion: smeserver-tftp-server }} | + | {{#smeversion: smeserver-tftp-server }} |
=== Description === | === Description === | ||
Line 11: | Line 11: | ||
=== Requires === | === Requires === | ||
− | *smeserver >= | + | *smeserver >= 10.0 |
− | *tftp-server >= 0. | + | *tftp-server >= 0.49 |
+ | |||
+ | For a lot of linux distros you will need nfs support | ||
+ | |||
+ | https://wiki.koozali.org/NFS | ||
+ | |||
+ | You will a /etc/exports line similar to this: | ||
+ | |||
+ | /tftpboot/ *(ro,sync,no_wdelay,insecure_locks,no_root_squash,insecure) | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | mkdir -p /etc/e-smith/templates-custom/etc/exports/ | ||
+ | echo "/tftpboot/ *(ro,sync,no_wdelay,insecure_locks,no_root_squash,insecure)" > /etc/e-smith/templates-custom/etc/exports/30tftp | ||
+ | expand-template /etc/exports | ||
+ | </syntaxhighlight> | ||
+ | /tftpboot/images/ubunturescue_1104/ *(ro,sync,no_wdelay,insecure_locks,no_root_squash,insecure) | ||
+ | if you have installed smeserver-nfs | ||
=== Installation === | === Installation === | ||
Line 23: | Line 38: | ||
yum --enablerepo=smecontribs --enablerepo=base install smeserver-tftp-server | yum --enablerepo=smecontribs --enablerepo=base install smeserver-tftp-server | ||
− | + | The tftp status can be controlled via the Thin Clients server-manager panel if you have installed my [[Thinclient|smeserver-thinclient]] contrib. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | If you haven't, you'll need to enable the tftp server | + | If you haven't, you'll need to enable the tftp server manually from the shell (logged in as root) |
− | config setprop | + | config setprop tftp status enabled |
− | signal-event | + | signal-event smeserver-tftp-server-update |
If for any reason the tftp server isn't running, try: | If for any reason the tftp server isn't running, try: | ||
− | + | systemctl restart tftp | |
=== Defaults === | === Defaults === | ||
Line 81: | Line 91: | ||
| | | | ||
|- | |- | ||
− | | blksize | + | | blksize <sup>1</sup> |
| | | | ||
| Value between 512-65464 | | Value between 512-65464 | ||
| e.g. equivalent to -B [512-65464] | | e.g. equivalent to -B [512-65464] | ||
|- | |- | ||
− | | refuse | + | | refuse <sup>2</sup> |
| | | | ||
| any tftp parameter | | any tftp parameter | ||
Line 94: | Line 104: | ||
These settings can be set/changed via | These settings can be set/changed via | ||
− | config setprop | + | config setprop tftp <prop> <value> |
− | signal-event tftpd- | + | signal-event smeserver-tftp-server-update |
+ | |||
+ | <nowiki>*1</nowiki> blksize does not have a default entry in the configuration database. It can be added as above or removed via | ||
+ | |||
+ | see Bug 10646 for updated tftp contrib with addition of default setting | ||
+ | config delprop tftp blksize | ||
+ | signal-event smeserver-tftp-server-update | ||
+ | |||
+ | <nowiki>*2</nowiki> refuse does not have a default entry in the configuration database. It can be added as above or removed via | ||
+ | config delprop tftp refuse | ||
+ | signal-event smeserver-tftp-server-update | ||
+ | |||
+ | ===Setup PXE Booting=== | ||
+ | |||
+ | Some rough notes on setting up PXE booting for linux using syslinux | ||
+ | |||
+ | https://wiki.syslinux.org/wiki/index.php?title=PXELINUX | ||
+ | |||
+ | To use a menu we need a copy of pxelinux.0 | ||
+ | |||
+ | From the syslinux wiki link above: | ||
+ | |||
+ | On the TFTP server, create the directory "/tftpboot", and copy "pxelinux.0" (from the Syslinux distribution) and any kernel or initrd images that you want to boot. | ||
+ | [5.00+] Also copy "ldlinux.c32" from the Syslinux distribution to the "/tftpboot" directory on the TFTP server. | ||
+ | Finally, create the directory "/tftpboot/pxelinux.cfg". The configuration file (equivalent of syslinux.cfg -- see the SYSLINUX FAQ for the options here) will live in this directory. | ||
+ | |||
+ | The actual linux image and any associated files need to be extracted from a source distribution ISO here: | ||
+ | |||
+ | /tftpboot/images/{name_of_distro} | ||
+ | |||
+ | |||
+ | ====Menus==== | ||
+ | |||
+ | We can create a menu system with sub menus as well. | ||
+ | |||
+ | Yu will need this from the syslinux ISO: | ||
+ | |||
+ | /tftpboot/com32/vesamenu.c32 | ||
+ | |||
+ | You can add a background image like this: | ||
+ | |||
+ | /tftpboot/images/graphics/background.png | ||
+ | |||
+ | |||
+ | Example /tftpboot/pxelinux.cfg/default: | ||
+ | |||
+ | <pre> | ||
+ | menu title --== SME Linux, PXE Main Menu ==-- | ||
+ | menu background graphics/background.png | ||
+ | menu tabmsgrow 22 | ||
+ | menu cmdlinerow 22 | ||
+ | menu endrow 24 | ||
+ | |||
+ | menu color title 1;34;49 #eea0a0ff #cc333355 std | ||
+ | menu color sel 7;37;40 #ff000000 #bb9999aa all | ||
+ | menu color border 30;44 #ffffffff #00000000 std | ||
+ | menu color pwdheader 31;47 #eeff1010 #20ffffff std | ||
+ | menu color hotkey 35;40 #90ffff00 #00000000 std | ||
+ | menu color hotsel 35;40 #90000000 #bb9999aa all | ||
+ | menu color timeout_msg 35;40 #90ffffff #00000000 none | ||
+ | menu color timeout 31;47 #eeff1010 #00000000 none | ||
+ | |||
+ | prompt 0 | ||
+ | noescape 1 | ||
+ | allowoptions 0 | ||
+ | timeout 0 | ||
+ | |||
+ | default com32/vesamenu.c32 | ||
+ | |||
+ | label linuxmenu | ||
+ | menu label ^Linux Boot Disks Menu | ||
+ | kernel com32/vesamenu.c32 | ||
+ | append pxelinux.cfg/linux_boot_disks | ||
+ | |||
+ | label Arch | ||
+ | menu label ^Arch Boot Disks Menu | ||
+ | kernel com32/vesamenu.c32 | ||
+ | append pxelinux.cfg/arch | ||
+ | |||
+ | label bootimg | ||
+ | menu label ^Other Boot Images | ||
+ | kernel com32/vesamenu.c32 | ||
+ | append pxelinux.cfg/bootimg | ||
+ | </pre> | ||
+ | |||
+ | We then need to create separate sub menu configuration files in the same directory. Note the use of NFS is required for some of the setups here. | ||
+ | |||
+ | {{Note box|These are old configs that have not been tested recently but should give an idea. Please update with any recent information}} | ||
+ | |||
+ | Sample for /tftpboot/pxelinux.cfg/linux_boot_disks | ||
+ | |||
+ | The symbol ^ as per eg "Back to ^Main" is used to create an underlined shortcut key M in this instance. | ||
+ | |||
+ | <pre> | ||
+ | menu title --== Linux Boot Images ==-- | ||
+ | menu background graphics/background.png | ||
+ | menu tabmsgrow 22 | ||
+ | menu cmdlinerow 22 | ||
+ | menu endrow 24 | ||
+ | |||
+ | menu color title 1;34;49 #eea0a0ff #cc333355 std | ||
+ | menu color sel 7;37;40 #ff000000 #bb9999aa all | ||
+ | menu color border 30;44 #ffffffff #00000000 std | ||
+ | menu color pwdheader 31;47 #eeff1010 #20ffffff std | ||
+ | menu color hotkey 35;40 #90ffff00 #00000000 std | ||
+ | menu color hotsel 35;40 #90000000 #bb9999aa all | ||
+ | menu color timeout_msg 35;40 #90ffffff #00000000 none | ||
+ | menu color timeout 31;47 #eeff1010 #00000000 none | ||
+ | |||
+ | prompt 0 | ||
+ | noescape 1 | ||
+ | allowoptions 0 | ||
+ | timeout 0 | ||
+ | |||
+ | default com32/vesamenu.c32 | ||
+ | |||
+ | label main | ||
+ | menu label Back to ^Main Menu | ||
+ | kernel com32/vesamenu.c32 | ||
+ | append pxelinux.cfg/default | ||
+ | |||
+ | |||
+ | label Mint 12 | ||
+ | menu label ^Mint 12 | ||
+ | kernel images/mint_12/vmlinuz | ||
+ | append boot=casper initrd=images/mint_12/initrd.lz | ||
+ | |||
+ | label Debian Mint | ||
+ | menu label ^Debian Mint | ||
+ | kernel images/debian_mint/vmlinuz | ||
+ | append boot=casper netboot=nfs nfsroot=192.168.10.1:/home/e-smith/files/ibays/computer/files/debian_mint initrd=images/debian_mint/initrd.lz | ||
+ | |||
+ | label Xubuntu | ||
+ | menu label ^Xubuntu | ||
+ | kernel images/xubuntu_1110/vmlinuz | ||
+ | append boot=casper netboot=nfs nfsroot=192.168.10.1:/home/e-smith/files/ibays/computer/files/xubuntu_1110 initrd=images/xubuntu_1110/initrd.lz | ||
+ | |||
+ | label Clonezilla-live | ||
+ | MENU LABEL Clonezilla Live (Ramdisk) | ||
+ | KERNEL images/clonezilla/vmlinuz | ||
+ | APPEND initrd=images/clonezilla/initrd.img boot=live username=user union=overlay config components quiet noswap edd=on nomodeset nodmraid locales=en_GB.UTF-8 keyboard-layouts=uk keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch=no net.ifnames=0 nosplash noprompt fetch=tftp://192.168.10.1//images/clonezilla/filesystem.squashfs | ||
+ | |||
+ | label systemrescue | ||
+ | menu label ^System Rescue | ||
+ | kernel images/recovery/systemrescue/rescuecd | ||
+ | initrd images/recovery/systemrescue/initram.igz | ||
+ | append setkmap=us netboot=http://192.168.0.10/iso/sysrescue/sysrcd.dat | ||
+ | |||
+ | label riplinux32 | ||
+ | menu label ^Rescue Is Possible Linux (32-bit kernel) | ||
+ | kernel images/recovery/riplinux/kernel32 | ||
+ | append vga=normal video=640x400 nokeymap initrd=images/recovery/riplinux/rootfs.cgz root=/dev/ram0 rw | ||
+ | |||
+ | label riplinux64 | ||
+ | menu label Rescue ^Is Possible Linux (64-bit kernel) | ||
+ | kernel images/recovery/riplinux/kernel64 | ||
+ | append vga=normal video=640x400 nokeymap initrd=images/recovery/riplinux/rootfs.cgz root=/dev/ram0 rw | ||
+ | |||
+ | LABEL - | ||
+ | MENU LABEL SeaTools for DOS V2.23 (Seagate/Maxtor) | ||
+ | TEXT HELP | ||
+ | GUI version. Test PATA/IDE/SATA drives by instructing the drive to run its | ||
+ | built-in Drive Self Test (DST) and give either a pass or fail status. | ||
+ | ENDTEXT | ||
+ | #COM32 linux.c32 memdisk | ||
+ | kernel images/memdisk | ||
+ | INITRD images/UBCD/ubcd/images/seatool2.img.gz | ||
+ | |||
+ | label GParted Live | ||
+ | MENU LABEL ^GParted Live | ||
+ | kernel /images/gparted/vmlinuz | ||
+ | append initrd=initrd.img boot=live config components union=overlay username=user noswap noeject ip= vga=788 fetch=http://192.168.10.1/computer/filesystem.squashfs | ||
+ | </pre> | ||
+ | |||
+ | ===Voip Phones=== | ||
+ | |||
+ | You can use tftpd with your Voip phones. | ||
+ | |||
+ | More advanced phones will allow you to choose a directory for your firmware where. More basic phones may not be able to you anything other than the default root directory. | ||
+ | |||
+ | e.g | ||
+ | I have some old Mitel phones use /tftpboot only | ||
+ | I have a number of new Grandstream phones that can load from /tftpboot/some_directory | ||
+ | |||
+ | Most Voip phone scan read a config file based on their MAC address to configure themselves during boot. | ||
+ | This can take a while to set up but is a massive time saver. | ||
+ | |||
+ | ===Related Contribs=== | ||
+ | |||
+ | [[Thinclient|smeserver-thinclient]] | ||
− | + | This can aid with basic tftp setup. | |
− | |||
− | |||
=== Uninstall === | === Uninstall === | ||
Line 106: | Line 303: | ||
If you want to fully clean up, by removing the entries from the configuration database | If you want to fully clean up, by removing the entries from the configuration database | ||
− | config delete | + | config delete tftp |
=== Source === | === Source === |
Latest revision as of 04:57, 15 August 2023
smeserver-tftp-server
Maintainer: Trevor Batley
Description
This contribution adds a tftp server (tftp-server) to your smeserver (primarily used by workstations that are using the pxeboot protocol to retrieve boot images and parameters from the server).
It was produced to support my smeserver-thinclient contrib, but can be used independently.
Requires
- smeserver >= 10.0
- tftp-server >= 0.49
For a lot of linux distros you will need nfs support
You will a /etc/exports line similar to this:
/tftpboot/ *(ro,sync,no_wdelay,insecure_locks,no_root_squash,insecure)
mkdir -p /etc/e-smith/templates-custom/etc/exports/
echo "/tftpboot/ *(ro,sync,no_wdelay,insecure_locks,no_root_squash,insecure)" > /etc/e-smith/templates-custom/etc/exports/30tftp
expand-template /etc/exports
/tftpboot/images/ubunturescue_1104/ *(ro,sync,no_wdelay,insecure_locks,no_root_squash,insecure)
if you have installed smeserver-nfs
Installation
This contrib is held in the smecontribs repository, so the following commands will install on your smeserver.
yum --enablerepo=smecontribs install smeserver-tftp-server
Note: this will download and install the latest tftp-server from the Centos base repository, so if you don't have that repository ebnabled, please use the following command
yum --enablerepo=smecontribs --enablerepo=base install smeserver-tftp-server
The tftp status can be 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 manually from the shell (logged in as root)
config setprop tftp status enabled signal-event smeserver-tftp-server-update
If for any reason the tftp server isn't running, try:
systemctl restart tftp
Defaults
You shouldn't need to play with any parameters (except status). The defaults and allowed values are listed below.
<prop> | default <value> | allowed Values | description |
---|---|---|---|
status | disabled | enabled/disabled | |
access | private | private/public/localhost | |
log | normal | normal/verbose/disabled | equivalent to -v or -vv or none |
user | nobody | nobody/<user> | default to nobody, any valid user id |
privilege | ro | ro/rw | read-only or read-write (rw equivalent to -c) |
timeout | default | default/nnn | timeout value in seconds (default is 900) |
directory | /tftpboot | any directory | |
blksize 1 | Value between 512-65464 | e.g. equivalent to -B [512-65464] | |
refuse 2 | any tftp parameter | e.g. blksize equivalent to -r blksize |
These settings can be set/changed via
config setprop tftp <prop> <value> signal-event smeserver-tftp-server-update
*1 blksize does not have a default entry in the configuration database. It can be added as above or removed via
see Bug 10646 for updated tftp contrib with addition of default setting
config delprop tftp blksize signal-event smeserver-tftp-server-update
*2 refuse does not have a default entry in the configuration database. It can be added as above or removed via
config delprop tftp refuse signal-event smeserver-tftp-server-update
Setup PXE Booting
Some rough notes on setting up PXE booting for linux using syslinux
https://wiki.syslinux.org/wiki/index.php?title=PXELINUX
To use a menu we need a copy of pxelinux.0
From the syslinux wiki link above:
On the TFTP server, create the directory "/tftpboot", and copy "pxelinux.0" (from the Syslinux distribution) and any kernel or initrd images that you want to boot. [5.00+] Also copy "ldlinux.c32" from the Syslinux distribution to the "/tftpboot" directory on the TFTP server. Finally, create the directory "/tftpboot/pxelinux.cfg". The configuration file (equivalent of syslinux.cfg -- see the SYSLINUX FAQ for the options here) will live in this directory.
The actual linux image and any associated files need to be extracted from a source distribution ISO here:
/tftpboot/images/{name_of_distro}
Menus
We can create a menu system with sub menus as well.
Yu will need this from the syslinux ISO:
/tftpboot/com32/vesamenu.c32
You can add a background image like this:
/tftpboot/images/graphics/background.png
Example /tftpboot/pxelinux.cfg/default:
menu title --== SME Linux, PXE Main Menu ==-- menu background graphics/background.png menu tabmsgrow 22 menu cmdlinerow 22 menu endrow 24 menu color title 1;34;49 #eea0a0ff #cc333355 std menu color sel 7;37;40 #ff000000 #bb9999aa all menu color border 30;44 #ffffffff #00000000 std menu color pwdheader 31;47 #eeff1010 #20ffffff std menu color hotkey 35;40 #90ffff00 #00000000 std menu color hotsel 35;40 #90000000 #bb9999aa all menu color timeout_msg 35;40 #90ffffff #00000000 none menu color timeout 31;47 #eeff1010 #00000000 none prompt 0 noescape 1 allowoptions 0 timeout 0 default com32/vesamenu.c32 label linuxmenu menu label ^Linux Boot Disks Menu kernel com32/vesamenu.c32 append pxelinux.cfg/linux_boot_disks label Arch menu label ^Arch Boot Disks Menu kernel com32/vesamenu.c32 append pxelinux.cfg/arch label bootimg menu label ^Other Boot Images kernel com32/vesamenu.c32 append pxelinux.cfg/bootimg
We then need to create separate sub menu configuration files in the same directory. Note the use of NFS is required for some of the setups here.
Sample for /tftpboot/pxelinux.cfg/linux_boot_disks
The symbol ^ as per eg "Back to ^Main" is used to create an underlined shortcut key M in this instance.
menu title --== Linux Boot Images ==-- menu background graphics/background.png menu tabmsgrow 22 menu cmdlinerow 22 menu endrow 24 menu color title 1;34;49 #eea0a0ff #cc333355 std menu color sel 7;37;40 #ff000000 #bb9999aa all menu color border 30;44 #ffffffff #00000000 std menu color pwdheader 31;47 #eeff1010 #20ffffff std menu color hotkey 35;40 #90ffff00 #00000000 std menu color hotsel 35;40 #90000000 #bb9999aa all menu color timeout_msg 35;40 #90ffffff #00000000 none menu color timeout 31;47 #eeff1010 #00000000 none prompt 0 noescape 1 allowoptions 0 timeout 0 default com32/vesamenu.c32 label main menu label Back to ^Main Menu kernel com32/vesamenu.c32 append pxelinux.cfg/default label Mint 12 menu label ^Mint 12 kernel images/mint_12/vmlinuz append boot=casper initrd=images/mint_12/initrd.lz label Debian Mint menu label ^Debian Mint kernel images/debian_mint/vmlinuz append boot=casper netboot=nfs nfsroot=192.168.10.1:/home/e-smith/files/ibays/computer/files/debian_mint initrd=images/debian_mint/initrd.lz label Xubuntu menu label ^Xubuntu kernel images/xubuntu_1110/vmlinuz append boot=casper netboot=nfs nfsroot=192.168.10.1:/home/e-smith/files/ibays/computer/files/xubuntu_1110 initrd=images/xubuntu_1110/initrd.lz label Clonezilla-live MENU LABEL Clonezilla Live (Ramdisk) KERNEL images/clonezilla/vmlinuz APPEND initrd=images/clonezilla/initrd.img boot=live username=user union=overlay config components quiet noswap edd=on nomodeset nodmraid locales=en_GB.UTF-8 keyboard-layouts=uk keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch=no net.ifnames=0 nosplash noprompt fetch=tftp://192.168.10.1//images/clonezilla/filesystem.squashfs label systemrescue menu label ^System Rescue kernel images/recovery/systemrescue/rescuecd initrd images/recovery/systemrescue/initram.igz append setkmap=us netboot=http://192.168.0.10/iso/sysrescue/sysrcd.dat label riplinux32 menu label ^Rescue Is Possible Linux (32-bit kernel) kernel images/recovery/riplinux/kernel32 append vga=normal video=640x400 nokeymap initrd=images/recovery/riplinux/rootfs.cgz root=/dev/ram0 rw label riplinux64 menu label Rescue ^Is Possible Linux (64-bit kernel) kernel images/recovery/riplinux/kernel64 append vga=normal video=640x400 nokeymap initrd=images/recovery/riplinux/rootfs.cgz root=/dev/ram0 rw LABEL - MENU LABEL SeaTools for DOS V2.23 (Seagate/Maxtor) TEXT HELP GUI version. Test PATA/IDE/SATA drives by instructing the drive to run its built-in Drive Self Test (DST) and give either a pass or fail status. ENDTEXT #COM32 linux.c32 memdisk kernel images/memdisk INITRD images/UBCD/ubcd/images/seatool2.img.gz label GParted Live MENU LABEL ^GParted Live kernel /images/gparted/vmlinuz append initrd=initrd.img boot=live config components union=overlay username=user noswap noeject ip= vga=788 fetch=http://192.168.10.1/computer/filesystem.squashfs
Voip Phones
You can use tftpd with your Voip phones.
More advanced phones will allow you to choose a directory for your firmware where. More basic phones may not be able to you anything other than the default root directory.
e.g I have some old Mitel phones use /tftpboot only I have a number of new Grandstream phones that can load from /tftpboot/some_directory
Most Voip phone scan read a config file based on their MAC address to configure themselves during boot. This can take a while to set up but is a massive time saver.
Related Contribs
This can aid with basic tftp setup.
Uninstall
yum remove smeserver-tftp-server tftp-server signal-event post-upgrade ; signal-event reboot
If you want to fully clean up, by removing the entries from the configuration database
config delete tftp
Source
The source for this contrib can be found in the smecontribs CVS on sourceforge.
Bugs
Please raise bugs under the SME-Contribs section in bugzilla and select the smeserver-tftp-server component or use this link .