LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   tftp server allowing write but then zero outs the file ??? (https://www.linuxquestions.org/questions/linux-server-73/tftp-server-allowing-write-but-then-zero-outs-the-file-938525/)

drpbx911 04-06-2012 02:20 PM

tftp server allowing write but then zero outs the file ???
 
This used to work fine but not now. I can save my Cisco configs to the tftp server and using Nautilus I can watch the tftpboot directory and the file gets copied to the directory and the correct file size posts. 2 to 3 seconds later it updates to 0 bytes. If I use a terminal session to open the file when it first posts with the correct size using vi it looks correct. I'm using root to do this and I can write it back and the first time I wrote the file back it zeroed out. I wrote it again and it finally stayed. I've tried different directories under the tftpboot directory and tried changing the owner and permissions. None of this seemed to work.

This used to be very reliable.
Something is modifying the files and setting them to zero bytes.
I'm uncertain where to go from here.

I have installed many packages between tftp-hpa being set up and me noticing the problem. i.e. nfs, nagios and many more.

thanks in advance.

oso_togari 04-19-2012 05:20 AM

Hi

i have a similar issue on my site.
My iptables is down and i see that the packets from the switch are entry in the tftp server:

[root@machine tftpboot]# tcpdump -n -i eth0 -vvv port tftp

tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
10:34:11.588373 IP (tos 0x0, ttl 254, id 37752, offset 0, flags [none], proto: UDP (17), length: 63) 192.168.30.1.fcip-port > 192.168.30.10.tftp: [udp sum ok] 35 WRQ "swismal4210.cfg" octet tsize 9629

but, after 10 packets like this the file is crated with 0 bytes.

On the switch side i see a 90 sec timeout after a "Can't connect to the server" messagge

It works well with other switches in the same network of the server, so the problem seems to be something related with NAT, firewall(acting as a router between the two nets) and tftp protocol.

I saw some documents to config the tftp service in the firewall, but unfortunatley i'm not the admin of the firewall.

I dont know if this is your case.


pd. i don't trust myself about it, but i remember that this works the first time i programmed the script.

Regards

drpbx911 05-06-2012 12:23 PM

Solved
 
I suspected it might have been related to some security feature and that may be.
I use this to support my Cisco lab and here's what I've learned.

Ensure the IP address of the machine that you are writing from is in the /etc/hosts table and it will work.

With a lab environment this IP address can change with different configurations.

As a work around, configure a loopback interface with a static IP address that is advertised in your routing protocol.
In addition use the command "IP TFTP SOURCE-ADDRESS LOOP 0" and then the loopback address will be the one used as the source of the tftp operation and since it is now in your /etc/hosts file it should solve your problem.

HTH


All times are GMT -5. The time now is 06:03 AM.