VIRL 上の Cisco プラットフォームへ SSH ログイン出来るように設定してみます。検証環境での利用を想定しています。商用環境で利用する場合は、よりセキュリティに配慮する必要があります。
各 OS バージョン
各プラットフォームの OS バージョンは以下の通りです。
No | プラットフォーム | OS バージョン |
---|---|---|
1 | IOSv | IOSv Software (VIOS-ADVENTERPRISEK9-M), Version 15.5(2)T |
2 | XRv | Cisco IOS XR Software, Version 5.3.0 |
3 | CSR1000v | CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 15.5(1)S |
4 | NX-OSv | version 7.2(0)D1(1) [build 7.2(0)ZD(0.120)] |
5 | ASAv | Cisco Adaptive Security Appliance Software Version 9.3(2)200 |
IOSv
設定は以下の通りです。
hostname IOSV-1
ip domain-name EXAMPLE.LOCAL
!
aaa new-model
username USER password PASSWORD
!
ip ssh version 2
!
interface GigabitEthernet0/1
ip address 192.168.1.1 255.255.255.0
no shutdown
!
access-list 1 permit 192.168.1.0 0.0.0.255
!
line vty 0 4
access-class 1 in
transport input ssh
!
crypto key generate rsa modulus 2048
!
end
XRv
設定の前に Enable モードで鍵を生成しておきます。
# crypto key generate rsa
Wed Jul 15 23:34:55.692 UTC
The name for the keys will be: the_default
Choose the size of the key modulus in the range of 512 to 4096 for your General Purpose Keypair. Choosing a key modulus greater than 512 may take a few minutes.
How many bits in the modulus [1024]: 2048
Generating RSA keys ...
Done w/ crypto generate keypair
[OK]
設定は以下の通りです。
username USER password 7 PASSWORD
!
ipv4 access-list PERMIT-SSH 10 permit ipv4 192.168.1.0 0.0.0.255 any
!
interface GigabitEthernet0/0/0/0
ipv4 address 192.168.1.2 255.255.255.0
no shutdown
!
ssh server v2
ssh server vrf default ipv4 access-list PERMIT-SSH
!
end
CSR1000v
設定は以下の通りです。基本的に IOSv と同じです。
hostname CSR1000V-1
ip domain-name EXAMPLE.LOCAL
!
aaa new-model
username USER password PASSWORD
!
ip ssh version 2
!
interface GigabitEthernet2
ip address 192.168.1.3 255.255.255.0
no shutdown
!
access-list 1 permit 192.168.1.0 0.0.0.255
!
line vty 0 4
access-class 1 in
transport input ssh
!
crypto key generate rsa modulus 2048
!
end
NX-OSv
設定は以下の通りです。
hostname NX-OSV-1
ip domain-name EXAMPLE.LOCAL
!
username USER password PASSWORD
!
ssh key rsa 2048 force
!
interface Ethernet2/1
no switchport
mac-address 0000.0000.002f
ip address 192.168.1.4/24
no shutdown
!
ip access-list PERMIT-SSH 10 permit tcp 192.168.1.0/24 any eq 22
!
line vty
access-class PERMIT-SSH in
!
end
デフォルトで SSH サーバが有効化されていますので、明示的に SSH サーバを有効化する必要はありません。
# show ssh server
ssh version 2 is enabled
もし、SSH サーバが無効化されており、有効化する必要がある場合は feature コマンドを使います。
NX-OSV-1# configure terminal
NX-OSV-1(config)# feature ssh
ASAv
設定は以下の通りです。
hostname ASAV-1
domain-name EXAMPLE.LOCAL
!
username USER password PASSWORD
!
interface GigabitEthernet0/0
nameif inside
security-level 100
ip address 192.168.1.5 255.255.255.0
no shutdown
!
crypto key generate rsa modulus 2048
!
aaa authentication ssh console LOCAL
ssh 192.168.1.0 255.255.255.0 inside
ssh version 2
!
end
鍵を生成する際は対話的な入力を求められるので要注意です。
ASAV-1(config-if)# crypto key generate rsa modulus 2048
WARNING: You have a RSA keypair already defined named <Default-RSA-Key>.
Do you really want to replace them? [yes/no]: yes
Keypair generation process begin. Please wait...
コメント