Inleiding
In dit document wordt beschreven hoe u bestanden van Cisco-routers en -switches veilig kunt kopiëren naar de lokale Windows/Linux/macOS-pc.
Voorwaarden
Vereisten
Cisco raadt u aan kennis te hebben van de bereikbaarheid van Secure Shell (SSH) naar het apparaat met toegangsrechten op toegangsniveau 15.
Gebruikte componenten
De informatie in dit document is gebaseerd op de volgende software- en hardware-versies:
- Cisco C9300-24P switch met Cisco IOS® 17.3.5
- Windows 10-besturingssysteem
- RedHat Linux OS
De informatie in dit document is gebaseerd op de apparaten in een specifieke laboratoriumomgeving. Alle apparaten die in dit document worden beschreven, hadden een opgeschoonde (standaard)configuratie. Als uw netwerk live is, moet u zorgen dat u de potentiële impact van elke opdracht begrijpt.
Achtergrondinformatie
Het proces voor het veilig kopiëren van de bestanden van Cisco-routers/switches naar lokale Windows/Linux/macOS-pc's zonder de noodzaak van een externe server of software zoals Trivial File Transfer Protocol (TFTP), File Transfer Protocol (FTP), Secure File Transfer Protocol (SFTP) of Secure Copy Protocol (SCP) wordt beschreven in dit document.
Probleem
Soms is het in een beveiligde omgeving moeilijk om naar een TFTP/FTP/SFTP/SCP-server te gaan om bestanden zoals pcap, crashbestanden en Cisco IOS-afbeeldingen van routers en switches naar externe bronnen te kopiëren. Er is een kans dat de firewall de poorten blokkeert die door een van deze eerder genoemde protocollen worden gebruikt tussen bron- en doelapparaten.
Oplossing
Als SCP is ingeschakeld op het Cisco-apparaat, kunt u het bestand van apparaten zonder server of toepassing kopiëren naar uw lokale pc.
Hier is de minimale configuratie die op het apparaat vereist is.
hostname Switch
!
interface GigabitEthernet0/0
ip address 10.197.249.101 255.255.255.0
no shut
!
ip route 0.0.0.0 0.0.0.0 10.197.249.1
!
aaa new-model
!
aaa authentication login default local
aaa authorization exec default local
!
ip domain name cisco.com
!
!--- key used in this example is 1024
!
crypto key generate rsa
!
username cisco privilege 15 secret 5 <redacted>
!
line vty 0 x
transport input ssh
login local
!
ip scp server enable
!--- you can disable the above command after copy is completed
!
end
!--- optional
!
ip ssh time-out 60
ip ssh authentication-retries 5
ip ssh version 2
!
Kopieer de bestanden van de Cisco-router/switch met behulp van deze opdracht op lokale Windows/Mac/Linux:
scp username@<ip_address_of_the_device>:flash:/filename
Windows 10:
C:\Users\mmehtabu.CISCO>cd /
C:\>cd ios
C:\ios>dir
Volume in drive C has no label.
Volume Serial Number is xxxx-yyyy
Directory of C:\ios
05-01-2023 09.32 AM <DIR> .
05-01-2023 09.32 AM <DIR> ..
0 File(s) 0 bytes
2 Dir(s) 163,191,525,376 bytes free
C:\ios> scp cisco@10.197.249.101:flash:/mycap.pcap .
Password:
mycap.pcap 100% 33MB 105.8KB/s 05:19
Connection to 10.197.249.101 closed by remote host.
C:\ios>dir
Volume in drive C has no label.
Volume Serial Number is xxxx-yyyy
Directory of C:\ios
05-01-2023 09.39 AM <DIR> .
05-01-2023 09.39 AM <DIR> ..
05-01-2023 09.40 AM 1,606,582 mycap.pcap
1 File(s) 1,606,582 bytes
2 Dir(s) 163,182,600,192 bytes free
Linux:
[root@root0 ~]# pwd
/root
[root@root ~]# ls -l
total 1
drwxr-xr-x. 2 root root 6 Apr 6 2022 Pictures
[root@root ~]# scp cisco@10.197.249.101:flash:/mycap.pcap .
Password:
flash:/mycap.pcap 100% 45MB 2.9MB/s 00:15
[root@cpnr000 ~]# ls -l
total 1580
-rw-r--r--. 1 root root 1606582 Jan 5 09:47 mycap.pcap
drwxr-xr-x. 2 root root 6 Apr 6 2022 Pictures
De macOS heeft een soortgelijk commando:
scp username@<ip_address_of_the_device>:flash:/filename
Gerelateerde informatie