0

I try to specify wireless interface for curl, but something not working properly.

When lan cable disconnected, it works as expected. when lan cable is plugged in, connection timed out.

See log below, first attempt with plugged in lan cable.

user@user-Latitude-E6410:~/Downloads/ATS$ sudo curl http://speedtest4.ziggo.nl/testfile_20G.bin -o /dev/null --retry 0 --limit-rate 500000 --speed-limit 3000 --speed-time 2 --connect-timeout 5 --interface wlp2s0 --verbose   
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current  
                                 Dload  Upload   Total   Spent    Left  Speed  
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 212.54.52.11...  
* Local Interface wlp2s0 is ip 192.168.2.73 using address family 2  
* Local port: 0  
* Connected to speedtest4.ziggo.nl (212.54.52.11) port 80 (#0)  
> GET /testfile_20G.bin HTTP/1.1  
> Host: speedtest4.ziggo.nl  
> User-Agent: curl/7.47.0  
> Accept: */*  
>   
< HTTP/1.1 200 OK  
< Date: Thu, 20 Oct 2016 20:57:28 GMT  
< Server: Apache  
< Last-Modified: Tue, 10 Mar 2015 13:29:21 GMT  
< ETag: "500000000-510ef23751ccf"  
< Accept-Ranges: bytes  
< Content-Length: 21474836480  
< Content-Type: application/octet-stream  
<   
^{ [4018 bytes data]  
  0 20.0G    0 16.1M    0     0   487k      0 11:56:28  0:00:33 11:55:55  488k^C  
user@user-Latitude-E6410:~/Downloads/ATS$ sudo curl http://speedtest4.ziggo.nl/testfile_20G.bin -o /dev/null --retry 0 --limit-rate 500000 --speed-limit 3000 --speed-time 2 --connect-timeout 5 --interface wlp2s0 --verbose   
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current  
                                 Dload  Upload   Total   Spent    Left  Speed  
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 212.54.52.11...  
* Local Interface wlp2s0 is ip 192.168.2.73 using address family 2  
* Local port: 0  
  0     0    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--     0* Connection timed out after 5001 milliseconds  
  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0  
* Closing connection 0  
curl: (28) Connection timed out after 5001 milliseconds  
0

You might need to use --dns-interface.

From the man page:

--dns-interface <interface>
       Tell curl to send outgoing DNS requests through <interface>. This option is a counterpart to --interface (which does not affect DNS).
       The supplied string must be an interface name (not an address).
  • I don't have this option :( – Krisz Oct 21 '16 at 8:21
  • See error message: curl: (4) A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision. – Krisz Oct 21 '16 at 8:21

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.