Installing and Configuring Linux TFTP

Posted by: on January 8th, 2012 | Categories: Linux | Tags: ,

TFTP or Trivial File Transfer Protocol is way in which you can save the configurations of your network devices such as Routers, Switches and Firewalls over the network to a server. This can be very helpful if you have to role back your configurations, or in case of a network device failure that requires you to buy a new replacement for it. You can imagine how hard it is to insert all the configurations line by line from the back of your head, its impossible!

Having a TFTP server in your organization can save you a lot of time and effort and most importantly, it will decrease your downtime in some cases from days to just few minutes.

Today I will show step-by-step how to install and configure a TFTP Server using RedHat or CentOS Linux.

1- Check if you have the tftp-server installed first, usually tftp-server rpm package is not installed with the base or Linux default installation.

[root@myserver /]# rpm -q tftp-server
package tftp-server is not installed

2- If its not installed, then install it using yum.

[root@myserver /]# yum -y install tftp-server

3- Notice that during the installation it will also install the xinetd package. xinetd is the actual service that runs the TFTP, once its installed, then you need to enable the service to run and accept file transfers, you need to change the “disable” option =no in the /etc/xinetd.d/tftp file.

[root@myserver /]# nano /etc/xinetd.d/tftp

4- change the disable = no and then save the file.

NOTE:
In CentOS the files will be transferred under /var/lib/tftpboot/, however, in Redhat Linux it will be transferred under /tftpboot from the root

5- Now you’ve installed and configured the TFTP correctly, you need to start the xinetd service and make sure it starts at boot

[root@myserver /]# service xinetd start
Starting sshd:                                      [  OK  ]
[root@myserver /]# chkconfig xinetd on

6- TFTP does not create new files under /tftpboot if they do not exist, so you have to create a file for each network host manually and assign the right permissions so it can be over written every time you save your configurations from your device to the tftp.

[root@myserver /]# cd /var/lib/tftpboot
[root@myserver tftpboot]# touch router-hostname
[root@myserver tftpboot]# chmod 666 router-hostname

Tips:
1- Its a good idea to name these files with the device hostname to avoid and confusion when it comes to restoring it.
2- name the file with hostname_mmddyy if you want to keep a new version each time you make changes on your configurations.


The following is an example that shows you how to save you configurations from a Cisco router to a TFTP server:

TORONTO-RTR01# copy running-config tftp
Address or name of remote host []? 192.168.10.245
Destination filename [running-confg]? TORONTO-RTR01
!!!!
1030 bytes copied in 2.489 secs (395 bytes/sec)

Here is how to restore it from the tftp to your router:

TORNOTO-RTR01# copy tftp running-config
Address or name of remote host []? 192.168.10.245
Source filename []? TORONTO-RTR01
Destination filename [running-config]?
Accessing tftp://192.168.10.245/TORONTO-RTR01
Loading TORONTO-RTR01 from 192.168.10.245 (via FastEthernet0/0): !
[OK - 1030 bytes]
1030 bytes copied in 9.612 secs (107 bytes/sec)

Note that every vendor have a different command syntax, please see the command reference manual provided by your device vendor.

 


Print Friendly

No comments yet.
You must be logged in to post a comment.