简体   繁体   中英

no route to host error 113

If built a script which connects to an ftp server.I have tested it local on my pc and its working, but on the server it says: (113, 'No route to host'). If i connect per shell with ftp XX.XX.XX.XX its working fine! This is how i try to connect in python:

            import ftplip
            meinftp = ftplib.FTP(ip)
            meinftp.login(user,password)
            meinftp.cwd(ftpdirectory)

Any ideas why i get no route to host? The firewall is not blocking.

I agree that strace is a good tool here, but it can be a bit daunting if you aren't familiar with it, or at least, familiar with C.

About use of strace and similar tools for debugging: http://stromberg.dnsalias.org/~strombrg/debugging-with-syscall-tracers.html

python returns 113 'No route to host' even if the DNS name is available, but the service is not working.

May be specific for FTP passive options.

Run your script with the 'strace' so you will be to check what syscall is failing.

strace -fo /tmp/log python yourscript.py

这很可能是防火墙问题,请尝试禁用防火墙。

See also https://stumbles.id.au/python-ftps-and-mis-configured-servers.html

Quoting: "I eventually noticed a message in the FileZilla logs, Server sent passive reply with unroutable address. Using server address instead. It turns out that the FTPS server was mis-configured and was replying to the PASV command with an internal IP address that was not accessible from the public internet. It seems that this is a common enough configuration issue that some FTP clients detect the problem and use the existing server address instead. Python's FTP client doesn't do this though."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM