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.

Linksys E2000 Router Dead

Well, for a little over a year I have been using a Linksys E2000 running DD-WRT with no issues, until last Tuesday. I came home and had no internet connection. Even attempting to connect to wireless was pointless, the SSID I had setup over a year ago didn’t even appear. I tried rebooting the router but still had no access to the internet. Even rebooting my cable modem didn’t help. I then attempted the 30/30/30 reset per the DD-WRT guide to get to the default setup. Once this was completed I plugged in my laptop and was able to get an IP address, so this indicated DHCP was working on the router. I tried pinging the router and came up with “Destination Host Unreachable”, then a couple of “Request timed out” and then “Destination Host Unreachable” again. So, based on this I assumed there was some issue with the router and not DD-WRT, since DHCP was working. I posted to the DD-WRT forum but, unfortunately, did not get a lot a feedback.

In the meantime, I had an old Linksys router I had received from being a Vonage customer years ago and plugged it in just so the household could get on the internet. Unfortunately, it did not have Wi-Fi so there were some limitations in our household LAN, mostly not being able to print to our wireless printer.

So, needless to say, I had to order a new router. I shopped around doing research as I went along and found the best option for me was the Cisco (Linksys) EA2700. I found and ordered it on Amazon for $84. Luckily for me, I had just joined Amazon Prime so I was able to get it next day for just $4 for shipping.

As of today, DD-WRT does not have an image for the EA2700, which I am fine with. I think I will keep it running the Cisco image just in case a year down the road I have hardware issues again. That way, maybe, Cisco will be able to assist me with getting the router functioning again, if there is an issue like I had with the E2000.