Hey what's up guys welcome to CertBros. In this video we're going to be looking at
FTP. FTP stands for file transfer protocol and it does pretty much
what it says on the tin. It's a protocol used to transfer files across a network
FTP uses a client server model. The server hosts the files and the client can connect, download
files, upload files, delete, rename etc. Now depending on your age you may have used FTP already, it
was quite popular to download files from friends download software drivers etc. These days you don't
see ftp used too often, but it is still used in specific cases like in network management and web
development. There are a few ways you can access an ftp server. The first way is through a browser
you can simply type in the FTP server address for example ftp://192.168.0.8
the ftp:// tells our computer to connect
to the FTP port and not the HTTP or HTTPS port. As you can see an FTP server is pretty basic
and this may even look familiar to a few of you. It's just a list of files
and directories. Now another way we can connect to an FTP server is via the windows file explorer
again we just need to type in the address into the bar at the top of the screen
the third and most popular way to access an FTP server is via an FTP client I'm using
probably the most popular one which is Filezilla. We just need to type in the FTP details at the top
the last two methods logged us in without any user credentials
FTP gives us the option to log in as a user or anonymously. This time we are
going to log in as a user by entering the host address, username and password
and also I'll specify the FTP port number which is 21. Now we are warned about this
FTP server not using something called TLS this is something we'll cover shortly
once we connect again we can browse directories download and upload files because I logged on
as a user I now have permission to view the home directory and all of its content
I can also view the FTP folder that we already saw and I'll go ahead and download the file
Now just a quick note here FTP server permissions depend on the server itself
and this is just how i've set mine up, so each one could be different
Now that file has downloaded I can confirm by showing the desktop and yes there it is
now you've seen FTP in action let's talk about some of the more technical details. FTP
uses transport protocol TCP. So like any other TCP protocol the connection starts with a
three-way handshake. The client will send a SYN message, the server will respond with a SYNACK
and finally the client will send an ACK. Now if this process looks unfamiliar to you I have
another video showing how this works in a bit more detail. That video is called TCP vs UDP
and is worth having a look. Once we have completed our handshake we now have an open connection to
the FTP server. FTP uses two different connections the first one is the control connection. The
control connection handles all of the FTP commands and instructions such as GET and PUTcommands
our client will connect to the FTP server with a destination port of 21 and a randomly selected
dynamic source port. So when we want to start transferring files a new connection is opened
this is called a data connection. now there are two different types of data connections
the first type is an active data connection. The way an active data connection is established is
by the server initiating the session. It does this from a source port of 20 and it uses a
randomly generated dynamic destination port. There is a problem with this method though
if there is a firewall in between our client and server
this unsolicited connection from the FTP server will likely be blocked by the firewall. This is
because by default firewalls usually block all incoming connections unless configured otherwise
So the other more popular option is to use a passive data connection. The way a passive
data connection is established is by the client initiating the session not the server. Randomly
generated and agreed source and destination port numbers are used. Because the client initiated
the connection internally the firewall will happily let the traffic pass without blocking it
So now we've seen how FTP works let's talk about its biggest problem. Because FTP was designed such
a long time ago it lacks even some of the most basic security features we see today most notably
encryption. This means all of our communication between the FTP client
and the server is sent in clear text. That includes login credentials and files being transferred
and that is great! Not for us, no, it's great for hackers! Hackers could intercept
and steal your login credentials as they're sent to the server
here's a Wireshark capture of a FTP login. As we can see the username and password both of which
are CertBros can be seen in plain text. So very easy for hackers to steal
so why would anyone use ftp if it has such a massive security flaw like plain text transmission?
well, to put it bluntly, you shouldn't! Instead you should use something called FTPS instead. FTPS
also known as FTP secure, is an extension to FTP adding a layer of security FTPS uses
TLS which is an encryption protocol used to keep our data safe and away from the prying
eyes of hackers. This is what the warning message we saw earlier was telling us about
so an FTPS connection would look something like this. We connect to our FTP server as before
but this time we negotiate TLS encryption to keep our data safe. Now encryption is usually described
as a tunnel and by using this tunnel the hackers can no longer see or steal our data as we send it
to the server, and this makes hackers sad! Now the way TLS negotiations take place and the
steps involved will probably need to be covered in a video all of its own, and to be honest it's
probably out of the scope for the CCNA, so for now just know that the negotiation takes place
Now you may hear about another protocol called SFTP and although the name is
similar and the purpose of transferring files is the same SFTP isn't part of the FTP protocol
it's actually part of the SSH protocol and it uses SSH to securely transfer files
OK, so the last type of FTP protocol I want to talk about is TFTP. Unlike FTPS which was an
extension of FTP, TFTP kind of goes back the other way TFTP stands for trivial file transfer protocol
and is pretty much a stripped-back version of FTP. To keep it fast and lightweight TFTP
uses UDP port 69. It also doesn't have any of the bells and whistles of standard FTP
features such as authentication and encryption doesn't exist in TFTP. So then why would anyone
in their right mind want to use TFTP? Well you definitely don't want to use it over the internet
but where it can be very handy is in a local network for very basic transfers. You could
use a TFTP server to quickly backup a cisco ios image or a configuration file for example
Let's jump into a quick TFTP example and see how we can use this to backup a configuration file
first, we're going to need a TFTP server. This computer already has a free TFTP
server installed from solarwinds. As you can see it's pretty basic, nothing fancy to see here
OK, so let's say we're doing some work on this router maybe we're adjusting the configuration
for a new implementation or something along those lines. We want to back up our current configuration
one way to do this is by using our TFTP server we just simply type 'copy
running-config' and then we type 'tftp' it will then ask for the TFTP server IP address
in this case is 192.168.0.10. Then it asks us for the file name. It automatically suggests r1-config
let's keep it as the default and press enter. We get confirmation that the file has been uploaded
now we have our config backed up we are free to make any changes we want
in this example I'll just go into the config mode and change the hostname to something
and i'll hit enter a few times just to confirm the hostname has changed
right, now let's pretend it's all gone very badly and we need to restore our config
we can just exit config mode and type 'copy tftp running-config' so this is from the TFTP server to
our running configuration. Again it's asking for the IP address of the TFTP server
and then the file name to copy remember this was called r1-confg
confirm the destination is the running config and if we hit enter a few times
we can see our hostname meaning the configuration has gone back to normal
now of course we could have just copied the startup config but this is just one example
of the things we can do with TFTP servers. This video is part of the full CCNA course
which can be found in the description so please feel free to go and check that out
If you like this video don't forget to give it a thumbs up, leave a comment and subscribe. The
support from you guys really helps this channel grow. Other than that, thank you for watching.