Diferència entre revisions de la pàgina «A4. Transferència d'arxius»
m (Alex ha mogut UF2-NF1. Transferència d'arxius a A4. Transferència d'arxius) |
(→Reiniciar configuració) |
||
Línia 21: | Línia 21: | ||
La configuració inicial es troba a la memòria nvram, només cal esborrar-la. | La configuració inicial es troba a la memòria nvram, només cal esborrar-la. | ||
− | <pre> | + | <html><pre><code class="cisco"> |
+ | Router#dir nvram: | ||
+ | Directory of nvram:/ | ||
+ | |||
+ | 238 -rw- 578 <no date> startup-config | ||
+ | |||
+ | 578 bytes total (237588 bytes free) | ||
+ | |||
+ | Router#erase startup-config | ||
+ | Erasing the nvram filesystem will remove all configuration files! Continue? [confirm] | ||
+ | [OK] | ||
+ | Erase of nvram: complete | ||
+ | %SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram | ||
+ | Router#dir nvram: | ||
+ | Directory of nvram:/ | ||
+ | |||
+ | No files in directory | ||
+ | |||
+ | Router# | ||
+ | Router#reload | ||
+ | Proceed with reload? [confirm] | ||
+ | |||
+ | |||
+ | Router#delete nvram:startup-config | ||
+ | Delete filename [startup-config]? | ||
+ | Delete nvram:startup-config? [confirm] | ||
+ | [OK] | ||
+ | Router# | ||
+ | Router# | ||
+ | Router#reload | ||
+ | Proceed with reload? [confirm] | ||
+ | </code></pre></html> | ||
+ | |||
+ | |||
+ | També es pot fer servir l'ordre '''delete''' indicant la memòria on s'ubica l'arxiu | ||
+ | |||
+ | <html><pre><code class="cisco"> | ||
Router#delete nvram:startup-config | Router#delete nvram:startup-config | ||
Delete filename [startup-config]? | Delete filename [startup-config]? | ||
Línia 30: | Línia 66: | ||
Router#reload | Router#reload | ||
Proceed with reload? [confirm] | Proceed with reload? [confirm] | ||
− | </pre> | + | </code></pre></html> |
=== Configurar el servidor TFTP a Ubuntu === | === Configurar el servidor TFTP a Ubuntu === |
Revisió del 20:45, 18 gen 2025
torna M7 - Planificació i administració de xarxes
Contingut
Transferència d'arxius
Per transferir arxius entre els dispositius (CISCO) i un ordinador es fa servir el protocol TFTP. Aquest és un protocol lleuger, semblant al FTP que funciona sobre el port 69 UDP.
Les principals utilitats són:
- Guardar / Restaurar la configuració
- Actualitzar IOS
- Guardar / Restaurar IOS (Sistema Operatiu)
Els exemples es basen en el IOS d'un CISCO de la sèrie 1700 (Router).
Reiniciar configuració
La configuració inicial es troba a la memòria nvram, només cal esborrar-la.
Router#dir nvram:
Directory of nvram:/
238 -rw- 578 startup-config
578 bytes total (237588 bytes free)
Router#erase startup-config
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete
%SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram
Router#dir nvram:
Directory of nvram:/
No files in directory
Router#
Router#reload
Proceed with reload? [confirm]
Router#delete nvram:startup-config
Delete filename [startup-config]?
Delete nvram:startup-config? [confirm]
[OK]
Router#
Router#
Router#reload
Proceed with reload? [confirm]
També es pot fer servir l'ordre delete indicant la memòria on s'ubica l'arxiu
Router#delete nvram:startup-config
Delete filename [startup-config]?
Delete nvram:startup-config? [confirm]
[OK]
Router#
Router#
Router#reload
Proceed with reload? [confirm]
Configurar el servidor TFTP a Ubuntu
http://www.davidsudjiman.info/2006/03/27/installing-and-setting-tftpd-in-ubuntu/
Es pot comprovar si funciona fent
$netstat -l -udp (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address StatePID/Program name udp 0 0 *:59450 *:*- udp 0 0 *:bootpc *:*- udp 0 0 *:tftp *:*- udp 0 0 *:mdns *:*-
Guardar / Restaurar configuració.
Configurar IP de la mateixa xarxa que el servidor TFTP
Router(config)#interface FastEthernet 0 Router(config-if)#ip address 192.168.2.7 255.255.255.0 Router(config-if)#no shut Router(config-if)#no shutdown Router(config-if)#exit Router(config)#exit Router#show ip interface brief Interface IP-Address OK? Method Status Prol FastEthernet0 192.168.2.7 YES manual up up
Per guardar la configuració
Router#copy running-config tftp Address or name of remote host []? 192.168.2.40 Destination filename [router-confg]? running-config .!! 1453 bytes copied in 8.332 secs (174 bytes/sec)
Per restaurar la configuració (Cal que el fitxer de configuració estigui a la carpeta del tftp, amb permisos suficients 777)
Router#copy tftp running-config Address or name of remote host [192.168.2.40]? Source filename [running-config]? Destination filename [running-config]? Accessing tftp://192.168.2.40/running-config... Loading running-config from 192.168.2.40 (via FastEthernet0): ! [OK - 1453 bytes] 1453 bytes copied in 10.468 secs (139 bytes/sec) Router#
Guardar IOS.
El IOS es guarda en la part de la memòria del Router anomenada FLASH
Router#dir flash: Directory of flash:/ 1 -rw- 13672808 <no date> c1700.bin 33292284 bytes total (19619412 bytes free) Router#copy flash: tftp Router#copy flash: tftp: Router#copy flash: tftp Source filename []? ?File name not specified %Error parsing filename (No such file or directory) Router#dir flash: Directory of flash:/ 1 -rw- 13672808 <no date> c1700.bin 33292284 bytes total (19619412 bytes free) Router#copy flash: tftp Source filename []? c1700.bin Address or name of remote host []? 192.168.2.40 Destination filename [c1700.bin]? !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 13672808 bytes copied in 60.828 secs (224778 bytes/sec)
Mode Monitor
El mode monitor de ROM és un estat en que arrenca el router si no disposa de IOS o existeix algun error que no permet carregar-lo (s'ha cancel·lat la càrrega d'aquest per exemple).
Aquest mode té un conjunt senzill de comandes que permeten recuperar el IOS, establir comunicacions TFTP o canviar el registre del router i restablir contrasenyes per exemple.
Es pot forçar entrar en mode monitor enviant CTRL + BREAK durant la càrrega inicial (CTRL + SHIFT + BREAK + C, al Packet Tracer 5.3).
rommon 1>dir flash:
Configurar comunicació TFTP
/* Aquesta és l’adreça que s’assignarà a la interfase del router */ rommon 1> IP_ADDRESS=192.168.1.2 rommon 2> IP_SUBNET_MASK=255.255.255.0 /* Aquesta és la informació del servidor TFTP */ rommon 3> DEFAULT_GATEWAY=192.168.1.10 rommon 4> TFTP_SERVER=192.168.1.10 rommon 5> TFTP_FILE=c1700-y-mz.122-2.XJ.BIN /* Executa la descàrrega i reinicia*/ rommon 6> tftpdnld rommon 7> reset
Restaurar contrasenya
Cal modificar el registre del Router (normalment en valors 0x2102 o 0x10) per desactivar la càrrega de la configuració a l'inici ( 0x2142)
rommon 1> confreg 0x2142 rommon 2> reset
Modifica l’arxiu de configuració com has realitzat a les activitats anteriors i torna a posar el valor del registre inicial. Guarda els canvis en la configuració a l’arxiu de configuració inicial
router1# config-register 0x2102 router1# copy running-config startup-config
Restaurar contrasenya (Switch)
En els switchs 2950 Series es pot entrar mode switch: presionant "mode" mentre s'encèn
switch: flash_init switch: load_helper switch: delete flash:config.text switch: boot
(Això no està disponible des del Packet Tracer)
Carregar imatge IOS (Switch)
La càrrega en aquest cas s'ha de fer per la connexió de consola i és molt lenta
switch: flash_init switch: load_helper switch: copy xmodem: flash:c2955-i6q4l2-mz.121-13.EA1.bin Begin the Xmodem or Xmodem-1K transfer now... CCCCCCC......................................................................... ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ............................................................................. File "xmodem:" successfully copied to "flash:c2955-i6q4l2-mz.121-13.EA1.bin" !--- If the Xmodem file transfer fails for some reason, restart the process. !--- If the Xmodem file transfer is successful, you return to the !--- switch: prompt. switch: switch: boot flash:c2955-i6q4l2-mz.121-13.EA1.bin
(Això no està disponible des del Packet Tracer)