Cisco CCNA Copy TFTP Flash

cisco-ccna-ios-01

What happens if you  need to restore the Cisco IOS to flash memory to replace an original file that has been damaged, or if you want to upgrade the IOS?

No worries—you just download the file from a TFTP host to flash memory by using the “copy tftp flash” command.  This command requires the IP address of the TFTP host and the name of the file you want to download.

But before you begin, make sure that the file you want to place in flash memory is in the default TFTP directory on your host since when you issue the command, TFTP won’t not ask you where the file is.

In many cases, files will end in .bin, and some operating systems like Windows will truncate or hide the file extension.  You will still need to specify this when prompted during the download.

If you don’t have enough room in flash memory to store both copies, or if the flash memory is new and no file has been written to flash memory before, the router will ask to erase the contents of flash memory before writing the new file into flash memory. Make sure you have a copy of the image file somewhere on your TFTP server in case restore becomes necessary.

The full syntax of the command is as follows:

copy tftp:

[[[//location]/directory]/filename] flash-filesystem:[filename]

You can also use ftp versus tftp using the following command:

copy ftp:[[[//[username[:password]@]location]/directory]/filename]

flash-filesystem:[filename]


Cisco CCNA Cisco IOS copy Command

cisco-ccna-ios-02

The above commands are just some of the commands to copy router configuration files from one place to another.  Note the copy startup running and copy tftp running-config commands merge the source file with the running-config it does not perform a complete replacement like the other commands.

To erase the startup-config use the erase startup-config or write erase commands.

Note: In place of tftp, ftp or rcp can be utilized.  Parameters for the respective ftp and rcp qualifiers differ from the tftp parameters.


Cisco CCNA Cisco IOS copy Command Example

cisco-ccna-ios-03

The example on the slide shows how when performing a copy tftp running-config or a copy startup-config running-config the files are merged, not replaced.

Note that s0/0/0 has an ip address configured in the running-config but not on the tftp server but still exists in the running-config after the copy command was issued.  Also, the fa0/0 interface is different in the initial running-config than on the tftp server.  It has been updated in the runing-config after the copy.  Finally, fa0/1 did not have an ip address assigned in the intial running-config but it had one on the tftp server.  The running-config after the copy has the ip address configured on fa0/1.

 

Cisco CCNA Loading the Configuration

cisco-ccna-ios-04

Using the default config register value (0x2102), the router will load the config from NVRAM at startup.  If no configuration is present the router will go into setup mode.  If a different config register value is set (i.e. 0x2142) the startup file, if present, will be ignored and again the router will go into setup mode.


Cisco CCNA show and debug Commands

cisco-ccna-ios-05

Show commands provide a snapshot of information on a router or switch.  For example, interface statistics.

Debug commands are used to check the flow of protocol traffic to resolve problems.

Examples of some show commands:

show ip route – Displays the IP routing table

show running-config – Displays the running (active) configuration file

show startup-config – Displays the configuration file stored in NVRAM

show version – Displays the IOS version the router is running along with other things (i.e. config-register setting)

show ip interface – Displays the usability of interfaced configured for IP

show ip interface brief – Displays a summary of the usability status information for each interface

Examples of some debug commands:

debug ip icmp – Displays information on ICMP transactions

debug ip rip – Displays information on RIP routing transactions

debug ip routing – Displays information on Routing Information Protocol (RIP) routing table and route cache updates

debug ip ssh – Displays debug messages for Secure Shell (SSH)

debug ip ospf packet – Displays information about each Open Shortest Packet First (OSPF) packet received

 

Cisco CCNA Commands Related to debug

cisco-ccna-ios-06

When debugging it is always a good idea to have time synchronized and utilize the time when displaying debug messages  This is accomplished with the following command:

service timesamps debug datetime msec

Debugging can be very CPU intensive.  It is a good idea to monitor CPU utilization when debugging.  This is accomplished with the following command:

show processes

In order to disable all active debugging with a single command, use the following:

no debug all                      or                     undebug all

By default debug messages go to the console.  If you are remotely accessing the router via a vty line you will need to perform the following command in order to view the debug messages:

terminal monitor


Cisco CCNA Backing up the configuration

cisco-ccna-ios-07

To copy the router’s configuration from a router to a TFTP host, you can use either the “copy running-config tftp” or the “copy startup-config tftp” command.

Either one will back up the router configuration that’s currently running in DRAM, or that’s stored in NVRAM.  Note: In order to save off the most current configuration, make sure the startup file matches the running configuration if you plan on utilizing the “copy startup-config tftp” command.

If you’ve changed your router’s running-config and want to restore the configuration to the version in startup-config, the easiest way to do this is to use the “copy startup-config running-config” command (“copy start run” for short).

Note: When you copy or paste a configuration into RAM, the interfaces are shutdown by default.  This is especially important if you are configuring the router for the first time, and will be shipping it out to a location where you will not have access to it unless the interface is up.  To prevent this, insert “no shutdown” commands under each interface needed to at least obtain access to the device.


Cisco CCNA  Fallback

cisco-ccna-ios-08

Cisco routers, by default, load the IOS from Flash memory.  However, what happens if the flash memory fails or the file in flash memory becomes corrupted?

By default, the Cisco routers will look for a TFTP server to load an IOS from, and if that fails, some routers, depending on the model, will load a mini-ios from ROM so that an IOS can be restored into flash memory.

Command syntax and parameter descriptions:

boot system flash [flash-fs:] [partition-number:] [filename]

flash-fs: (Optional) Flash file system containing the system image to load at startup. The colon is required.

partition-number: (Optional) Number of the flash memory partition that contains the system image to boot, specified by the optional filename argument. If you do not specify a filename, the router loads the first valid file in the specified partition of flash memory. This argument is only valid on routers that can be partitioned.

filename (Optional when used with the boot system flash command) Name of the system image to load at startup. This argument is case sensitive. If you do not specify a filename, the router loads the first valid file.

Command syntax is similar for boot system tftp and boot system rom commands.


Cisco CCNA ROM Monitor Mode

cisco-ccna-ios-09

In the above example, the router was rebooted and the ctrl-break key stroke was pressed, which took the router into ROM monitor mode.

You would do this to provide password recovery by changing the configuration register to 0x2142, as shown above.

When you have completed the password recovery, set the configuration register back to 0x2102 for normal operation.The default for a router is t

o look in flash memory for the IOS, NVRAM for the startup-config

If this fails, the default is to look in flash, then look for a TFTP server on a network, then run a mini-ios from ROM.

If all this fails, then the router will load ROM monitor mode.


Cisco CCNA Auto-Install

cisco-ccna-ios-10

The auto-install “feature” is annoying at best.  If a router is powered up, has no configuration and sees Carrier Detect on an interface, it will look for an IP address by using ARP on a LAN and/or SLARP (Serial Line ARP) on a serial interface.

You can disable this feature with the “no service config” command and the “no boot network” command from global configuration mode.