This article explains the required configuration while performing transfer-on-commit feature using SFTP.
Transfer-on-commit is a Junos feature that is used to configure the router or switch to transfer its currently active configuration to an archive site each time you commit a candidate configuration.
Statement / feature was introduced in Junos OS Release 9.0 for EX Series switches.Statement / feature was introduced in Junos OS Release 11.1 for the QFX Series.
You can configure the device to transfer its active configuration by FTP, HTTP, secure copy (SCP), or SFTP periodically or after each commit.
While we configure using SFTP, we might see that the transfer fails with the below log messages:
Nov 22 11:04:59 EX-1 logger: transfer-file failed to transfer /var/transfer/config/EX-1_20231122_110449_juniper.conf.gz rc 255Nov 22 11:04:59 EX-1 pfed: ACCT_TRANSFER_FILE_FAILED_ITER: Error <65280> uploading file '/var/transfer/config/EX-1_20231122_110449_juniper.conf.gz'. Remaining retry attempts = 2, retry in 295 seconds...
Below is the basic configuration example for transfer-on-commit using the service SFTP.
system { archival { configuration { transfer-on-commit; archive-sites { "sftp://username@host<:port>/url-path;"" password "<password>"; ## SECRET-DATA } } } }
The transfer might fail using the below configuration with the following log message on the switch:
Nov 22 11:04:59 EX-1 logger: transfer-file failed to transfer /var/transfer/config/EX-1_20231122_110449_juniper.conf.gz rc 255
Nov 22 11:04:59 EX-1 pfed: ACCT_TRANSFER_FILE_FAILED_ITER: Error <65280> uploading file '/var/transfer/config/EX-1_20231122_110449_juniper.conf.gz'. Remaining retry attempts = 2, retry in 295 seconds...
user@host# set security ssh-known-hosts fetch-from-server <SFTP-SERVER-IP>
If issue persists even after configuring the SSH host keys then raise a case with JTAC for further investigations.
https://www.juniper.net/documentation/en_US/junos/topics/reference/configuration-statement/transfer-on-commit-edit-system.html https://www.juniper.net/documentation/us/en/software/junos/cli/topics/task/junos-software-system-management-router-configuration-archiving.html#id-10944516