Dies ist eine alte Version des Dokuments!
TFTP-Server unter CentOS 7.x einrichten
Ein wesentlicher Baustein für unseren Installationsserver ist der TFTP-Server, der die Auslieferung der nötigen Dateien für den PXE-Bootvorgang bereitstellt und ausliefert. Eine genaue Beschreibung zu TFTP findet man auf der gut beschriebenen Wikipedia-Seite.
Installation
TFTP-Server
Als erstes installieren wir uns die für den TFTP-Server notwendigen Pakete via yum.
# yum install syslinux tftp-server -y
Bei Bedarf informieren wir was bei der Installation der einzelnen Pakete im System installiert wurde.
syslinux
# rpm -qil syslinux
Name : syslinux Version : 4.05 Release : 13.el7 Architecture: x86_64 Install Date: Mon 12 Dec 2016 02:42:35 PM CET Group : Applications/System Size : 2419109 License : GPLv2+ Signature : RSA/SHA256, Sun 20 Nov 2016 09:49:35 PM CET, Key ID 24c6a8a7f4a80eb5 Source RPM : syslinux-4.05-13.el7.src.rpm Build Date : Sat 05 Nov 2016 06:42:05 PM CET Build Host : worker1.bsys.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : http://syslinux.zytor.com/wiki/index.php/The_Syslinux_Project Summary : Simple kernel loader which boots from a FAT filesystem Description : SYSLINUX is a suite of bootloaders, currently supporting DOS FAT filesystems, Linux ext2/ext3 filesystems (EXTLINUX), PXE network boots (PXELINUX), or ISO 9660 CD-ROMs (ISOLINUX). /usr/bin/gethostip /usr/bin/isohybrid /usr/bin/memdiskfind /usr/bin/syslinux /usr/share/doc/syslinux-4.05 /usr/share/doc/syslinux-4.05/COPYING /usr/share/doc/syslinux-4.05/CodingStyle.txt /usr/share/doc/syslinux-4.05/NEWS /usr/share/doc/syslinux-4.05/README /usr/share/doc/syslinux-4.05/SubmittingPatches.txt /usr/share/doc/syslinux-4.05/comboot.txt /usr/share/doc/syslinux-4.05/distrib.txt /usr/share/doc/syslinux-4.05/extlinux.txt /usr/share/doc/syslinux-4.05/gpt.txt /usr/share/doc/syslinux-4.05/isolinux.txt /usr/share/doc/syslinux-4.05/keytab-lilo.txt /usr/share/doc/syslinux-4.05/logo /usr/share/doc/syslinux-4.05/logo/syslinux-100.png /usr/share/doc/syslinux-4.05/mboot.txt /usr/share/doc/syslinux-4.05/memdisk.txt /usr/share/doc/syslinux-4.05/menu.txt /usr/share/doc/syslinux-4.05/pxelinux.txt /usr/share/doc/syslinux-4.05/rfc5071.txt /usr/share/doc/syslinux-4.05/sample /usr/share/doc/syslinux-4.05/sample/Makefile /usr/share/doc/syslinux-4.05/sample/m16-640x640-syslinux.jpg /usr/share/doc/syslinux-4.05/sample/sample.msg /usr/share/doc/syslinux-4.05/sample/syslinux_splash.jpg /usr/share/doc/syslinux-4.05/sample/syslogo.lss /usr/share/doc/syslinux-4.05/sample/syslogo.ppm.gz /usr/share/doc/syslinux-4.05/sdi.txt /usr/share/doc/syslinux-4.05/syslinux.txt /usr/share/doc/syslinux-4.05/usbkey.txt /usr/share/man/man1/gethostip.1.gz /usr/share/man/man1/isohybrid.1.gz /usr/share/man/man1/memdiskfind.1.gz /usr/share/man/man1/syslinux.1.gz /usr/share/man/man1/syslinux2ansi.1.gz /usr/share/syslinux /usr/share/syslinux/altmbr.bin /usr/share/syslinux/altmbr_c.bin /usr/share/syslinux/altmbr_f.bin /usr/share/syslinux/cat.c32 /usr/share/syslinux/chain.c32 /usr/share/syslinux/cmd.c32 /usr/share/syslinux/config.c32 /usr/share/syslinux/cpuid.c32 /usr/share/syslinux/cpuidtest.c32 /usr/share/syslinux/diag /usr/share/syslinux/diag/geodsp1s.img.xz /usr/share/syslinux/diag/geodspms.img.xz /usr/share/syslinux/diag/handoff.bin /usr/share/syslinux/disk.c32 /usr/share/syslinux/dmitest.c32 /usr/share/syslinux/dosutil /usr/share/syslinux/dosutil/copybs.com /usr/share/syslinux/dosutil/eltorito.sys /usr/share/syslinux/dosutil/mdiskchk.com /usr/share/syslinux/elf.c32 /usr/share/syslinux/ethersel.c32 /usr/share/syslinux/gfxboot.c32 /usr/share/syslinux/gptmbr.bin /usr/share/syslinux/gptmbr_c.bin /usr/share/syslinux/gptmbr_f.bin /usr/share/syslinux/gpxecmd.c32 /usr/share/syslinux/gpxelinux.0 /usr/share/syslinux/gpxelinuxk.0 /usr/share/syslinux/hdt.c32 /usr/share/syslinux/host.c32 /usr/share/syslinux/ifcpu.c32 /usr/share/syslinux/ifcpu64.c32 /usr/share/syslinux/ifplop.c32 /usr/share/syslinux/int18.com /usr/share/syslinux/isohdpfx.bin /usr/share/syslinux/isohdpfx_c.bin /usr/share/syslinux/isohdpfx_f.bin /usr/share/syslinux/isohdppx.bin /usr/share/syslinux/isohdppx_c.bin /usr/share/syslinux/isohdppx_f.bin /usr/share/syslinux/isolinux-debug.bin /usr/share/syslinux/isolinux.bin /usr/share/syslinux/kbdmap.c32 /usr/share/syslinux/linux.c32 /usr/share/syslinux/ls.c32 /usr/share/syslinux/lua.c32 /usr/share/syslinux/mboot.c32 /usr/share/syslinux/mbr.bin /usr/share/syslinux/mbr_c.bin /usr/share/syslinux/mbr_f.bin /usr/share/syslinux/memdisk /usr/share/syslinux/memdump.com /usr/share/syslinux/meminfo.c32 /usr/share/syslinux/menu.c32 /usr/share/syslinux/pcitest.c32 /usr/share/syslinux/pmload.c32 /usr/share/syslinux/poweroff.com /usr/share/syslinux/pwd.c32 /usr/share/syslinux/pxechain.com /usr/share/syslinux/pxelinux.0 /usr/share/syslinux/reboot.c32 /usr/share/syslinux/rosh.c32 /usr/share/syslinux/sanboot.c32 /usr/share/syslinux/sdi.c32 /usr/share/syslinux/sysdump.c32 /usr/share/syslinux/syslinux.com /usr/share/syslinux/syslinux.exe /usr/share/syslinux/syslinux64.exe /usr/share/syslinux/ver.com /usr/share/syslinux/vesainfo.c32 /usr/share/syslinux/vesamenu.c32 /usr/share/syslinux/vpdtest.c32 /usr/share/syslinux/whichsys.c32 /usr/share/syslinux/zzjson.c32
tftp-server
# rpm -qil tftp-server
Name : tftp-server Version : 5.2 Release : 13.el7 Architecture: x86_64 Install Date: Mon 12 Dec 2016 02:42:02 PM CET Group : System Environment/Daemons Size : 65605 License : BSD Signature : RSA/SHA256, Sun 20 Nov 2016 09:53:09 PM CET, Key ID 24c6a8a7f4a80eb5 Source RPM : tftp-5.2-13.el7.src.rpm Build Date : Sat 05 Nov 2016 04:21:50 PM CET Build Host : worker1.bsys.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : http://www.kernel.org/pub/software/network/tftp/ Summary : The server for the Trivial File Transfer Protocol (TFTP) Description : The Trivial File Transfer Protocol (TFTP) is normally used only for booting diskless workstations. The tftp-server package provides the server for TFTP, which allows users to transfer files to and from a remote machine. TFTP provides very little security, and should not be enabled unless it is expressly needed. /etc/xinetd.d/tftp /usr/lib/systemd/system/tftp.service /usr/lib/systemd/system/tftp.socket /usr/sbin/in.tftpd /usr/share/doc/tftp-server-5.2 /usr/share/doc/tftp-server-5.2/CHANGES /usr/share/doc/tftp-server-5.2/README /usr/share/doc/tftp-server-5.2/README.security /usr/share/man/man8/in.tftpd.8.gz /usr/share/man/man8/tftpd.8.gz /var/lib/tftpboot
TFTP-Client
Zum Testen unserer Konfiguration greifen wir auf das Clientpaket TFTP zurück. So können wir mit einfachen Mitteln leicht überprüfen, ob der Zugriff auf den TFTP-Server und die auch die Datenübertragung funktioniert.
Falls das Paket tftp noch nicht installiert wurde, können wir dies mittels yum ins System einbinden.
# yum install tftp -y
Clientpaket tftp
Auch hier können wir uns wie immer vergewissern, was genau installiert wurde.
# rpm -qil tftp
Name : tftp Version : 5.2 Release : 13.el7 Architecture: x86_64 Install Date: Mon 12 Dec 2016 02:42:44 PM CET Group : Applications/Internet Size : 49294 License : BSD Signature : RSA/SHA256, Sun 20 Nov 2016 09:53:05 PM CET, Key ID 24c6a8a7f4a80eb5 Source RPM : tftp-5.2-13.el7.src.rpm Build Date : Sat 05 Nov 2016 04:21:50 PM CET Build Host : worker1.bsys.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : http://www.kernel.org/pub/software/network/tftp/ Summary : The client for the Trivial File Transfer Protocol (TFTP) Description : The Trivial File Transfer Protocol (TFTP) is normally used only for booting diskless workstations. The tftp package provides the user interface for TFTP, which allows users to transfer files to and from a remote machine. This program and TFTP provide very little security, and should not be enabled unless it is expressly needed. /usr/bin/tftp /usr/share/doc/tftp-5.2 /usr/share/doc/tftp-5.2/CHANGES /usr/share/doc/tftp-5.2/README /usr/share/doc/tftp-5.2/README.security /usr/share/man/man1/tftp.1.gz
Konfiguration
Paketfilter/Firewall
Damit unsere Besucher Verbindungen zu den geöffneten Ports http/80 UND https/443 unseres Apache-Webserver aufbauen können müssen wir für diese noch Änderungen am Paketfilter firewalld vornehmen.
Unter CentOS 7 wird als Standard-Firewall die dynamische firewalld verwendet. Ein großer Vorteil der dynamischen Paketfilterregeln ist unter anderem, dass zur Aktivierung der neuen Firewall-Regel(n) nicht der Daemon durchgestartet werden muss und somit alle aktiven Verbiundungen kurz getrennt werden. Sondern unsere Änderungen können on-the-fly aktiviert oder auch wieder deaktiviert werden.
Mit Hilfe des Programms firewall-cmd legen wir nun eine permanente Regel in der Zone public, dies entspricht in unserem Beispiel das Netzwerk-Interface eth0 mit der IP 10.0.0.70 an. Als Source-IP geben geben wir keine speziellen IP-Adressen an, was entsprechend 0.0.0.0 entspricht. Genug der Vorrede, mit nachfolgendem Befehl werden die beiden Ports 80 und 443 geöffnet.
# firewall-cmd --permanent --zone=public --add-service=tftp
success
Anschließend können wir den Firewall-Daemon einmal durchstarten und anschließend überprüfen, ob die Regeln auch entsprechend unserer Definition, gezogen haben.
# firewall-cmd --reload
success
Anschließend können wir abfragen, welche Dienste in der Zone public geöffnet sind.
# firewall-cmd --zone=public --list-services
tftp dhcpv6-client http ssh
Genauso können wir natürlich mit mit dem Befehl iptables abfragen, ob die Erweiterung unseres Paketfilter aktiv ist.
# iptables -nvL IN_public_allow
Chain IN_public_allow (1 references) pkts bytes target prot opt in out source destination 0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:69 ctstate NEW 6 360 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 ctstate NEW 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 ctstate NEW