Install TFTP server on CentOS

August 30th, 2012

root@shimla ~]# rpm -q tftp-server
package tftp-server is not installed
[root@shimla ~]#

[root@shimla ~]# yum install tftp-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror01.th.ifl.net
* elrepo: elrepo.reloumirrors.net
* extras: mirror01.th.ifl.net
* rpmforge: ftp-stud.fht-esslingen.de
* updates: mirror01.th.ifl.net
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package tftp-server.x86_64 0:0.49-2.el5.centos set to be updated
–> Finished Dependency Resolution
[snip]

Installed:
tftp-server.x86_64 0:0.49-2.el5.centos

Complete!
[root@shimla ~]#

check to see if I also need to get xinetd:

[root@shimla ~]# rpm -q xinetd
xinetd-2.3.14-13.el5
[root@shimla ~]#

no I do not.

turn ’em on:
[root@shimla ~]# chkconfig xinetd on
[root@shimla ~]# chkconfig tftp on
[root@shimla ~]#

[root@shimla ~]# chmod 777 /tftpboot
[root@shimla ~]#

[root@shimla ~]# ls -l /tftpboot/
total 0
[root@shimla ~]#

[root@shimla tftpboot]# /sbin/chkconfig –level 345 xinetd on
[root@shimla tftpboot]# /sbin/chkconfig –level 345 tftp on
[root@shimla tftpboot]#

[root@shimla tftpboot]# /sbin/chkconfig –list | grep tftp
tftp:           on
[root@shimla tftpboot]# /sbin/chkconfig –list | grep xinetd
xinetd          0:off   1:off   2:on    3:on    4:on    5:on    6:off
xinetd based services:
[root@shimla tftpboot]#

test (after having placed some Cisco phone boot files in /tftpboot which it requires to download it’s config.  See entry in DHCP server setup here: http://darenmatthews.com/blog/?page_id=1397 )

[root@shimla tftpboot]# tcpdump -i eth0 port bootpc and  port bootps
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
11:54:55.434688 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 00:0c:30:f0:24:f1 (oui Unknown), length: 326
11:54:55.442409 IP 10.10.0.102.bootps > 255.255.255.255.bootpc: BOOTP/DHCP, Reply, length: 300
11:55:13.579211 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 00:0c:30:f0:24:f1 (oui Unknown), length: 326
11:55:13.588479 IP 10.10.0.102.bootps > 255.255.255.255.bootpc: BOOTP/DHCP, Reply, length: 300

4 packets captured
4 packets received by filter
0 packets dropped by kernel
[root@shimla tftpboot]#

listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes

now check for tftp packets:

[root@shimla tftpboot]# tcpdump -i eth0 port tftp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes

0 packets captured
0 packets received by filter
0 packets dropped by kernel
[root@shimla tftpboot]#

NONE seen!  So restart dhcp daemon and check the tftp address in dhcp server options is correct:

[root@shimla tftpboot]# service dhcpd force-reload
Shutting down dhcpd:                                       [  OK  ]
Starting dhcpd:                                            [  OK  ]

check dhcp configuration:

[root@shimla tftpboot]# cat /etc/dhcpd.conf

ddns-update-style interim;
ignore client-updates;

option voip-tftp-servers code 150 = ip-address;
option voip-tftp-servers 10.10.0.102;

subnet 10.10.0.0 netmask 255.255.0.0 {
option routers                  10.10.0.254;
option subnet-mask              255.255.0.0;
option nis-domain               “”;
option domain-name              “”;
option domain-name-servers      10.10.0.254;
option ntp-servers              10.10.0.254;
option tftp-server-name         “10.10.0.102”;
range dynamic-bootp 10.10.0.150 10.10.0.175;
default-lease-time 3600;
max-lease-time 7200;
}
[root@shimla tftpboot]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:30:48:BB:05:02
inet addr:10.10.0.102  Bcast:10.10.255.255  Mask:255.255.0.0
inet6 addr: fe80::230:48ff:febb:502/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:31055 errors:0 dropped:0 overruns:0 frame:0
TX packets:23123 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:23586753 (22.4 MiB)  TX bytes:7850798 (7.4 MiB)

[root@shimla tftpboot]# tcpdump -i eth0 port tftp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
12:08:43.679759 IP 10.10.0.175.51599 > 10.10.0.102.tftp:  31 RRQ “CTLSEP000C30F024F1.tlv” octet
12:08:43.705933 IP 10.10.0.175.51600 > 10.10.0.102.tftp:  32 RRQ “SEP000C30F024F1.cnf.xml” octet
12:08:43.754185 IP 10.10.0.175.51601 > 10.10.0.102.tftp:  27 RRQ “P0S3-08-9-00.loads” octet
12:09:08.307210 IP 10.10.0.175.51157 > 10.10.0.102.tftp:  23 RRQ “SIPDefault.cnf” octet
12:09:08.486613 IP 10.10.0.175.51158 > 10.10.0.102.tftp:  28 RRQ “SIP000C30F024F1.cnf” octet
12:09:11.713650 IP 10.10.0.175.51166 > 10.10.0.102.tftp:  21 RRQ “RINGLIST.DAT” octet
12:09:11.721711 IP 10.10.0.175.51167 > 10.10.0.102.tftp:  21 RRQ “dialplan.xml” octet

7 packets captured
7 packets received by filter
0 packets dropped by kernel
[root@shimla tftpboot]#

Success – and Cisco phone registered to Elastix PBX.

Comments are closed.