Iperf from one interface to another on the same computer?
Solution 1
Yes, this traffic is transferred locally without reaching your physical interfaces. It is transferred using the loopback interface. The kernel detects that the destination is a local one, so the traffic is looped back to the machine itself without going through eth0 or eth1.
Solution 2
I know this is old, but posting in case it helps anyone else.
Quote from iPerf 2 user documentation
If iPerf is in server mode, then specifying a host with -c will limit the connections that iPerf will accept to the host specified. Does not work well for UDP.
I used this to perform TCP throughput tests on Windows 7 64bit from LAN to WiFi interfaces. Worked fine with either iperf 2.0.8 or 2.0.5, not sure about other versions. See below the commands used.
iperf.exe -B 192.168.0.1 -s -c 192.168.0.2 -P 0 -i 1 -p 5001 -f m
iperf.exe -B 192.168.0.2 -c 192.168.0.1 -P 1 -i 1 -p 5001 -f m -t 100 -F c:\data.bin
Related videos on Youtube
William Hilsum
Updated on September 18, 2022Comments
-
William Hilsum almost 2 years
I need to test network throughput of a server to/from itself (it's a lonnnng story!).
I love Iperf and use it across the network, but, I just can't figure out how to bind it to a single interface and only listen via that.
From the documentation, I would assume that this would work: iperf -B eth0 -s to bind one instance to eth0, then in another session: iperf -B eth1 -c ip.of.eth.1.
This doesn't work at all, and actually fails. If I use the ip instead of interface, it does work, but, throughput is at 29Gb/s - so, unless there is some magic going on where by I have a super server with a 30Gb/s card, I am guessing that I am not even touching the network and this is just going locally.
Can anyone help me here, or know of a better test/tool?
-
William Hilsum about 12 yearsI guessed this is what the issue was, just didn't know it was via the loopback - you just gave me the idea of disabling the loopback interface - however, this didn't help and now I can't even get the big speed! Also tried going via a switch instead of going direct (port to port).. Do you know another tool that can help? At the moment, I am thinking of just using another machine... However, I really want to try and keep it to just one if possible.
-
dwurf about 12 yearsTry putting the interfaces on different subnets, and ensure that ip forwarding is disabled. Just a thought!
-
Khaled about 12 years@WilliamHilsum: I think it can be done by some ARP trick.
-
William Hilsum almost 12 yearsI am certain this could be solved by editing the routing table, but, I just ran out of time and in the end, I just used a second server! Marking as answer though as it explained the problem and got me the closest... If someone else writes an actual answer on how to fix, I will switch the answer to that.
-
lolmaus - Andrey Mikhaylov over 8 yearsI've tried it on Linux, and it reports 43Gbit/s, which indicates that the traffic is not actually flowing through the network.
-
Davidw about 2 yearsThis does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review