Uploading files into the Cisco Switch or Router by using TFTP

Uploading files to a Cisco Switch or Router by using TFTP

The files are uploaded into the Cisco switch or router by using TFTP servers, instead of using SCP

I)TFTP Configuration in Ubuntu

1)Install TFTP by using this command

sudo apt update; sudo apt install tftp-hpa tftpd-hpa

2)Configure TFTP by, Edit the Following Configuration File

/etc/default/tftpd-hpa like below mentioned,

TFTP_USERNAME=”tftp”

TFTP_DIRECTORY=”/var/lib/tftpboot”

TFTP_ADDRESS=”:69″

TFTP_OPTIONS=”–secure”

3)Navigate to /var/lib/tftpboot directory(cd /var/lib/tftpboot)

4)Inside this directory, we can create the directories for incoming and outgoing files with the name of which names are hard to guess and avoid common names, these directories are created by using mktemp -d command

i)For incoming directory create a directory with 700 Permission with owned by TFTP mode. sudo chown tftp:tftp $(sudo mktemp -d XXXX –suffix=-incoming)

ii)For outgoing directory create a directory with 755 Permission and with owned by root mode. sudo chmod 755 $(sudo mktemp -d XXXX—suffix=-outgoing)

4)The tftpd-hpa should configured for allowing create new files by adding “–create” in /etc/default/tftpd-hpa file,

TFTP_OPTIONS=”–secure –create”

5)Finally, restart the tftp by service tftpd-hpa restart,we can check tftp status by service tftpd-hpa status

II)Copying From TFTP to Flash in cisco switch or Router

1)Log into the Device

2)Issue copy tftp flash command and it prompts and asks TFTP Server’s IP, after it prompts for Source file name, after this prompts and asks for destination file, then press enter

Switch# copy tftp Directory name (Ex.copy ftp flash)

remote host: 10.X.X.X

source filename: XXXX

destination filename: XXXX

Note:

For this scenario, the FireWall Should be Configured to allow TFTP in Port 69, if you are Configured TFTP in Virtual Machine running on any other private or public cloud Environment the Server’s security Group Should be Configured to allow TFTP in Port 69.

Leave a Reply

Your email address will not be published. Required fields are marked *