How can I modify the tftp timeout?


I'd like to test if a tFTP server is up and if it's up I'm downloading some scripts on to the switch. Right now I'm trying to download a dummy file from the tFTP server using this command

tftp get serverIP dummyFile.xsf

if the tftp server is up, I get a reply very fast that the file is not available. But if the server is down the timeout for the tftp command is 60 seconds. It is very long in my application. I'd like to decrease it to 5-6 seconds. Is this possible?

Is there any other method to find out if the server is up or not?

EDIT:

BTW, I've tried to ping the tFTP server but even when it's up I get this errPacket transmit error: Packet transmit error; Destination unreachable

6 replies

Userlevel 7
Hi Ali,

When you try to ping the TFTP server, are you using vr-default or vr-mgmt? In EXOS 'ping' defaults to vr-default, while tftp defaults to 'vr-mgmt'. I would suggest specifying vr-mgmt when you ping to see if that gets what you want.

ping vr vr-mgmt [i][/code]
-Brandon
Brandon Clay wrote:

Hi Ali,

When you try to ping the TFTP server, are you using vr-default or vr-mgmt? In EXOS 'ping' defaults to vr-default, while tftp defaults to 'vr-mgmt'. I would suggest specifying vr-mgmt when you ping to see if that gets what you want.

ping vr vr-mgmt [i][/code]
-Brandon

Thanks Brandon. It is working now. But the problem is that I'm running the tFTP server on a Windows machine and right now even if the server is not up I get a reply to ping requests.

Can I modify the tFTP timeout?
Userlevel 6
Hi Ali, currently there is no native CLI option to modify the TFTP timeout.

An option would be creating a Python script to ping the server through MGMT vlan and only start the TFTP process if the server is up.

However this script might need to be created from scratch.

You can find some examples for Python scripts in the link below:

EXOS Python Scripts

Note: Python version 2.7.3 has been integrated into EXOS since EXOS 15.6.1
Henrique wrote:

Hi Ali, currently there is no native CLI option to modify the TFTP timeout.

An option would be creating a Python script to ping the server through MGMT vlan and only start the TFTP process if the server is up.

However this script might need to be created from scratch.

You can find some examples for Python scripts in the link below:

EXOS Python Scripts

Note: Python version 2.7.3 has been integrated into EXOS since EXOS 15.6.1

Hi Henrique, thanks for your comment. I can write the python script but as I've explained to@Brandon my tFTP server is running on a Windows machine so if I ping the tFTP server and even if the server is not running I will get a reply to my ping requests, so ping is not useful in my case.
Userlevel 6
Henrique wrote:

Hi Ali, currently there is no native CLI option to modify the TFTP timeout.

An option would be creating a Python script to ping the server through MGMT vlan and only start the TFTP process if the server is up.

However this script might need to be created from scratch.

You can find some examples for Python scripts in the link below:

EXOS Python Scripts

Note: Python version 2.7.3 has been integrated into EXOS since EXOS 15.6.1

Using python you could use expect and the timeout option so it will fail if the command is not finished within that timeout.
Something like below but then you need to extend that a bit.

import pexpectimport exshexpect
exosPrompt = ' # '
Create an expect object. Pass in the prompt and the back end function to call:
p = exshexpect.exshspawn(exosPrompt, exsh.clicmd)
Use sendline to send commands to the backend function (in this case exsh.clicmd) :
p.sendline('tftp get [i] ') <-
idx = p.expect([exosPrompt, pexpect.EOF, pexpect.TIMEOUT])
Userlevel 3
Can I ask why you are doing this from a switch and not a server? It seems to me that it is much easier to write a script to test your tftp server and then send out notification (syslog/email) if the tftp server fails and put it on a cronjob. Or even use nmap/nping or udpping to verify that your tftp server is up. that way you don't actually have to transfer any files.

Reply