Welcome 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 FTP, File Transfer Protocol, and TFTP, Trivial File Transfer Protocol. As the names suggest, both of these protocols are used to transfer files over a network. They are exam topic 4.9, which states that you must be able to describe the capabilities and function of TFTP and FTP in the network. So, make sure you understand the purpose of these protocols, and make sure you know the differences between them, even though their purposes are similar. Here’s what we’ll cover in this video. First up, I’ll introduce the purpose of FTP and TFTP. The names tell you what their basic purpose is, but I’ll give a brief overview. Then we’ll compare the two protocols to learn about their functions and how they are different. Then I’ll introduce the various file systems on Cisco IOS. A basic understanding of how files are stored on Cisco devices is important. Finally, we’ll take a look at how to use FTP and TFTP in Cisco IOS. As always, watch until the end of the video for a bonus practice question from Boson Software’s ExSim for CCNA, the best practice exams for the CCNA. Here’s a quick summary of FTP and TFTP. FTP, which stands for File Transfer Protocol, and TFTP, which stands for Trivial File Transfer Protocol, are both industry standard protocols used to transfer files over a network. They both use a client-server model. Clients can use FTP or TFTP to copy files from an FTP or TFTP server. They can also use FTP or TFTP to copy files to a server. As a network engineer, the most common use for FTP and TFTP is in the process of upgrading the operating system of a network device. You can use FTP or TFTP on the device to download the newer version of IOS and then reboot the device with the new IOS image. This is, of course, not the only use for these protocols. They can be used to transfer all kinds of files between different devices over a network. But for this video, we’ll use this example. So, here’s a sample network. I haven’t included any cables or anything, we don’t need any details. So, on the left is a server at software.cisco.com. The network admin will download the new IOS image from Cisco. Then he will transfer the IOS image to a server that is reachable by the device he is going to update, which in this example is R1 on the right. Finally, the network admin will use commands in the CLI of R1 to copy the file into the flash memory of R1. The last step after that is to reboot R1 using the new version of IOS. So, later in this video I’ll show you how to use the CLI of a Cisco device to transfer files using FTP and TFTP, and then how to reboot the device with the new IOS image to update it. Okay, now let’s move on to talk about TFTP, the Trivial File Transfer Protocol. TFTP was first standardized in 1981. This is after FTP, but because TFTP is simpler I want to introduce it first. It was named the ‘trivial’ file transfer protocol because it is simple and has only basic features when compared to FTP. It only allows a client to copy a file to or from a server. Nothing else, just simple file transfers. As I said, it was released after FTP, but it’s not a replacement for FTP. It is just another tool to use when a lightweight, simple protocol is more important than advanced functionality. TFTP doesn’t use any authentication, meaning no usernames and passwords, so servers will respond to all TFTP requests. There’s no username or password to check. Also, there is no encryption so all data is sent in plain text. Because of this lack of security, TFTP is best used in a controlled environment to transfer small files quickly. You probably shouldn’t use it to transfer important files over the Internet, for example. TFTP servers listen on UDP port 69. So, when clients initiate communications with the server, they will use UDP port 69 as the destination port. As you already know, UDP is connectionless and doesn’t provide reliability using retransmissions. However, TFTP actually has similar built-in connection and reliability features within the TFTP protocol itself. Let’s take a look. First I’ll introduce how TFTP provides reliability using acknowledgments and retransmissions. Every TFTP data message is acknowledged. So, if the client is transferring a file to the server, the server will send Ack messages, one for each data message. However, if the server is transferring a file to the client, then the client will send Ack messages, one for each data message from the server. Timers are used, and if an expected message isn’t received in time, the waiting device will re-send its previous message. Let me demonstrate. The PC on the right is a TFTP client, and the server on the left is a TFTP server. To download a file from the server, the client sends a ‘read request’ message. The server then replies with a data message, containing part of the file. The client replies with an Ack, but for some reason the message doesn’t reach the server. Because the client sent the Ack, it is waiting for the next data message, but it doesn’t come. So, the client retransmits the Ack message, which successfully reaches the server. The server then replies with the next data message, and the client replies with an Ack. This exchange will continue until the client has received the entire file. This is called ‘lock-step’ communication. The client and server alternately send a message and then wait for a reply, send a message, wait for a reply, etc. The server will never send two data messages in a row, for example, except in the case of retransmission. So, this method of reliability isn’t as efficient as TCP’s forward acknowledgment and sliding window, but it gets the job done. Next, let me introduce TFTP’s connections. TFTP file transfers have three phases. First, the connection phase. The client sends a request to the server, and the server responds back, initializing the connection. Then the data transfer occurs, and data and acknowledgment messages are exchanged. After the last data message a final Ack message is sent, terminating the connection. Let me demonstrate. So, the client sends a request, and the server replies by sending the first data packet. The connection is officially established. The client responds with an Ack, and there is an exchange of data packets and Acks. These messages, including the first data packet, are the data transfer portion of the file transfer. Finally, the client sends an Ack for the last data packet, and the connection is terminated. So, although TFTP doesn’t use TCP, it does have a basic way of managing connections within the protocol itself. Now I’m going to introduce an interesting part of TFTP’s operation. This isn’t something you have to know for the CCNA exam, I just thought it was interesting so I’m going to share it briefly. As expected, when the client sends the first message to the server, the destination port is UDP port 69 and the source is a random ephemeral port. In TFTP this random port is called a ‘Transfer Identifier’, TID, and is used to identify that particular data transfer. However, here’s where the functionality is different than you might expect. The server then also selects a random TID to use as the source port when it replies. It doesn’t use port 69 as the source port. Then, when the client sends the next message, the destination port will be the server’s TID, again not 69. So, I’ll demonstrate how that works. The client sends a message to the server with a random source port and a destination port of 69. When the server replies, instead of using 69 as the source port it also uses a random port. Then the client replies, and uses that random port as the destination port, it no longer uses port 69. And the devices continue to use these two random ports throughout the data transfer. So, TFTP’s well-known port of 69 is only used in the very first message from the client to the server. As I mentioned, this is beyond the scope of the CCNA, but it’s an interesting part of TFTP’s operation. Okay, so that was a brief overview of TFTP with a few details about its operation. Next I’ll introduce FTP and then we’ll compare the two. FTP was first standardized in 1971. This is actually before TCP and IP, so FTP is a very old protocol, although it has of course been updated since. FTP uses TCP ports 20 and 21, instead of just a single well-known port. In the next slide you’ll see why. Unlike TFTP, usernames and passwords are used for authentication. However, just like in TFTP, there is no encryption. Everything is sent in plain text, including the user name and password. For greater security, FTPS, FTP over SSL/TLS, can be used. This protocol is also called FTP Secure. Another option is SSH File Transfer Protocol, SFTP. Note that FTPS is an upgrade to FTP, adding greater security, whereas SFTP is a different protocol that just has a similar name. FTP is more complex than TFTP and allows not only file transfers, but clients can also navigate file directories, add and remove directories, list files, etc. In TFTP, the client could only tell the server ‘give me this file’ or ‘take this file’, it couldn’t even ask the server ‘what files do you have?’. The client sends FTP commands to the server to perform FTP’s functions. There are many different FTP commands, and you can view a list of them here on Wikipedia if you’re interested. As I said, FTP uses two different well-known ports: TCP ports 20 and 21. That’s because FTP uses two types of connections. An FTP control connection to TCP port 21 is established and used to send FTP commands. The client sends commands when it wants to perform an action, such as retrieving a file from the server, and the server sends replies to acknowledge. However, the actual data transfer isn’t done using this control connection. When files or data are to be transferred, separate FTP data connections to TCP port 20 are established and terminated as needed. So, let me demonstrate the control connection. The client initiates the TCP connection, and the usual SYN, then SYN-ACK, then ACK exchange is used. Now the FTP control connection is established. The client will send FTP commands to the server, for example to say that the PC wants to get a file from the server. The server replies to acknowledge the command. But now we need an FTP data connection to actually transfer the data. There are actually two different modes which can be used to establish an FTP data connection. The default method of establishing FTP data connections is active mode, in which the server initiates the TCP connection. So, as you can see the first arrow, which would be the initial TCP SYN message, is from the server to the client. Now the FTP data connection is established, and the data can be exchanged. So, the point I want you to remember is that in FTP active mode, the server initiates the data connection. Also, note that the FTP control connection is maintained throughout this whole process. It isn’t terminated, so there are two active connections. So, active is considered the ‘normal’ mode of initiating FTP data connections. However, notice the network has changed. The client is now behind a firewall. In FTP passive mode, the client initiates the data connection. This is often necessary when the client is behind a firewall, which could block the incoming connection from the server. So, now the first message in the TCP connection is initiated by the client. The firewall permits the server’s replies, but it would block the message if the server tried to initiate the TCP connection itself. Once the FTP data connection is established, the data is exchanged. So, here’s what I want you to remember. Firewalls usually don’t permit ‘outside’ devices to initiate connections. In this case, FTP passive mode is used and the client, which is behind the firewall, initiates the TCP connection. By the way, if you’re interested in learning more about firewalls, consider studying for the CCNP security certification at some point in the future. Okay, that’s enough about FTP. FTP is more complex than TFTP and it would take a long time to really cover all there is to know about FTP, but I think that’s enough for now. So let’s briefly compare FTP and TFTP. FTP uses TCP for connection-based communication. Port 20 is used for data connections, and port 21 is used for control connections. TFTP on the other hand uses UDP port 69 for connectionless communication, although there is a basic form of connection within the protocol itself. FTP clients can use commands to perform various actions, not just copy files. However TFTP clients can only copy files to or from the server. They can’t delete files, list files, etc. FTP uses usernames and passwords to limit who can access the server. TFTP, on the other hand, has no authentication system at all. So, FTP is a more complex protocol, and TFTP is simpler. Okay, let’s move on to look at the IOS file systems. This is going to be a very brief introduction, just this slide, but I want to introduce it because we will be looking at transferring files from TFTP and FTP servers onto a Cisco IOS device. A file system is a way of controlling how data is stored and retrieved. If you have a PC, it certainly has its own file system. You can view the file systems of a Cisco IOS device with the command SHOW FILE SYSTEMS. And here’s some sample output. Note that there are quite a few file systems, and I even cut out a few because the output was too long. And note that there are different types of file systems. The disk type refers to storage devices such as flash memory. This is usually where the Cisco IOS file itself is stored. When the device boots up, it copies the IOS file from flash into RAM. The opaque disk type is used for specific internal functions. These refer to logical internal systems, not actual separate storage devices. The NVRAM type refers to the NVRAM, non-volatile RAM, of the device. Normal RAM loses all of its data when the device loses power. However NVRAM does not. The startup-config file is stored in NVRAM. There is also the network type. This represents external file systems, for example FTP or TFTP servers. I don’t think you’ll find any questions about these file systems on the exam, the topic was removed in the newest version of the CCNA. So, we’ll end this introduction here. Next let’s actually look at how to use TFTP and FTP to transfer files into the flash memory of Cisco devices. So, here’s a very simple network we’ll use to demonstrate TFTP and FTP. R1 is a Cisco router running Cisco IOS, and we have downloaded a new version of IOS and saved it on SRV1. SRV1 is a server running both TFTP and FTP, and we’ll try out both of them to get the new version of IOS from SRV1 onto R1. First, you can view the current version of IOS running on R1 with SHOW VERSION. Here you can see the image name, C2900-UNIVERSALK9-M. Notice the K9, meaning it supports cryptographic features like SSH. Then the version number, 15.1(4)M4. Perhaps in a future video I’ll talk about the naming conventions of IOS versions, but I’ll skip over it for now. The output of SHOW VERSION is actually quite long, I’m just showing the top portion. By the way, for simplicity’s sake I’m actually using packet tracer for this demonstration, although usually I use GNS3. You can also view the contents of flash with SHOW FLASH. Here it is, and you can see the IOS image here. So, what we’re going to do now is use TFTP to copy a new version of IOS from SRV1 to the flash of R1, configure R1 to boot with the new version of IOS, and then finally delete the old version from flash. And here’s how to copy the file using TFTP. The command is COPY, followed by the source and the destination. By using TFTP as the source, you tell the router that you want to access a TFTP server. The router then asks you for the IP address of the remote host. This is where you enter the TFTP server’s IP address. Then enter the source filename, the name of the file you want to download. Note that you have to know this beforehand. TFTP isn’t capable of asking a server ‘what files do you have?’. I already knew the name of the file on the server, so I entered it. Then you’re asked what name you want to save the file as on the router. You can just hit enter to accept the default name, which is the same name as on the TFTP server. And that’s it, the file is then transferred from the TFTP server to the router. I used SHOW FLASH to check the contents of flash. Here you can see the new version of IOS that was copied from the TFTP server. Now, how do we make the router use this file as its OS instead of the old file? From global config mode, use the command BOOT SYSTEM, followed by the filepath. Note that, if you don’t use this command the router will boot using the first IOS file it finds in flash. So, you should use this command to force it to use the newer version. After that, make sure you save the configuration before reloading the device, or the BOOT SYSTEM command won’t take effect. Then simply use the RELOAD command to restart the device. After the device finished restarting I used SHOW VERSION to check the running version of IOS, and R1 is now using the new version, 15.5, instead of the old one, 15.1. Finally, let’s delete that old version of IOS. We don’t need it anymore, it’s just taking up space on the device. The command to delete a file is DELETE, followed by the filepath. It asks you to confirm, so I did. And then I used SHOW FLASH to view the contents of flash, and now the old file is gone. So, we successfully used TFTP to copy an IOS file to R1 from a TFTP server. We then configured R1 to boot using that IOS file, and then reloaded R1. Finally, we deleted the old IOS image from the device. Now let’s take a look at FTP. I’ll only show the process of transferring the file from the server to the router, because the rest is the same. Once the file is on the device, the other steps such as the BOOT SYSTEM command, deleting the old file, etc, are all the same. First, you should configure the username and password that the router will use when connecting to an FTP server. Remember, FTP authenticates using a username and password. So, this same username and password must be configured on the server, too. In this case, I configured the username and password as cisco. Then the copy command itself is basically the same. COPY FTP: FLASH:, and then enter the FTP server’s IP address, the source file name, and the name you want to save the file as on the local router. That’s it. Then to upgrade the IOS we could use the same BOOT SYSTEM command, save the config, and reload the router. Okay, here are the commands we just used. If you don’t remember any of these commands, go back in the video to review. I also want to say something about the COPY command. This actually isn’t the first time we’ve seen that command. Previously I introduced it as COPY RUNNING-CONFIG STARTUP-CONFIG, as a method to save the configuration of the device. It copies the source, the current running config, to the destination, the startup config. Okay, before the quiz let’s review what we covered. First, the purpose of FTP and TFTP. Basically, they allow you to transfer files between devices over a network. Then I gave an overview of TFTP and FTP, and compared the two. TFTP is simpler and useful for quickly transferring small files in a controlled environment, but has no advanced functionalities or any security features. FTP has much greater functionality, and includes username and password authentication. And if you use FTPS, it has many other security benefits, but that’s out of the scope of this video. Then I very briefly introduced the file systems in Cisco IOS. And finally showed how to use TFTP and FTP to get a new IOS file from a server, and then reboot the device with the new version of IOS. Once again, make sure to watch until the end of the quiz for a bonus question from Boson Software’s ExSim, the best practice exams for the CCNA. Okay, let’s go to question 1 of the quiz. Which of the following statements about FTP are true? Select two. Pause the video now to think about the answers. The answers are B, FTP control connections use TCP port 21, and D, FTP data connections use TCP port 20. FTP uses TCP to provide reliable communications and other features. It uses port 21 to establish a control connection for sending FTP commands and replies to those commands, and then uses port 20 to establish data connections for the actual exchange of data. Okay, let’s go to question 2. Which of the following commands can be used to transfer a file from an external TFTP server to the local device’s flash storage? Pause the video now to think about the answer. The answer is A, COPY TFTP: FLASH:. The command is COPY, then the source and then the destination, so this copies a file from a TFTP server to flash. Okay, let’s go to question 3. R1 is behind a firewall and wants to connect to an external FTP server. Which of the following statements is true? Pause the video now to think about the answer. The answer is C, R1 should use FTP passive mode for the data connection. Active and passive mode only apply to the FTP data connections, because the client always initiates the control connection. In active mode, the server initiates the data connection. But in passive mode, the client initiates the data connection. When a client is behind a firewall, passive mode should be used. Okay, let’s go to question 4. Which type of file system is used to store the startup-config of a device running Cisco IOS? Pause the video now to think about the answer. The answer is D, NVRAM. NVRAM, non-volatile RAM, is a type of RAM that preserves data even after the device loses power. It is used to store the startup-config of the device. Okay, let’s go to question 5. Which of the following functions are NOT possible when using TFTP? (select two). Pause the video now to think about the answers. The answers are B, create a new directory on a server, and C, list the contents of a server. TFTP is very simple and only allows a client to copy a file to or from a server, it has no other functions. Okay, that’s all for the quiz. Now let’s take a look at a bonus question from Boson Software’s ExSim for CCNA. Okay here's today's Boson ExSim practice question. Which of the following Application layer protocols use UDP for unsynchronized, connectionless data transfer? Select 2 choices. So, here are the choices. Pause the video now to think about the answers. Okay let's check. So, I think the correct answers are TFTP. That uses UDP for unsynchronized, connectionless data transfer. Now, it says connectionless, but as I showed TFTP does use some basic kind of connection within the protocol itself. But it doesn't use TCP connections at Layer 4, so it is one of the correct answers. And also SNMP, Simple Network Management Protocol. As we covered recently in the course, it also uses UDP. It is not TCP-based, it doesn't use TCP connections. And HTTP, I mentioned, does use TCP, and also SMTP which we don't cover in the course, but that is Simple Mail Transfer Protocol. It also uses TCP. Okay, so I will click on show answer. And that is correct. So, here is Boson's explanation, which just outlines the different protocols and explains about TCP and UDP. So, you can pause the video now to read Boson's explanation. Okay, so that was a quick look at a bonus question in Boson Software's ExSim for CCNA. These are without a doubt the best practice exams for the CCNA. So, if you want to get Boson ExSim, please follow the link in the video description. There are supplementary materials for this video. There is a flashcard deck to use with the software ‘Anki’. 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 flashcards and packet tracer lab files for the course. Before finishing today’s video I want to thank my JCNP-level channel members. To join, please click the ‘Join’ button under the video. Thank you to Serge, Njoku, Viktor, Roger, Raj, Kenneth, Seamus, H W, Brandon, Samil, Aaron, Marcel, Kone, Donald, C Mohd, Gustavo, Anthony, Junhong, Benjamin, Tshepiso, Justin, Prakaash, Nasir, Erlison, Marko, Daming, Jhilmar, Ed, Value, John, Funnydart, Velvijaykum, Mark, Yousif, Boson Software, Devin, Lito, Yonatan, and Vance. Sorry if I pronounced your name incorrectly, but thank you so much for your support. This is the list of JCNP-level members at the time of recording by the way, March 7th 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.