Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bind to interface with client #865

Closed
shawnl opened this issue May 11, 2019 · 13 comments
Closed

Bind to interface with client #865

shawnl opened this issue May 11, 2019 · 13 comments

Comments

@shawnl
Copy link

shawnl commented May 11, 2019

Context

  • Version of iperf3:
    iperf 3.6 (cJSON 1.5.2)

  • Hardware:
    model : IBM pSeries (emulated by qemu)

  • Operating system (and distribution, if any):
    Linux test-wireguard 4.19.0-5-powerpc64le setting of window size should be explicit #1 SMP Debian 4.19.37-1 (2019-05-05) ppc64le

Enhancement Request

  • Current behavior

can bind for server, but not client.

  • Desired behavior
    Force traffic to go out a certain interface with client

  • Implementation notes
    I am trying to benchmark wireguard through localhost, but I cannot with iperf3 because i cannot specify the client interface so that the traffic goes through wireguard,

@jonesmz
Copy link

jonesmz commented May 15, 2019

I'm also experiencing this issue on OpenWRT 18.06.0

I tell iperf3 to use the specific ipaddress that I want it to use (my wifi connection, in this case), and it claims to be using it, but is obviously not since it's getting speeds far higher than wifi should be able to use.

If I unplug the ethernet cable, and run the command again, I get significantly lower speeds.

What debugging information can I provide?

@shawnl
Copy link
Author

shawnl commented May 15, 2019

@jonesmz You can work around this with network namespaces, but it isn't ideal. (and it works better for my use case than yours, as an interface can only be in one network namespace at a time)

@shawnl
Copy link
Author

shawnl commented May 15, 2019

@jonesmz There is no debug information to provide. The feature just doesn't exist. While it will require reading up on the APIs and knowing some C, this feature is small enough that it could be implemented by someone without much programming experience. If you do decide to work on it, ping me when you submit a pull request and I will review it.

@jonesmz
Copy link

jonesmz commented May 15, 2019

The feature may not exist, but iperf3 --help clearly says that it does, for both client, and also server :(

@shawnl
Copy link
Author

shawnl commented May 15, 2019

@jonesmz that is a differn't feature. That is the address passed to bind() for the server, not binding to an interface for outbound. The latter is a feature rarely useful outside of networking stuff.

You can also work around this problem with very complicated networking rules (using fwmark) which I don't understand.

@shawnl
Copy link
Author

shawnl commented May 15, 2019

@jonesmz What we want is SO_BINDTODEVICE

@jonesmz
Copy link

jonesmz commented May 15, 2019

Well, I think we may be talking past each other here.

Here's the output from iperf3 --help.

Server or Client:
  -p, --port      #         server port to listen on/connect to
  -f, --format   [kmgtKMGT] format to report: Kbits, Mbits, Gbits, Tbits
  -i, --interval  #         seconds between periodic throughput reports
  -F, --file name           xmit/recv the specified file
  -A, --affinity n/n,m      set CPU affinity
  -B, --bind      <host>    bind to the interface associated with the address <host>

If -B is not supported in the client, then it should be moved to the server specific section of the --help output.

If it's supposed to be used with the client mode, why doesn't it work?

You say it doesn't work because the feature doesn't exist in the iperf3 codebase. If that's the case, then the output from --help should be fixed to properly reflect the supported features.

@bmah888
Copy link
Contributor

bmah888 commented May 17, 2019

Out of curiosity, if you use -B on the client, do you actually see the control and test traffic going over the correct interfaces? (Say with tcpdump?) -B is supposed to work on the client side. I haven't put together a proper test environment for this but in some extremely limited testing on my laptop I haven't found any obvious failures yet.

@bmah888
Copy link
Contributor

bmah888 commented May 4, 2020

-B works for both the client and server side on perfSONAR, which was the original consumer of iperf3. I'm going to close this issue for now.

@bmah888 bmah888 closed this as completed May 4, 2020
@geerlingguy
Copy link

geerlingguy commented Dec 29, 2020

Just wanted to mention that it seems like if I have two interfaces configured on my Raspberry Pi, then --bind doesn't seem to allow me to specify an interface. The first interface (e.g. eth0 even if I bind to the IP of eth1) is always chosen.

Tested with both iperf3 3.6 from the Pi OS repo and a source install.

@bmah888
Copy link
Contributor

bmah888 commented Jan 4, 2021

Just wanted to mention that it seems like if I have two interfaces configured on my Raspberry Pi, then --bind doesn't seem to allow me to specify an interface. The first interface (e.g. eth0 even if I bind to the IP of eth1) is always chosen.

Tested with both iperf3 3.6 from the Pi OS repo and a source install.

@geerlingguy Try --bind and --bind-dev on a relatively recent tip-of-master build (for example --bind 192.168.2.1 --bind-dev eth1). #1089 and #1097 have more information.

@geerlingguy
Copy link

@bmah888 - Oh, thanks! I will try that out in my next round of testing!

@nyrahul
Copy link

nyrahul commented Apr 13, 2021

Just wanted to mention that it seems like if I have two interfaces configured on my Raspberry Pi, then --bind doesn't seem to allow me to specify an interface. The first interface (e.g. eth0 even if I bind to the IP of eth1) is always chosen.
Tested with both iperf3 3.6 from the Pi OS repo and a source install.

@geerlingguy Try --bind and --bind-dev on a relatively recent tip-of-master build (for example --bind 192.168.2.1 --bind-dev eth1). #1089 and #1097 have more information.

This works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants