Setting Up TFTP Server in Linux Mint 12

I am in the process (and actually have been for the past 5 years) of studying for my Cisco certification, specifically now, the CCENT. One of the labs I wanted to familiarize myself with was copying a config from a switch or router to a TFTP server. Eventually, I want to test the boot of an IOS on that TFTP server too. I had purchased an old Catalyst 2950 on Amazon a little over a year ago and recently had to start using it full time as one of my switches in my LAN because my DLink died a little over a week ago. No problem there except for the noise and heat that the 2950 puts out. But the advantage of it is that I can use it as a live lab. No worries there also since it doesn’t really have high traffic devices connected to it, just my Xbox 360, Media PC, and NAS; those are devices I don’t use all the time.

Well, since I use Linux Mint 12 on my desktop I needed to setup TFTP server on it so that I could backup my switch config to it for practice. Trying to find the best setup of TFTP server in Linux Mint wasn’t the easiest find. After numerous searches and a couple of failed How-To’s I finally came across this blog post for Ubuntu.

How to Setup TFTP on Ubuntu 11.10

There was a couple of changes in my configuration though that I had to make for my personal preference, nothing big, and I found that I didn’t need the following:

sudo chown -R nobody:nobody /var/lib/tftpboot

However, if you are using Ubuntu, or other like distribution, you still may need it so I would not skip it if I were you.

Here is the entire post just in case at the time of reading my post the external link no longer exist.

———————————————————————————————————-

First, let’s install all the necessary packages:

sudo apt-get install xinetd tftpd tftp -y

Next, we need to create a configuration file:

sudo nano /etc/xinetd.d/tftp

Put the following content into the file.

service tftp
{
   protocol = udp
   port = 69
   socket_type = dgram
   wait = yes
   user = nobody
   server = /usr/sbin/in.tftpd
   server_args = var/lib/tftpboot -s
   disable = no
}

In the server_args, I have var/lib/tftpboot, which represents the location of the tftp root, i.e., /var/lib/tftpboot. Notice that I skip the root /.

Now let’s change the ownership of the directory:

sudo mkdir /var/lib/tftpboot
sudo chown -R nobody:nobody /var/lib/tftpboot
sudo chmod -R 777 /var/lib/tftpboot

and start the TFTP service:

sudo service xinetd stop
sudo service xinetd start

Verify the TFTP is running correctly or not:

netstat -na | grep LIST | grep 22

You should see something like this:

tcp        0      0 0.0.0.0:22              0.0.0.0:*     LISTEN

 

 

Test: Upload a file to TFTP Server

Now let’s test the TFTP server by logging into the server first:

tftp localhost

and upload a file:

tftp> put myfile.jpg
Sent 56733279 bytes in 5.7 seconds

Quit:

q

Make sure that file has been uploaded:

ls -l /var/lib/tftpboot

Test: Download a file from TFTP Server

Now, let’s go to a different directory and download the file we just upload.

cd some_other_directory

and log in to the tftp server again:

tftp localhost

and get the file:

tftp> get myfile.jpg
Received 56733279 bytes in 5.7 seconds

You are done.

Troubleshooting (e.g., Error code 2: Access violation)

If you see a message like: Error code 2: Access violation

Make sure that you:
- Follow the exact procedure in this tutorial
- Make sure that the tftp is started with -s flag.
- Check the permission of the directory, i.e., 777
- After you’ve made any changes to the TFTP configuration, make sure that you stop and start the inet service again.
- Don’t forget to quit tftp before retrying the command.

————————————————————————————————-

Thanks to Derrick over at Icesquare for the very informative post.

About ed

I was born and raised in Tallahassee until 1993. There I was raised to love God, Family and the Seminoles, in that order. After meeting a gorgeous girl in 1992 from Jacksonville, where my family had moved to in previous years, I decided to move to Jacksonville where I lived for four years until that gorgeous girl and I decided to move to Orlando. I’ve been living in Orlando with that gorgeous girl since 1997 and still love her and the city. My only major complaint about Orlando is the weather (it’s hot, people, too hot). I have no complaints about her – I love you, baby . I work in the Technology field as a Systems Administrator working with Windows servers and Cisco networking. Because I love my career so much I enjoy technology outside of the work place also. When I’m not exploring new tech gadgets, working on my computers, or tweaking my local home network, I generally enjoy video games, movies, reading and spending time with my family. And when I am not doing all of that, I also work as a consultant for my technology consulting company, EC Technology Consulting, LLC. To sum it up, I’m a tech geek.
This entry was posted in Cisco, Tech, TFTP. Bookmark the permalink.

One Response to Setting Up TFTP Server in Linux Mint 12

  1. lol says:

    “Dear” author :-D ….. FTP services run on port 21 ;-)

    Verify the TFTP is running correctly or not:

    netstat -na | grep LIST | grep 22

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>