Jeremy's IT Lab
Day 43IP Services

FTP & TFTP

31m7 chapters148 cues13 cards1 lab
Day 43YT: 50hcfsoBf4Q
00:00 / 30:55

Synchronized Transcript

148 cues indexed • Click dialogue or words to jump
Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

They both use a client-server model. Clients can use FTP or TFTP to copy files from an FTP or TFTP server.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

Okay, now let’s move on to talk about TFTP, the Trivial File Transfer Protocol. TFTP was first standardized in 1981.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

You probably shouldn’t use it to transfer important files over the Internet, for example. TFTP servers listen on UDP port 69.

Jeremy

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.

Jeremy

However, TFTP actually has similar built-in connection and reliability features within the TFTP protocol itself. Let’s take a look.

Jeremy

First I’ll introduce how TFTP provides reliability using acknowledgments and retransmissions. Every TFTP data message is acknowledged.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

Let me demonstrate. So, the client sends a request, and the server replies by sending the first data packet. The connection is officially established.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

However, just like in TFTP, there is no encryption. Everything is sent in plain text, including the user name and password.

Jeremy

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.

Jeremy

Note that FTPS is an upgrade to FTP, adding greater security, whereas SFTP is a different protocol that just has a similar name.

Jeremy

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.

Jeremy

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?’.

Jeremy

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.

Jeremy

As I said, FTP uses two different well-known ports: TCP ports 20 and 21. That’s because FTP uses two types of connections.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

Also, note that the FTP control connection is maintained throughout this whole process. It isn’t terminated, so there are two active connections.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

TFTP on the other hand uses UDP port 69 for connectionless communication, although there is a basic form of connection within the protocol itself.

Jeremy

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.

Jeremy

They can’t delete files, list files, etc. FTP uses usernames and passwords to limit who can access the server.

Jeremy

TFTP, on the other hand, has no authentication system at all. So, FTP is a more complex protocol, and TFTP is simpler.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

When the device boots up, it copies the IOS file from flash into RAM. The opaque disk type is used for specific internal functions.

Jeremy

These refer to logical internal systems, not actual separate storage devices. The NVRAM type refers to the NVRAM, non-volatile RAM, of the device.

Jeremy

Normal RAM loses all of its data when the device loses power. However NVRAM does not. The startup-config file is stored in NVRAM.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

Notice the K9, meaning it supports cryptographic features like SSH. Then the version number, 15.1(4)M4.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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?

Jeremy

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.

Jeremy

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.

Jeremy

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,

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

Remember, FTP authenticates using a username and password. So, this same username and password must be configured on the server, too.

Jeremy

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.

Jeremy

That’s it. Then to upgrade the IOS we could use the same BOOT SYSTEM command, save the config, and reload the router.

Jeremy

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.

Jeremy

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.

Jeremy

It copies the source, the current running config, to the destination, the startup config. Okay, before the quiz let’s review what we covered.

Jeremy

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.

Jeremy

TFTP is simpler and useful for quickly transferring small files in a controlled environment, but has no advanced functionalities or any security features.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

Okay, let’s go to question 1 of the quiz. Which of the following statements about FTP are true? Select two.

Jeremy

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.

Jeremy

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.

Jeremy

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?

Jeremy

Pause the video now to think about the answer. The answer is A, COPY TFTP: FLASH:.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

The answer is D, NVRAM. NVRAM, non-volatile RAM, is a type of RAM that preserves data even after the device loses power.

Jeremy

It is used to store the startup-config of the device. Okay, let’s go to question 5.

Jeremy

Which of the following functions are NOT possible when using TFTP? (select two). Pause the video now to think about the answers.

Jeremy

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.

Jeremy

Okay, that’s all for the quiz. Now let’s take a look at a bonus question from Boson Software’s ExSim for CCNA.

Jeremy

Okay here's today's Boson ExSim practice question. Which of the following Application layer protocols use UDP for unsynchronized, connectionless data transfer?

Jeremy

Select 2 choices. So, here are the choices. Pause the video now to think about the answers.

Jeremy

Okay let's check. So, I think the correct answers are TFTP. That uses UDP for unsynchronized, connectionless data transfer.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

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.

Jeremy

Before finishing today’s video I want to thank my JCNP-level channel members. To join, please click the ‘Join’ button under the video.

Jeremy

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,

Jeremy

Mark, Yousif, Boson Software, Devin, Lito, Yonatan, and Vance. Sorry if I pronounced your name incorrectly, but thank you so much for your support.

Jeremy

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.

Jeremy

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.

Jeremy

I'm also a Brave verified publisher and accept BAT, or Basic Attention Token, tips via the Brave browser. That's all for now.

Keyboard shortcuts

Shortcuts are ignored while you are typing in a search box, note field, or the scratchpad.

Playback

SpaceK
Play or pause
←→
Seek 5 seconds
JL
Seek 10 seconds
C
Toggle in-video captions

Scrubber (when focused)

←→
Seek 5 seconds
Shift←/→
Seek 10 seconds
Page UpPage Down
Seek 30 seconds
HomeEnd
Jump to start or end

Flashcards

Space
Reveal the answer
1234
Grade Again / Hard / Good / Easy

Navigation

←→
Move between study-mode tabs
HomeEnd
First or last study-mode tab
?
Open or close this sheet