On my PC I have VMware with two VMs, both are Fedora.

I am trying to use FTP between them, but I'm getting: ftp: connect: No route to host

Here the output when I ping from VM1 to VM2:

[root@localhost ~]# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=0.640 ms
64 bytes from icmp_seq=2 ttl=64 time=1.46 ms
--- ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1012ms
rtt min/avg/max/mdev = 0.640/1.052/1.464/0.412 ms

And here when I try to connect via FTP:

[root@localhost ~]# ftp
ftp: connect: No route to host
  • Check system-config-firewall. Is port 21 open? – davidmneedham Sep 20 '18 at 15:49
  • Try firewall-cmd --state from the command line and edit your question with the output. – davidmneedham Sep 20 '18 at 15:57
  • Sorry, I think firewall-cmd --list-ports is the command to check to see if port 21 is open. – davidmneedham Sep 20 '18 at 16:01
  • @davidmneedham it says 1025-65535/udp 1025-65535/tcp – Plompy Sep 20 '18 at 16:03

It's likely that port 21 is blocked by your firewall.

Run the following commands to open port 21 and restart the firewall service.

firewall-cmd --permanent --add-port=21/tcp
firewall-cmd --permanent --add-service=ftp
firewall-cmd --reload
  • I edited my answer to include adding the ftp service – davidmneedham Sep 20 '18 at 16:13
  • I disabled the firewall now (don't need it), now it gives other error: Connection refused I think it's because port 21 is closed as you said, I tried telnet localhost 21 and the output: telnet: connect to address ::1: Connection refused how do I force it to open port 21? – Plompy Sep 20 '18 at 16:44

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.