Search code examples
linuxcurl

How to specify the source IP address with curl?


My server has 5 different external IP addresses (all working).

I added them by using:

 ip addr add xx.xx.xx.xx/32 dev eth0
 ip addr add yy.yy.yy.yy/32 dev eth0
 ip addr add zz.zz.zz.zz/32 dev eth0

How can I tell curl to use zz.zz.zz.zz as the source IP address?


Solution

  • You should be able to use

    curl --interface zz.zz.zz.zz http://example.com/