From 109eccdb0aeb004ad93c2f488d2f8c2488727fc0 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 19 Dec 2024 16:40:27 +0100 Subject: [PATCH] interface.md: expand on --interface use --- usingcurl/connections/interface.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/usingcurl/connections/interface.md b/usingcurl/connections/interface.md index 6b4715d6ec..b9b7507c99 100644 --- a/usingcurl/connections/interface.md +++ b/usingcurl/connections/interface.md @@ -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/