The tftp command uploads a file to the TFTP server or downloads a file to the local device.
# Upload a file to the TFTP server or download a file to the local device based on the IPv4 address
tftp [ -a source-ip-address | -i interface-type interface-number ] tftp-server [ public-net | vpn-instance vpn-instance-name ] { get | put } source-filename [ destination-filename ]
# Upload a file to the TFTP server or download a file to the local device based on the IPv6 address
tftp ipv6 [ -a source-ip-address ] tftp-server-ipv6 [ -oi interface-type interface-number ] { get | put } source-filename [ destination-filename ]
Parameter |
Description |
Value |
---|---|---|
-a source-ip-address | Specifies the source IP address for connecting to the TFTP client. You are advised to use the loopback interface IP address. | - |
-i interface-type interface-number | Specifies the source interface used by the TFTP client to set up connections. It consists of the interface type and number. It is recommended that you specify a loopback interface. The IP address configured for this interface is the source IP address for sending packets. If no IP address is configured for the source interface, the TFTP connection cannot be set up. |
- |
-oi interface-type interface-number | Specifies an outbound interface on the local device. |
If the remote host uses an IPv6 address, you must specify the outbound interface on the local device. |
tftp-server | Specifies the IPv4 address or host name for the TFTP server. | The value is a string of 1 to 255 case-insensitive characters without spaces. |
tftp-server-ipv6 | Specifies the IPv6 address of the IPv6 TFTP server. |
The value is a string of 1 to 255 case-insensitive characters without spaces. |
public-net | Specifies the TFTP server on the public network. | - |
vpn-instance vpn-instance-name | Name of the VPN instance where the TFTP server is located. |
The value must be an existing VPN instance name. |
get | Download a file. | - |
put | Upload a file. | - |
source-filename | Specifies the source file name. | The value is a string of 1 to 64 case-insensitive characters without spaces. |
destination-filename | Specifies the destination file name. | The value is a string of 1 to 64 case-insensitive characters without spaces. By default, source and destination file names are the same. |
Usage Scenario
When upgrading the system, you can run the tftp command to upload an important file to the TFTP server or download a system software to the local device.
Precautions
If public-net or vpn-instance is not specified, the FTP client accesses the FTP server in the VPN instance managed by the NMS.
If public-net is specified, the FTP client accesses the FTP server on the public network.
If vpn-instance vpn-instance-name is specified, the FTP client accesses the FTP server in a specified VPN instance.
The file system has a restriction on the number of files in the root directory. Therefore, if more than 50 files exist in the root directory, creating new files in this directory may fail.
# Download file vrpcfg.txt from the root directory of the TFTP server to the local device. The IP address of the TFTP server is 10.1.1.1. Save the downloaded file to the local device as file vrpcfg.bak.
<HUAWEI> tftp 10.1.1.1 get vrpcfg.txt flash:/vrpcfg.bak
# Upload file vrpcfg.txt from the root directory of the storage device to the default directory of the TFTP server. The IP address of the TFTP server is 10.1.1.1. Save file vrpcfg.txt on the TFTP server as file vrpcfg.bak.
<HUAWEI> tftp 10.1.1.1 put flash:/vrpcfg.txt vrpcfg.bak
# Obtain the link local IP address and interface name from the TFTP server.
<HUAWEI> tftp ipv6 FC00::/7 -oi gigabitethernet 0/0/1 get file1 file2 Info: Transfer file in binary mode. Downloading the file from the remote TFTP server. Please wait... 100% TFTP: Downloading the file successfully. 249704 byte(s) received in 10 second(s).