How to set a password on a Cisco device in Packet Tracer
To set a password on a Cisco device in Packet Tracer, you connect to the device through the command-line interface, enter configuration mode, and assign a password to the console port or virtual terminal lines. The steps differ slightly depending on whether you want to protect console access (the physical port) or remote access (SSH or Telnet). Most setups require both: a console password for anyone with physical access to the device, and a line password for anyone connecting remotely.
Packet Tracer is a network simulation tool made by Cisco that lets you practice configuring real Cisco commands without owning the hardware. The passwords you set in Packet Tracer work the same way they do on actual Cisco routers and switches, so learning here transfers directly to the devices you will encounter in the field or in a job.
Key Takeaways
- Console passwords protect the physical port on a Cisco device; you set them by entering line console 0 mode and typing the password command.
- Virtual terminal (vty) passwords protect remote access via Telnet or SSH; you set them by entering line vty 0 4 mode and assigning a password.
- You must enter global configuration mode (config t) before you can set any line password.
- After setting a password, you must type exit to leave configuration mode, then the device will prompt you for the password the next time you try to access that line.
- Packet Tracer shows password prompts in the same way real Cisco devices do, so practicing here builds muscle memory for actual network work.
Accessing the command line on your Cisco device
Open Packet Tracer and create or open a network topology that includes a Cisco router or switch. Click on the device to select it. A window will open showing the device's interface. At the bottom of that window, find the CLI tab and click it. You will see a command prompt that looks like Router> or Switch> depending on the device type.
This prompt means you are in user mode, which is read-only. You cannot change settings from here. To set a password, you must move to privileged mode by typing enable and pressing Enter. If the device has no enable password set yet, it will let you in without asking for one. The prompt will change to Router# or Switch#, showing you are now in privileged mode.
Entering global configuration mode
From the privileged mode prompt (the one ending in #), type configure terminal or the shorter form config t and press Enter. The prompt will change to Router(config)# or Switch(config)#. This is global configuration mode, where you can change settings that affect the entire device.
Everything you type in this mode is a command that changes how the device behaves. If you type something wrong, the device will tell you it is an invalid command. You can type ? at any time to see a list of commands available at that prompt. This is useful when you are learning and cannot remember the exact syntax.
Setting a console password
The console port is the physical serial or USB port on the back of a Cisco device. Anyone who can plug a cable into that port can try to access the device. To protect it, you set a console password. From the config prompt, type line console 0 and press Enter. The prompt will change to Router(config-line)#.
Now type password followed by the password you want to set. For example, password cisco123. Press Enter. Then type login and press Enter. The login command tells the device to actually ask for the password when someone tries to access the console. Without it, the password is set but never checked. Type exit to leave line console mode and return to the config prompt.
Setting a virtual terminal password for remote access
Virtual terminal lines (vty) are the ports that allow remote access to the device via Telnet or SSH. A Cisco router or switch typically has five vty lines numbered 0 through 4. To set a password that protects all of them at once, type line vty 0 4 from the config prompt and press Enter. The prompt will change to Router(config-line)#.
Type password followed by your password. For example, password remote456. Press Enter. Then type login to enable the password check. Type exit to return to the config prompt. Now anyone trying to Telnet or SSH into the device will be asked for this password.
Saving your configuration
Everything you have typed so far exists only in the device's running configuration, which is stored in memory. If you close Packet Tracer or the device loses power, these changes will be lost. To save them permanently, you must write the running configuration to the startup configuration. Type exit to leave global configuration mode and return to the privileged prompt (the one ending in #).
Then type write memory or the shorter form wr mem and press Enter. You will see a message confirming that the configuration has been saved. In some versions of Packet Tracer, you can also use copy running-config startup-config. Both commands do the same thing.
Testing your passwords in Packet Tracer
To test that your console password works, type exit at the privileged prompt to log out. The prompt will return to Router> or Switch>. Now type enable again. If you have set an enable password (a separate password that protects privileged mode itself), you will be asked for it. If not, you will enter privileged mode without a prompt.
To test the vty password, you would normally open a second device in your topology and try to Telnet to the first one. In Packet Tracer, you can simulate this by right-clicking on the device and selecting a Telnet or SSH option if available in your version. When you try to connect, the device will ask for the vty password you set. Type it in and press Enter. If it matches, you will be allowed in.
Common mistakes and how to fix them
The most common mistake is setting a password but forgetting to type login afterward. The password will be stored, but the device will never ask for it, so anyone can access that line without entering anything. If this happens, go back into line console 0 or line vty 0 4 mode and type login.
Another mistake is forgetting to type exit after setting the password, which leaves you stuck in line configuration mode. You will see the config-line prompt and cannot access other configuration commands. straightforward type exit to return to the config prompt. A third issue is setting a password and then closing Packet Tracer without saving. Always type write memory or copy running-config startup-config before you close the program if you want the password to persist the next time you open the topology.
Frequently Asked Questions
What is the difference between a console password and a vty password?
A console password protects the physical serial or USB port on the device. A vty password protects remote access via Telnet or SSH over a network. You can set both on the same device. Someone with physical access needs the console password; someone connecting remotely needs the vty password.
Do I need to set an enable password too?
An enable password is separate from console and vty passwords. It protects entry into privileged mode (the # prompt). You can set it by typing enable password yourpassword in global configuration mode. Many setups use all three: console, vty, and enable passwords for layered security.
What happens if I forget the password I set?
In Packet Tracer, you can close the topology without saving and reopen it to reset the device to its original state. On a real Cisco device, you would need to perform a password recovery procedure, which is more complex. This is one reason Packet Tracer is useful for practice — you can make mistakes and start over without consequences.
Can I set different passwords for different vty lines?
Yes. Instead of typing line vty 0 4, you can type line vty 0 to set a password for just the first vty line, or line vty 1 2 to set a password for lines 1 and 2. However, most setups use the same password for all vty lines for simplicity.
Why does Packet Tracer ask for a password even though I did not set one?
This usually means the device came with a default password already configured, or your topology file includes pre-configured settings. Check the topology documentation or try common defaults like cisco or password. You can also delete the device and add a fresh one to start with a blank configuration.