I followed Using Firewall Rules  |  VPC  |  Google Cloud Platform VPC documentation, however whenever I try connect, I get following:

Operation timed out

client side - verbose mode:

$ sftp -v -P 2222 username@x.x.x
OpenSSH_6.2p2, OpenSSL 0.9.8y 5 Feb 2013
debug1: Reading configuration data /home/alexus/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to x.x.x [x.x.x.x] port 2222.
debug1: connect to address x.x.x.x port 2222: Operation timed out
ssh: connect to host x.x.x port 2222: Operation timed out
Connection closed

server side:

due to my packets do not reach destination therefor nothing in the logs (or I'm looking in wrong place).

quick recap:

  • VPC:
    • create a firewall rule
    • name / description (sftp2222/sftp)
    • specified target tags (tag)
    • specified source ip ranges (x.x.x.x/32)
    • specified protocol and ports (tcp:2222)
  • GCE
    • network tag specific instance

Please advise.


I don't want to bore anyone with details, however the answer (at least for me) was pretty simple...

  • source ip - long story short, it was incorrect.

[I would create a comment, but I don't have enough reputation]

Check if the instance is being tagged by the tag "sftp2222". Also check if the the ssh daemon is set up to listen to the port 2222 (In your sshd_config these 2 take care of this: - ListenAddress - Port). As other test, allow the ICMP in the same firewall rule and try to ping the instance. If it works, the firewall rule is properly set up, if not, there is something missconfigured in the firewall rule.

  • thanks for that answer) I double checked everything: tagging check, while ssh daemon runs inside of Docker container and listens on port 22, Docker maps ports to to container:22/tcp (check), I can ssh to locally without issue, I can PING by default. – alexus Feb 8 '18 at 15:21
I would have added a comment instead but I have a privilege lower than 50.

Are you trying to sftp into a GKE Docker container?

Have you checked that your firewall rule has the correct priority set and that no other rule above it is hampering you efforts?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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