LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-16-2019, 04:26 PM   #1
Sbrizzu
Member
 
Registered: Dec 2011
Distribution: Arch Linux
Posts: 40

Rep: Reputation: Disabled
Curl, git, other commands hang while trying to download file on Ubuntu 18


Currently on Ubuntu 18.04.12, when I try to download something from the terminal, or push to git or any similar command it always hangs on the download either indefinitely or for a very long time. However when I Ctrl+C and try again it usually works after a couple of tries.

I was able to diagnose a bit and the hanging happens when curl tries to resolve the ipv6 address of the server instead of the ipv4. Problem is, I don't have ipv6 configured or an ipv6 DNS server setup for that matter, so I'm really lost why it would try that (or at least why it would try that so many times and not revert back to ipv4). I disabled ipv6 with sysctl but it doesn't make a difference.

I'm a bit lost here since this doesn't seem to happen on other machines in the same network, but I believe this one is the only one with Ubuntu 18.
 
Old 10-17-2019, 03:51 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 12,793
Blog Entries: 9

Rep: Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491
Sounds like a general networking problem.
Let's start with
Code:
ping -4 archive.org
ping -6 google.com
 
Old 10-17-2019, 04:12 AM   #3
Sbrizzu
Member
 
Registered: Dec 2011
Distribution: Arch Linux
Posts: 40

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
Sounds like a general networking problem.
Let's start with
Code:
ping -4 archive.org
ping -6 google.com
I don't have any ipv6 connection set up except for link local.
ping -4 works fine, ping -6 gives
Code:
connect: Network is unreachable
.
 
Old 10-17-2019, 03:12 PM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 12,793
Blog Entries: 9

Rep: Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491
Quote:
Originally Posted by Sbrizzu View Post
I don't have any ipv6 connection set up except for link local.
So that's on purpose?
AFAIK, an IPv4 nameserver can still return IPv6 addrsses, so... have you completely disabled IPv6 on your system?
There's something in /etc, sysctl.conf IIRC, that needs to be edited accordingly. or kernel command line.
 
Old 10-17-2019, 04:27 PM   #5
Sbrizzu
Member
 
Registered: Dec 2011
Distribution: Arch Linux
Posts: 40

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
So that's on purpose?
AFAIK, an IPv4 nameserver can still return IPv6 addrsses, so... have you completely disabled IPv6 on your system?
There's something in /etc, sysctl.conf IIRC, that needs to be edited accordingly. or kernel command line.
I don't care for ipv6 so I haven't set anything up. I already tried disabling ipv6 with everything you mentioned but I got nothing out of it, curl would still try to resolve ipv6 addresses. I have some degree of control over the DNS server since I use pfSense as a resolver+forwarder, do you think I could do anything with that?
 
Old 10-18-2019, 02:06 PM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 12,793
Blog Entries: 9

Rep: Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491
what exactly did or did you not do?
we need information if you want help.
please read the first two links in my signature.
 
Old 10-18-2019, 07:16 PM   #7
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,679

Rep: Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777
make curl noisy

Code:
curl -v ifconfig.me
ifconfig.me will just return your external IP address

sometimes you may need to ask curl to follow redirects with -L

long shot
when you are having network troubles one of the causes can be your system clock being out of sync

Unlikely, and I have no idea why I thought of that.
still, confirm the date/time is correct
 
Old 10-18-2019, 09:40 PM   #8
verndog
Member
 
Registered: Oct 2007
Posts: 162

Rep: Reputation: 24
I have to disable ipv6 some times or my system will hang. Try this temp fix on ipv6. See if it makes a difference:
Code:
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 && sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
 
Old 10-24-2019, 01:10 PM   #9
Sbrizzu
Member
 
Registered: Dec 2011
Distribution: Arch Linux
Posts: 40

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Firerat View Post
make curl noisy

Code:
curl -v ifconfig.me
ifconfig.me will just return your external IP address

sometimes you may need to ask curl to follow redirects with -L

long shot
when you are having network troubles one of the causes can be your system clock being out of sync

Unlikely, and I have no idea why I thought of that.
still, confirm the date/time is correct
I checked the clock and it is fine, however when I try to curl it gives me:
Code:
* Rebuilt URL to: ifconfig.me/
*   Trying 216.239.34.21...
* TCP_NODELAY set
* connect to 216.239.34.21 port 80 failed: Connection timed out
*   Trying 216.239.36.21...
* TCP_NODELAY set
* After 83934ms connect time, move on!
* connect to 216.239.36.21 port 80 failed: Connection timed out
*   Trying 216.239.38.21...
* TCP_NODELAY set
* Connected to ifconfig.me (216.239.38.21) port 80 (#0)
> GET / HTTP/1.1
> Host: ifconfig.me
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu, 24 Oct 2019 17:07:15 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 11
< x-cloud-trace-context: c711059e58d1e24f6fc97610cc424ef6/1629997535873016237
< Access-Control-Allow-Origin: *
< X-Frame-Options: DENY
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< Referrer-Policy: strict-origin-when-cross-origin
< X-Cache: MISS from localhost
< X-Cache-Lookup: HIT from localhost:3128
< Via: 1.1 google, 1.1 localhost (squid/3.5.27)
< Connection: keep-alive
<
* Connection #0 to host ifconfig.me left intact
while on another machine it works immediately.
 
Old 10-24-2019, 01:10 PM   #10
Sbrizzu
Member
 
Registered: Dec 2011
Distribution: Arch Linux
Posts: 40

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by verndog View Post
I have to disable ipv6 some times or my system will hang. Try this temp fix on ipv6. See if it makes a difference:
Code:
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 && sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
I already tried that but it doesn't make a difference sadly.
 
Old 10-24-2019, 01:31 PM   #11
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,679

Rep: Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777
Quote:
Originally Posted by Sbrizzu View Post
I checked the clock and it is fine, however when I try to curl it gives me:
Code:
<snip>
< X-Cache: MISS from localhost
< X-Cache-Lookup: HIT from localhost:3128
< Via: 1.1 google, 1.1 localhost (squid/3.5.27)
< Connection: keep-alive
<snip>
while on another machine it works immediately.
what does it look like on the working one

the one that fails is going through a local squid proxy
 
Old 10-24-2019, 01:32 PM   #12
Sbrizzu
Member
 
Registered: Dec 2011
Distribution: Arch Linux
Posts: 40

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Firerat View Post
what does it look like on the working one

the one that fails is going through a local squid proxy
Both are behind a pfSense with the squid proxy you see here.
This is the response on another machine:
Code:
* Rebuilt URL to: ifconfig.me/
*   Trying 216.239.34.21...
* TCP_NODELAY set
* Connected to ifconfig.me (216.239.34.21) port 80 (#0)
> GET / HTTP/1.1
> Host: ifconfig.me
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu, 24 Oct 2019 17:28:28 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 11
< x-cloud-trace-context: c41bc91ad31ee2624520e2827a5e9c3d/1184538786210428103
< Access-Control-Allow-Origin: *
< X-Frame-Options: DENY
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< Referrer-Policy: strict-origin-when-cross-origin
< X-Cache: MISS from localhost
< X-Cache-Lookup: HIT from localhost:3128
< Via: 1.1 google, 1.1 localhost (squid/3.5.27)
< Connection: keep-alive
<
* Connection #0 to host ifconfig.me left intact

Last edited by Sbrizzu; 10-24-2019 at 01:35 PM.
 
Old 10-24-2019, 01:34 PM   #13
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,679

Rep: Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777
Quote:
Originally Posted by Sbrizzu View Post
Both are behind a pfSense with the squid proxy you see here.
both machines are not using the same squid proxy
they are each using their own ( localhost:3128 )


Edit

ahh, wait
I may have got confused a little

it is working, eventually
Code:
curl -v --proxy localhost:3128 ifconfig.me
<nip>
< Via: 1.1 google
< X-Cache: MISS from localhost
< X-Cache-Lookup: HIT from localhost:3128

Last edited by Firerat; 10-24-2019 at 01:43 PM.
 
Old 10-24-2019, 01:42 PM   #14
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,679

Rep: Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777
are you getting an IP from ifconfig.me?

add on echo to the end, as it can get lost

Code:
curl ifconfig.me;echo
curl -v ifconfig.me;echo
does the working one get the timeouts?
 
Old 10-24-2019, 01:56 PM   #15
Sbrizzu
Member
 
Registered: Dec 2011
Distribution: Arch Linux
Posts: 40

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Firerat View Post
are you getting an IP from ifconfig.me?

add on echo to the end, as it can get lost

Code:
curl ifconfig.me;echo
curl -v ifconfig.me;echo
does the working one get the timeouts?
I am not familiar with the inner workings of squid but I can assure you there is no squid installed except on the router (unless Ubuntu now ships with it).

Yes, both get an IP from ifconfig.me (I clipped it from the code, sorry if that was confusing), and only one of them gets the timeouts, the other works perfectly.
 
  


Reply

Tags
curl, git, network, ubuntu 18.04


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Gitpod git-bolts git-IDE onto GitHub for in-browser code git-editing LXer Syndicated Linux News 0 09-05-2018 05:50 AM
[SOLVED] Slackware ARM 14.2 - Updates Rollback - curl-7.57.0 - curl-7.58.0 abga Slackware - ARM 13 02-02-2018 12:44 PM
CentOS 6.7 has really OLD curl. Best way to update curl? sneakyimp Linux - Server 4 04-26-2016 04:06 PM
[SOLVED] Can't install Git repo (I don't git git ) Nemus Linux - Software 3 05-20-2011 03:09 PM
cURL: Server has many IPs, how would I make a cURL script use those IPs to send data? guest Programming 0 04-11-2009 12:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration