Skip to content

Commit

Permalink
interface.md: expand on --interface use
Browse files Browse the repository at this point in the history
  • Loading branch information
bagder committed Dec 19, 2024
1 parent d4f8665 commit a7f240f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions usingcurl/connections/interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,19 @@ would like to "bind" your local end of the communication to, with the

curl --interface machine2 https://www.example.com/

We discourage use of a hostname in there, because how that forces curl to do a
name resolve to figure out an IP address. If you cannot specify an interface
name, consider using a fixed IP address.

In addition, you can ask to explicitly use and IP address or interface name to
prevent curl from having to guess. Do this by prefix the string with `if!` for
interface name or `host!` for an IP address. Like this:

curl --interface "host!192.168.0.2" https://www.example.com/

curl --interface "if!eth1" https://www.example.com/

You can even specify a specific IP and on a specific interface by providing
both like this:

curl --interface "if!eith1!192.168.0.2" https://www.example.com/

0 comments on commit a7f240f

Please sign in to comment.