I am just starting my CCNA training and I am using Cisco Packet tracer for building my labs. One thing I had a bit of a tough time setting up was connecting to a switch via telnet from a computer on the network. This post will go over setting up a very basic lab. It will also include some of the best practices I’ve read about. If there is something you would like to add to my setup please feel free to comment.
Here’s what we are going to build:
- Computer (used to telnet into the Cisco switch)
- Server (Will setup DHCP, tftp and dns)
- Switch – (Will setup IP Address, Create a password for “enable”, create telnet user)
Place items into Packet Tracer
You should be able to place any switch, server or computer but I am using these in my example:
- Cisco 2950T-24 Switch
- Generic Desktop Computer
- Generic Server
Here’s what Cisco Packet Tracer will look like:
Before you do anything it’s always a good idea to come up with an IP address scheme before you do anything. I’ve chosen the:
- 192.168.1.x /24 network
- PC-PT will get an IP from the DHCP server
- Server-PT will be 192.168.1.1
- Switch 2950T-24 will be 192.168.1.254
Let’s rename the devices right now so that we won’t forget the setup:
Now that we have setup the physical devices it’s time to connect them up with cables. All devices will be connected with a copper straight through cable.
- PC-PT will be plugged into FastEthernet 0/1 on switch “s0”
- Server-PT will be plugged into FastEthernet 0/2 on switch “s0”
- Wait about 30-60 seconds all ports should have a green light.
First thing you want to do is setup Server-PT
All the setup will be done in the server config. To get there you need to:
- Double click Server in Packet Tracer
Setting Up IP address for Server-PT
- Click Desktop (top)
- Click IP address
- Click Static
- IP Address – Enter 192.168.1.1
- Subnet Mask – Enter 255.255.255.0
- Gateway – Leave Blank
- DNS Server – Enter 220.127.116.11.1
It should look like this when you are done:
Setting Up DHCP on Server-PT
- Click Config Tab (top)
- Under Services (left) – click DHCP
- Leave “Pool Name alone”
- Default Gateway you can leave alone for now
- DNS Server – Set to 192.168.1.1
- START IP – Set to 192.168.1.10
- Subnet Mask – Set to 255.255.255.0
- TFTP Server – Set to 192.168.1.1
- Click “Add”. This will update the default DHCP config.
When done it should look like this:
Setting Up DNS
- Under Services (left) – click DNS
- Name – Enter “s0” for “switch zero”
- Address – Enter IP for switch 192.168.1.254
- Click “Add” and then save. This will update the DNS server.
When done it should look something like this:
You will need to either restart Computer-PT or do an ipconfig /renew from the command prompt to get an IP address.
Go to Computer-PT and ping 192.168.1.1 – You should get 4 responses.
You now should have a functioning basic network.
How to setup an IP address on a Switch
You might wonder how to setup an IP on a switch since you can’t assign an IP to one of the ports like a router. To do this you will need to give an IP address to the VLAN1. Giving an IP address to a VLAN is almost identical to giving any other item in IOS an IP address. Here’s how to setup an IP on a switch:
Get into Configure Terminal Mode:
- Turn the switch on
- Enter the console
- Type “Enable” to get into Privilage Exec (#) mode
- Type “config t” to enter “configure terminal”
- Notice the terminal window changes from “switch” to “switch(config)”.
Here’s the what it should look like in the terminal after you type “enable”.
Give VLAN1 an IP address:
- Select VLAN interface – Type: “interface vlan1”
- Give VLAN1 an IP address – Type: “ip address 192.168.1.254 255.255.255.0”
- Make sure the state is set to “up” – Type “no shutdown”.
- Type “end”
Here’s what your console should look like:
Setup Name and Passwords for Switch
- To setup name of switch type – “hostname s0”. The name will be effected immediately.
- enable password “Cisco”
- enable Secret CCNA
Setup Terminal Server (Virtual Terminal Lines)
- line vty 0 4
- password “CCENT”
- privilege level 15
- end [enter] <- This line is missing in the screenshot.
Setup Password encryption in the Config
- To enable type: “service Password-Encryption”
Hit “Ctrl+C”. Save Running config to startup config. There are 3 ways of doing the exact same thing:
- wr [enter] OR….
- copy running-config startup-config [enter] OR…
- copy run start [enter]
I used example #1
How to connect to a switch using Telnet
- Open computer PC-PT
- Open command prompt
- type: “Terminal r0” – This will work because you have setup DNS … Otherwise just type in the IP address.
- Enter password. In this example I type “TelnetPassword” because that’s what I earlier in the post.