how to use cURL on specific interface how to use cURL on specific interface curl curl

how to use cURL on specific interface


Seems like curl support --interface option

curl --interface eth0 


For anyone that comes here looking for the same answer, but for wlan0 or whatever the non-default interface is on Raspberry/RPi, you'll need to sudo or run as root.

In my case I was running eth0 and wlan0, but eth0 was my default NIC. Ping worked without sudo, curl didn't have verbose enough logging beyond saying the connection timed out and only worked without sudo on eth0. Traceroute finally led me to my answer when the error said "setsockopt SO_BINDTODEVICE: Operation not permitted"