upgrade rom-monitor file ?
- to upgrade bootstrap issue the above command in privileged mode (#)
copy tftp flash:
- to copy new .bin image to flash
sh boot
TFTP on Ubuntu 16.10
TFTP is used where user authentication and directory visibility are not required.
TFTP uses -- > UDP port 69 ( lighter than TCP based FTP )
TFTP is described formally in RFC 1350.
Light and simple design >> the
protocol of choice for the initial stages of any network booting
strategy ( i.e.: PXE; bootp; firmware transfer; config files transfer >> network devices - switches, routers and
firewalls. )
Most typically is TFTP used to transfer firmware images to network devices for upgrade or recovery purposes.
How to install & run TFTP server on Ubuntu 16.10
tftpd-hpa -- > an enhanced version of the BSD TFTP
client and server. Lot of bugfixes plus enhancements
over the original tftpd.
All commands impersonate root:
sudo su
Next we need to update the apt source list and install the tftpd-hpa daemon from the repositories:
|
sudo apt install tftpd-hpa
|
Configure TFTP defaults
Now we need to create the default settings that the TFTP daemon will
use when the service is started. To do this we need to edit the
/etc/default/tftpd-hpa file:
|
sudo nano /etc/default/tftpd-hpa
|
Add the following to the file:
|
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure --create --verbose "
|
Where:
- TFTP_USERNAME: Specify the username which tftpd will run as. The default is “nobody”.
- TFTP_DIRECTORY: Specify the root directory where files will be served from. The default is /var/lib/tftp
- TFTP_ADDRESS: Specify a specific address and port to listen on. The
default is to listen to the TFTP port specified in /etc/services on all
local addresses.
- TFTP_OPTIONS: Specify any additional options to run the daemon with, in this case we used the following:
- –secure: Change root directory on startup. This means the remote
host does not need to pass along the directory as part of the transfer,
and may add security. The use of this option is recommended for security
as well as compatibility with some boot ROMs which cannot be easily
made to include a directory name in its request.
- –create: Allow new files to be created. By default, tftpd will only allow upload of files that already exist.
|
# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure --create"
|
Create the directory structure
Next we can create the directory structure for our network device
images, in this case I will be creating a directory for Cisco and
juniper devices and creating sub directories for IOS, IOSXR and NXOS.
Under the IOS directory will create further sub directories for each
specific model of router/switch on the network.
|
mkdir /srv/tftpboot/
cd /srv/tftpboot/
|
Next we need to set the user, group and file permissions for the /srv/tftpboot directory and its sub directories:
|
chmod 777 -R /srv/tftpboot/
chown tftp:nogroup -R /srv/tftpboot/
|
Before we test TFTP we need to restart the TFTP daemon so that the configuration changes made above are implemented:
|
service tftpd-hpa restart
|
Sample output of restarting the tftpd-hpa daemon:
|
|
C2811 w/PVDM+DSP;VIC3 w/ FXS-DID; VWIC-2MFT-T1E1 | |
|
sudo apt-get install tftp
|
Next I created a test file on the TFTP server that we will download
to our test server, the test file is a list of directories in the root
folder of the TFTP server:
|
cd /srv/tftpboot
ls / > test
|
Now from our test server we will connect to our new TFTP server and download (GET) the test file we just created:
1
2
3
4
5
6
7
8
9
10
11
12
|
jonathanm@GNS3:~$ tftp 172.16.57.10
tftp> get test
Received 166 bytes in 0.0 seconds
tftp> quit
jonathanm@GNS3:~$ ls | grep test
test
jonathanm@GNS3:~$
jonathanm@GNS3:~$ cat test
bin
boot
dev
...
|
Perfect everything is working correctly, if you are having problems
check you firewall rules,on both the TFTP server and the TFTP client to
make sure the traffic is allowed through.