キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 
cancel
89079
閲覧回数
17
いいね!
0
コメント
Ryota Takao
Cisco Employee
Cisco Employee

 

 

はじめに

本ドキュメントでは IOS、IOS-XE での TFTP、FTP、SCP を使用したファイル転送方法について説明します。



前提条件

このドキュメントでは以下の構成で FTP/TFTP/SCP 等を使いファイルを IOS/IOS-XE が動作する機器に移動させる前提で説明をさせて頂きます。

ios_iosxe_copy_01.png

IOS/IOS-XE Device の設定:

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/0 192.168.1.254
Router(config)#interface GigabitEthernet0/0/0 Router(config-if)#ip address 192.168.1.1 255.255.255.0 Router(config-if)#no shutdown Router(config-if)#end Router#

コピー&ペースト用:

configure terminal
ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/0 192.168.1.254 interface GigabitEthernet0/0/0 ip address 192.168.1.1 255.255.255.0 no shutdown end

*ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/0 192.168.1.254 の設定はこの構成であれば 192.168.1.1 と 192.168.1.254 は同じネットワークなので不要ですが、PC が同じネットワークに存在しない場合もあるため Default Route を設定しています。

転送ファイルについて:
このドキュメントでは転送に使用するファイルに test.txt を使用しています。
test.txt の部分については転送するファイル名に合わせて変更してください。

 

TFTP

TFTP でのファイル転送時には必要に応じて IOS/IOS-XE Device に以下の設定を行ってください。
どちらも必須の設定ではありません。

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ip tftp source-interface GigabitEthernet0/0/0
Router(config)#ip tftp blocksize 8192
Router#

ip tftp source-interface { interface }:
TFTP に使用される source-interface を指定しています。該当 interface で vrf を使用していなければ不要です。

ip tftp blocksize { blocksize }:
TFTP の blocksize を指定しています。最大の 8192 にすることで転送速度が速くなります。
一部の Windows Application 等では blocksize 8192 などの大きな blocksize をサポートしていないものもあるので注意してください。

コピー&ペースト用:

configure terminal
ip tftp source-interface GigabitEthernet0/0/0
ip tftp blocksize 8192 end



Download:
TFTP Server から IOS/IOS-XE Device へのファイル転送は以下のように行います。

Router#copy tftp: flash:
Address or name of remote host []? 192.168.1.254
Source filename []? test.txt
Destination filename [test.txt]?


Upload:
IOS/IOS-XE Device から TFTP Server へのファイル転送は以下のように行います。

Router#copy flash: tftp:
Source filename []? test.txt
Address or name of remote host []? 192.168.1.254
Destination filename [test.txt]?



FTP

FTP でのファイル転送時には必要に応じて IOS/IOS-XE Device に以下の設定を行ってください。

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ip ftp source-interface GigabitEthernet0/0/0

ip ftp source-interface { interface } の設定は FTP に使用される source interface を指定する設定です。
vrf を該当 interface で使用していなければ設定は不要です。

コピー&ペースト用:

configure terminal
ip ftp source-interface GigabitEthernet0/0/0
end



Download:
FTP Server から IOS/IOS-XE Device へのファイル転送は以下のように行います。

Router#copy ftp://ftp_username:ftp_password@192.168.1.254/test.txt flash:
Destination filename [test.txt]?

ftp_username、ftp_password については正しい FTP の username/password に置き換えてください。


Upload:
IOS/IOS-XE Device から FTP Server へのファイル転送は以下のように行います。

Router#copy flash:test.txt ftp://ftp_username:ftp_password@192.168.1.254/
Address or name of remote host [192.168.1.254]?
Destination filename [test.txt]?

ftp_username、ftp_password については正しい FTP の username/password に置き換えてください。


SCP

SCP でのファイル転送時には IOS/IOS-XE Device に以下のような設定を行ってください。

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ip scp server enable
Router(config)#hostname R1
R1(config)#ip domain-name cisco.com
R1(config)#crypto key generate rsa
Choose the size of the key modulus in the range of 360 to 4096 for your
General Purpose Keys. Choosing a key modulus greater than 512 may take
a few minutes.

How many bits in the modulus [512]: 1024
% Generating 1024 bit RSA keys, keys will be non-exportable...
[OK] (elapsed time was 0 seconds)

R1(config)# ip ssh source-interface GigabitEthernet0/0/0
R1(config)#
R1(config)#username admin privilege 15 password admin R1(config)#line vty 0 15 R1(config-line)#transport input all R1(config-line)#login local R1(config-line)#end

ip scp server enable:
SCP Server 機能を有効にします。

hostname { hostname }:
crypto key generate rsa にて RSA key ペアを生成するために hostname を設定します。

ip domain-name { domain-name }:
crypto key generate rsa にて RSA key ペアを生成するために hostname を設定します。

crypto key generate rsa:
RSA key ペアを生成します。key size には 1024 or 2048 が使われることが多いです。

ip ssh source-interface { interface }:
ssh/scp の source-interface を指定します。
vrf を該当 interface で使用していなければ設定は不要です。

username { username } privilege 15 password { password }:
SCP を行うために username、password を設定します。

transport input { all | telnet | ssh }:
指定した access 方法を許可します。例では all を使用していますが security policy によって all の部分は ssh 等に変更してください。

login local:
Local 認証を使用することを指定しています。

コピー&ペースト用:

configure terminal
ip scp server enable
hostname R1
ip domain-name cisco.com
username admin privilege 15 password admin
line vty 0 15
 transport input all
 login local
 end

crypto key generate rsa については prompt に応答する必要があるので別途実行してください。


Download:
PC から IOS/IOS-XE Device へのファイル転送は以下のように行います。

Router#copy scp://ssh_username:ssh_password@192.168.1.254//test.txt bootflash:test.txt
Destination filename [test.txt]?
 Sending file modes: C0644 4037 test.txt

ssh_username、ssh_password については正しい SSH の username/password に置き換えてください。

Upload:
IOS/IOS-XE Device から PC へのファイル転送は以下のように行います。

Router#copy bootflash:test.txt scp://ssh_username:ssh_password@192.168.1.254//test.txt
Address or name of remote host [10.70.78.1]?
Destination username [ssh_username]?
Destination filename [/test.txt]?
Writing /home/tftpboot/test.txt  Sink: C0644 2441 test.txt

ssh_username、ssh_password については正しい SSH の username/password に置き換えてください。

Windows PC から IOS/IOS-XE Device へのファイル転送は以下のように行います。

Windows terminal
> scp test.txt admin@192.168.1.1:/test.txt


macOS から IOS/IOS-XE Device へのファイル転送は以下のように行います。

macOS terminal
$ scp test.txt admin@192.168.1.1:/test.txt

 

Getting Started

検索バーにキーワード、フレーズ、または質問を入力し、お探しのものを見つけましょう

シスコ コミュニティをいち早く使いこなしていただけるよう役立つリンクをまとめました。みなさんのジャーニーがより良いものとなるようお手伝いします