SSH
Synchronized Transcript
133 cues indexed • Click dialogue or words to jumpWelcome to Jeremy's IT Lab this is a free complete course for the CCNA if you like these videos please subscribe to follow along with the series also please like and leave a comment and share the video to help spread this free series of videos thanks for your help in this video.
We will cover SSH secure secure shell SSH is a protocol used to connect to devices and configure them via the CLI one option to connect to a device and and configure it is via the console Port which I introduced in an early video of this course however SSH allows you to connect.
To a device remotely without being directly connected to its console Port SSH is exam topic 4.8 which says You must be able to configure network devices for remote access using SSH I won't just cover SSH in this video though I will take the opportunity to introduce.
Some other important Concepts here's what will in this video first console Port Security in the last video about CIS log I mentioned the console line and the vty lines.
So I want to take the opportunity to explain more about the console line and how you can make it more secure then I'll explain the management IP address on layer 2 switches don't route switches layer 2 switches don't route packets and don't build a routing table however you can configure.
A management IP address on them so that you can remotely connect to to them via SSH then I will introduce Telnet which is a protocol similar to SSH but it's simpler and less secure.
Finally the main topic of the video SSH a lot of topics to cover but the first few topics shouldn't take too long to go through as always.
Watch until the end for a bonus practice question from Bon software xim the best practice exams for the CCNA.
First console Port security by default no password is needed to access the CLI of a Cisco IOS device via the console Port you can take a new device out of the box use a console cable to connect your laptop to it.
And then start configuring it in the CLI however you can configure a password on the console line the console line is where you configure all settings related to console Port connections.
When you do this a user will have to enter a password to access the CLI via the console port let's get right into the configurations to configure the console line use the command line console 0 from Global config mode there is only a single console line.
So the number is always zero what does it mean to have only a single console line it means there can only be a single console connection at once you can't have multiple people configuring the device at the same time via separate console ports only one user can connect at a time then the password.
Is password followed by the password but configuring a password isn't enough you have to use the login command which tells the device to require a user to enter the password to access the CLI via the console Port.
That's it now a password will be required to access the console port to demonstrate I used end and exit to terminate the console connection then I pressed enter to connect again and I was asked for a password I entered the password of CCNA and I was able to.
Connect note that the password isn't displayed as you type it so the password can't be seen by anyone nearby alternatively you can configure the console line to require users to log in using one of the configured usernames on the device.
This is different than the previous example in which we configured a specific password just for the console line so here are the configurations.
First I created a username Jeremy and gave it a secret password of CCNP I once again used line console 0 to configure the console line then I used the command login local this tells the device to require a user to log in using one of the configured usernames on.
The device so instead of logging in using the password configured on the console line the user will have to use a username and password by the way.
Here's the current configuration of r1's console line notice that the password of CCNA that I configured previously is still there however I Chang the login mode from login to login local.
So the console lines password of CCNA can no longer be used the user must log in using an account on the device so I logged out of the connection pressed enter and as you can.
See I was asked for a username and password not just a password okay I want to show you one more command that is the exec timeout command this will cause the device to log the user out after a certain period of inactivity 3 minutes and 30 seconds in this case.
This is a good security practice in case you leave your desk but forget to log out of the console connection okay that's all for console line security.
Now let's move on to Remote Management of devices routers and layer 3 switches have IP addresses you can use to connect remotely to manage the devices.
But what about layer 2 switches layer 2 switches don't perform packet routing and don't build a routing table they aren't IP routing aware their purpose is simply to forward frames in the LAN as you already know however you can actually assign an IP address to an svi a switch virtual.
Interface to allow remote connections to the CLI of the switch for example using Telnet or SSH for the rest of this video I'll use this network topology the network admin is using PC2 and needs to to be able to connect to all of the devices in the network to configure.
Them without having to travel to different offices to allow this the layer 2 switches need an IP address so here's how you can configure it first configure the IP address on the svi in the same way as on a multi-layer switch interface VLAN followed.
By the VLAN ID then configure the IP address finally enable the interface if it's shut down by default so the svi is configured however there's one more step you need to configure to allow a layer 2 switch to communicate with devices outside of its local LAN.
Use the IP default gateway command to configure the default gateway of the switch PC2 isn't in the same LAN so switch one can't send Network traffic directly to PC2 it has to send the traffic to a router which will then route the packets to their destination.
It's like configuring a default route however layer 2 switches don't have a routing table so you have to use this command to specify the default gateway instead.
Okay that's all the configuration needed for a layer 2 switches management IP to demonstrate Telnet and SSH I'll continue configuring switch switch one.
First up tnet it's not commonly used today due to a lack of security but it's good to know before looking at SSH tnet teletype network is a protocol used to remotely access the CLI of a remote remote host.
So instead of plugging your PC directly into the device with a console cable you can connect to the device on a remote remote Network Telnet was developed in 1969.
So it's a very old protocol it has been largely almost entirely replaced by SSH which is more secure however SSH was developed in 1995.
So Telnet had many years of use Telnet sends data in plain text no encryption so if someone uses a tool like wi shark to capture the traffic they can read exactly what was sent.
Let me demonstrate up top is a Telnet packet sent from R1 inside it says password this is the password prompt the CLI displays.
When trying to log in I entered the password and it was sent in a packet to R1 but the password is displayed in plain text CCNP no encryption.
So anyone in the middle who is able to capture the traffic like I did here will be able to read all of the traffic between my device and R1 the username the password and all of the traffic after that that is definitely not secure and.
That's why SSH is used instead of tnet before moving on to tnet configuration I want to point out one more thing the Telnet server.
That's the device being connected to R1 in this case listen for tet traffic on TCP Port 23 so when my device sent the password to R1 the destination Port was TCP Port 23 as always make sure you.
Remember that port number and by the way the tnet client is the device that is connecting and as I just said the Telnet server is the device that is being connected to.
Here's how to configure a device so that you can use Telnet to connect to it first you should always configure an enable secret but if you haven't make sure you do you won't be able to access privileged exec mode.
When connecting via Telnet if an enable secret isn't configured I also configured a username and password since I will later configure login local mode this isn't necessary.
But you can configure an ACL to limit which devices can connect to the vty lines of the device and then use the command line vty 015 Telnet and SSH access is configured on the vty lines There are 16 lines available.
So up to 16 users can be connected at once line vty 015 means you are configuring all lines from 0 through 15.
This is recommended so all of the vty lines have the same configuration by the way vty stands for virtual virtual teletype.
Okay first I configured login local as well as exec timeout I think the default exec timeout depends on the device in this case it was 10 minutes.
But I shortened it to 5 minutes okay next I use the command transport input tnet this is how you configure what kind of connections to the vti lines are allowed transport input Telnet allows only tnet connections you could also configure.
Transport input SSH to allow only SSH connections or transport input tnet sh to allow to allow both transport input all allows all connections there are some other protocols aside from tnet and SSH or you can configure transport input none to allow.
No connections to the vty lines the device I'm using for this demo defaults to transport input none but I think many devices default to transport input input all.
Finally I applied the ACL to the vty lines this means that only PC2 will be able to connect to switch one using Telnet note that this applies only to vty line connections other devices will still be able to communicate with switch one send it pings Etc as a reminder.
Although the command to apply the ACL to the VT lines is access class the command to apply an ACL to an interface is IP access group and the command to actually create the ACL is access list or IP access list try not.
To confuse those commands access class IP access group and access list or IP access list to verify the configuration I.
First tried to Ping switch one from R2 the Ping was successful however when I tried to tell net to switch one I got a message saying connection refused by remote host.
That's because of the ACL I applied to switch one's vty lines only PC2 should be able to tell net to switch one so I did tnet from PC2 and it worked.
Now one last thing I want to point out is this notice how the VT Y Line configurations are displayed in the running config of the device the first five lines are displayed above and the remaining 11 are below I believe.
This is just a result of the fact that old versions of IOS only had five VT lines so even if you configure all 16 lines at once they display separately in the config.
That's just a bit of trivia it doesn't have any effect on the operation of the of the lines so that was a quick look at Telnet finally.
Let's go to the main topic of the video SSH SSH which stands for secure shell was developed in 1995 to replace less secure protocols like Telnet by the way.
If you're wondering what a shell is here's Wikipedia's definition a shell is a computer program which exposes the operating system services to a human user or other program.
So anytime you're accessing the CLI of a device that is a shell SSH version 2 a major revision of SSH version one was released in 2006 version two is more secure.
So it should be used whenever possible if a device supports both version one and version two it is said to run version 1.99 note that 1.99 isn't actually a version of SSH it just means that the device supports both version one and version version.
Two SSH provides security features such as data encryption and authentication you'll learn more about those terms in the security section of the course.
But for example here's an SSH packet that I captured in wi Shark look at the encrypted packet section it's just a seemingly random string of characters only the SSH server and client have the keys to decrypt this packet.
So even though I captured the packet on the way to its destination I don't know what the contents are by the way SSH uses TCP Port 22.
So remember that Telnet uses TCP 23 and SSH uses TCP 22 before configuring SSH you should make sure that the version of IOS on your device supports it I used the show version command and.
Here's the IOS image name note the K9 at the end that I highlighted IOS images that support SSH will have K9 in their name Cisco exports NP no payload encryption IOS images to countries that have restrictions on encryption.
Technologies and those NP IOS images do not support cryptographic features like SSH weak forms of encryption might be supported but I would have to do more research on that to find out unfortunately I don't have access to any NP IOS images.
Another command to use is show IP SSH if your device doesn't support SSH it will tell you here in this case SSH is supported.
But disabled notice the version is 1.99 meaning it supports both versions 1 and two now here's a hint about the first step in configuring SSH please create RSA keys to enable SSH RSA keys are cryptographic keys that are essential.
For the various security features of SSH okay so after ensuring that the IOS image you're using supports SSH you must generate those RSA Keys the keys are used for data encryption and decryption authentication Etc.
Here's how to do that first I configured the domain name of switch one with IP domain name Jeremy it.com the reason for.
This is that the fqdn of the device is used to name the RSA RSA keys by the way fqdn means fully qualified domain name which is the host name plus the DNS domain name then I generated the RSA Keys the command is crypto.
Key generate RSA here it shows the name of the keys switch 1. Jeremy it.com which is the fqdn of switch 1 then you have to choose the size of the modulus the size of the keys I configured 248 bits as I have highlighted.
Here note that you can just use the command crypto key generate RSA modulus and then specify the length without having to specify it separately like this the effect is the same note that the length must be 768 bits or greater to use SS version 2.
So make sure the keys are at least that length greater key lengths are more secure but take longer to generate enus after the keys are generated a CIS log message is displayed indicating that SSH has been enabled I check.
Show IP SSH again and indeed SSH has been enabled now that SSH is enabled let's configure it the Telnet configurations on switch one have been removed.
So let's do a clean configuration of SSH first just like before I configured the enable secret a username and an ACL to restrict connections to only allow PC2 then I use the command IP P SSH version 2.
This is optional but recommended because SSH version 2 is more more secure then once again use the command line vty 015 to configure all 16 vty lines just like.
When configuring Telnet then enable local authentication note that you can't use login for SSH only login local Works a username is needed you can also authenticate to an authentication server.
But that's a top for another video then since I removed the Telnet configurations I configured the exec timeout again this is optional.
Because there will most likely be a default exact timeout but you can use this command to specify the timeout you want then I used transport input SSH best practice is to limit vty line connections to SSH only disabling tnet.
Because it's less secure then finally I applied the ACL just like for Telnet this is optional but it is recommended because it adds further security.
Okay let me summarize the SSH configuration process first configure the device host name I didn't mention this previously because I had already configured the host name.
But the device cannot generate its RSA keys without a non-default host name let me show you so on a rer with a default host name I tried the crypto key generate RSA command command I get a message saying please define a host name other than router.
So I did that then I tried to generate the RSA key pair again however I haven't defined a domain name yet so I get a message telling me to do.
So and that's the next step in SSH configuration configure a DNS domain name so that's what I did IP domain name gitlab.com then I try to generate the RSA key pair and the command works command works.
So remember that to generate the RSA key pair you need to configure the host name and the domain name first actually you can manually specify a name for the key pair.
But for the CCNA you just have to know this method so that's the next step generate the key pair then the next step is to configure an enable password and local username and password combination the order of this step doesn't matter and it's not an SSH specific configuration.
Step but make sure they are configured then enable SSH version 2 only this isn't necessary but it is best practice so I decided to include it in this this summary then configure the vty lines the most important one is to make sure transport input.
SSH is enabled and then you can do any other VT line configurations you want like exec timeout applying an ACL Etc and.
That's it SSH should be working from a PC you can connect using the command SSH hyphen L followed by the username and IP address or SSH username at IP address you can try that out in the practice lab and make sure you do the practice.
Lab you can make your own lab or use my lab file but you need to know how to configure SSH so make sure you practice it here's a summary of the new commands in this video like I said you'll definitely want to do some labbing in Packet Tracer.
To get used to SSH configuration unlike CIS log and SNMP SSH configuration is a CCNA exam topic if you don't remember the purpose of any of these commands go back in the video to to review before the quiz.
Here's a review of what we covered first console Port security by default anyone who has physical access to the console Port can access the CLI of the device.
So it's a good idea to configure some security on it then I introduce the concept of a layer 2 switch management IP layer 2 switches can't rote packets.
But they can still send traffic from and receive traffic on an svi allowing them to respond to pings receive connections via SSH SSH Etc then I introduced Telnet a protocol that allows you to connect to the CLI of a device however Telnet is old and not secure.
So in modern days we typically use SSH secure shell instead when we remotely configured configured devices be sure to watch until the end of the quiz for a bonus practice question from Bon software xim the best practice exams for the CCNA.
Okay let's go to question one you issue the Crypt key generate RSA command on a Cisco router but the command is rejected which of the the following might be the cause select two pause the video.
Now to think about the answers the answers are a a host name hasn't been configured and e a DNS domain name hasn't been configured the fqdn fully qualified domain name of the device is used to name the RSA key pair the fqdn consists.
Of the device's host name and its domain name also the default host name of router cannot be used a host name must be manually be manually configured.
Okay let's go to question two which of the following commands would allow both Telnet and SSH to be used to connect to the vty lines of a device select two each answer is a complete complete solution pause the video.
Now to think about your answers the answers are C transport input Telnet SSH and D transport input all c will allow Telnet and SSH whereas D will allow some other protocols as you can.
See there are protocols outside of Telnet and SSH that are are supported a transport input default isn't a real command and B Transport input none would allow no protocols.
Okay let's go to question three you want to allow only 192.168.1.1 to connect to R1 via SSH which of the following configurations fulfills that requirement pause the video.
Now to think about the answer is B SSH uses TCP Port 22 you must configure the vty lines and you must use the access class command to apply it to the vty lines only B fulfills.
All of the requirements so it is the correct answer okay let's go to question question four which of the following statements about SSH are true select two pause the video.
Now to think about the answers the answers are B K9 IOS images support SSH and f a key length of at least 768 bits is required for SSH version version 2 RSA keys are required to enable SSH.
So a is incorrect SSH version 1.99 isn't an actual SSH version it is used to refer to a device that supports both versions 1 and two.
So C is incorrect SSH does not send data in plain text it encrypts the data so D is incorrect and NP IOS images do not support cryptographic features like SSH.
So e is incorrect okay let's go to question five a network admin using pc1 is remotely configuring switch one by connecting to the CLI of switch 1 via SSH what is the role of switch one in this situation.
Pause the video now to think about the answer the answer is B SSH server SSH and Telnet use a client server model in which the device being connected to switch one in this case is the server and the device using SSH or Telnet to connect.
Pc1 in this case is the client okay that's all for the quiz now let's do a bonus practice question from bos on software's xim for CCNA.
Okay here's today's Bon xim practice question you want to configure SSH for incoming vty connections on a router with the host name router 1 router 1 is running a k9 IOS image.
But has not yet been configured with a domain name or an RSA key pair in addition the vti lines are not yet configured to accept incoming SSH connections you issue the crypto key generate RSA command from Global configuration mode which of the following messages will you most.
Likely receive select the best answer okay so there are five options uh please pause the video now check out the options and think about the correct answer.
Okay let's check so the important information here is that it has a host name the host name is router 1 uh it does have a k9 IOS image.
So that supports supports SSH but it has not yet been configured with a domain name or an RSA key pair so no domain name yet.
So which message will you most likely receive uh the name for the keys will be and then the name uh probably not this one uh.
Because as I said the name for the key pair is created using the fully qualified domain name which requires a host name and a domain name and the domain name has not yet been configured uh B please define a domain name.
First I think that is the correct answer because as I just said you need a host name and a domain name it has a host name a non-default host name router one.
But no domain name yet uh C please create RSA keys to enable SSH well that's what you're trying to do there so I don't think that message will be displayed please define a host name other than router it already has a non-default host name and please enable SSH version.
2 uh you do not need SSH version to to create the RSA key pair so I believe B is the correct answer and yes it is.
So here is Ban's explanation I recommend pausing the video now to read it and.
Here's the rest there are some references to the official sear guide by Wendel odm as well as some Cisco documentation about uh configuring SSH on Cisco devices.
Okay so that's bosan XM for CCNA these are without a doubt the best practice exams for the CCNA as well as CCNP and many other exams.
If you want to get B on xim please follow Link in the video description there are supplementary materials for this video there is a flashcard deck to use with a software eny there will also be a Packet Tracer practice lab.
So you can get some Hands-On practice that will be in the next video sign up for my mailing list via the link in the description and I'll send you all of the flash cards and Packet Tracer lab files for the course before finishing today's video I I want to thank.
My jcmp level channel members to join please click the join button under the video thank you to Raj Kenneth Sheamus HW Brandon samil aarin Marcel Cony Donald seim mode Gustavo Anthony barage junhong Benjamin tapiso Justin prash Nasir erison.
Marco daming gilmar Ed value John funny dart velv jacum Mark yusf B on software Devin Leto yonathan and Vance sorry if I pronounce name incorrectly.
But thank you so much for your support this is the list of jcmp level members at the time of recording by the way February 21st 2021.
If you signed up recently and your name isn't on here don't worry you'll be in future videos thank you for watching please subscribe to the channel like the video leave a comment and share the video with anyone else studying for the CCNA.
If you want to leave a tip check the links in the description I'm also a brave verified publisher and accept bat or basic attention token tips via the brave browser.
That's all for now.