Search code examples
pythonftpnat

Can I connect 2 NAT-covered computers using FTP?


I have 2 computers behind diferent NAT's and FTP-server. How can i connect computers to each other without server program? I read about STUN and UDP hole punching, but as i see, it needs some server side program, isn't it? It's will be used in python program.


Solution

  • To do this without a server you could setup port forwarding on one of the NAT routers. e.g. machine1 behind nat1, machine2 behind nat2. Setup a port on nat1 forward to the FTP port of machine1. You should then be able to FTP from machine2 using the public IP address of nat1. Use passive mode FTP to avoid having to open up more ports through the NAT routers.