Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

There are IP filters on bitbucket ssh requests ?

gaskb March 4, 2020

I usually use bitbucket at work and everything is ok.
When I try to use bitbucket at home everything is really really slow: pull (or fetch ecc..) a (very small, 5 MB) project keep minutes.
If I try the same pull at home using my office VPN everything works great.
Any ideas ? :)

1 answer

1 accepted

1 vote
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 4, 2020

Hello @gaskb,

Does that only happen for SSH operations? Can you try switching to altssh.bitbucket.org:443 for SSH to check if that helps? See more details here.

Hope this helps.

Cheers,
Daniil

gaskb March 4, 2020

Hi @Daniil Penkin 
Thanks for your answer.

I hope I understand your suggestion:

10 minutes using "normal" clone of 565 B test project

gas@Gas-mac - 13:09:48 - ~/dev/gas # git clone git@bitbucket.org:gas_team/test.git
Clone in 'test' in corso...
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Ricezione degli oggetti: 100% (3/3), fatto.
gas@Gas-mac - 13:19:57 - ~/dev/gas #

--

4 minutes using altssh.bitbucket.org :

(using 

Host altssh.bitbucket.org
Port 443

in ~/.ssh/config)

gas@Gas-mac - 13:49:33 - ~/dev/gas # git clone git@altssh.bitbucket.org:gas_team/test.git
Clone in 'test' in corso...
Warning: Permanently added the RSA host key for IP address '[18.205.93.16]:443' to the list of known hosts.
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Ricezione degli oggetti: 100% (3/3), fatto.
gas@Gas-mac - 13:53:23 - ~/dev/gas #

I think I still have the problem.

--


5 seconds using "normal" bitbucket through VPN:

gas@Gas-mac - 14:24:55 - ~/dev/gas # git clone git@bitbucket.org:gas_team/test.git
Clone in 'test' in corso...
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Ricezione degli oggetti: 100% (3/3), fatto.
gas@Gas-mac - 14:25:00 - ~/dev/gas #

 

I'm using gigabit connection, I'm pretty sure is not a speed issue :-)

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 4, 2020

That's exactly what I meant, thank you.

I'm trying to eliminate the options :) Can you please try another thing: clone over HTTPS. For your repository the command would look like this:

git clone https://gaskb@bitbucket.org/gas_team/test.git

It'll prompt for your password. In case you're using single sign-on, you'd need to generate an app password for cloning as your SSO password won't work.

Let me know how fast that clone would work.

Cheers,
Daniil

Like gaskb likes this
gaskb March 4, 2020

Hi @Daniil Penkin 

thanks so much again for your answer.

I tried using https and it works good !
I cloned the repository in 5 seconds.

gas@Gas-mac - 15:55:02 - ~/dev/gas # git clone https://gaskb@bitbucket.org/gas_team/test.git
Clone in 'test' in corso...
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Decompressione degli oggetti in corso: 100% (3/3), 531 byte | 265.00 KiB/s, fatto.
gas@Gas-mac - 15:55:07 - ~/dev/gas #

(I tried again using ssh and git is still "thinking" about to clone repo :-P )

Matteo

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 4, 2020

Awesome, thanks for trying that.

I have an idea of what might be happening. SSH supports both IPv4 and IPv6 and prefers IPv6 if the DNS resolution contains IPv6 address. Now, if your ISP doesn't support IPv6 properly, SSH will eventually fall back to IPv4, but this can take some time – I believe this is what you're facing. When you're on VPN, you traffic is tunnelled through first, and my assumption is that the ISP at your work doesn't have such issue with IPv6.

Not sure if this can cause such huge delays though, but let's try if enforcing IPv4 helps.

Can you please try setting GIT_SSH_COMMAND environment variable to "ssh -4" and then trying to pull over SSH again? Something like this (assuming you use bash shell):

GIT_SSH_COMMAND="ssh -4" git clone git@bitbucket.org:gas_team/test.git

If this makes the clone fast, we identified the problem correctly and you have following options for a permanent fix, starting from least intrusive:

  • modify SSH command just for Git to enforce IPv4, see git-config
  • enforce IPv4 for SSH by adding a property AddressFamily inet to /etc/ssh/sshd_config
  • disable IPv6 on your machine entirely. Assuming you're on a MacOS, you can find this option in Network settings → Interface → Advanced → TCP/IP → Set Configure IPv6 to Link-local only. Note that this is per interface, so you might need to set it for Wi-Fi and wired connections, depending on what you're using.

Let me know if enforcing IPv4 test helped.

Cheers,
Daniil

Like # people like this
gaskb March 4, 2020

WOW,
you got it right!

GIT_SSH_COMMAND="ssh -4" git clone git@bitbucket.org:gas_team/test.git

 works great.

I'll fix it on my machine and I'll report this issue to my ISP.

Thank you so much !

 

Cheers,

Matteo

Like Daniil Penkin likes this
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 4, 2020

Awesome, glad to hear that and always happy to help! =)

Cheers,
Daniil

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events