6

I have one Ethernet card with two 10G ports. I cannot verify the port performance and do a stress test by card to card with different systems. I would like to verify the port performance and stress test by connecting port A and port B on the same adapter on the single card, assign each port an IP address, and use iPerf to test?

I heard that by this way, since it is under the same OS, there will be no actual traffic generated between two ports.

I've been suggested to create a VM on the same system to separate both ports, so that it can make actual traffic to verify the performance and stress test, is that correct?

If I cannot connect both ports to verify the performance, how about below topology?

port A -> switch -> port B, where the switch is configured to forward the packet to port B.

Does this way make actual traffic?

nobody
  • 192

1 Answers1

8

I don't have a good way to test this right this moment, but I would try using namespaces to isolate the interfaces, and then test them as you would with two different systems.

ip netns add test1
ip netns add test2
ip link set eth0 netns test1
ip link set eth1 netns test2

Then you can grab a shell in both namespaces with ip netns exec test1 bash and ip netns exec test2 bash, and then run your test as you've described.

Deleting these namespaces with ip netns del testX will bring your interfaces back to their normal configuration, but for completeness you can also move them back manually.

To move the interfaces back to the default namespace you can use ip link set ethX netns 1 in each of the namespace shells, or ip -n testX link set ethY netns 1 in the default namespace. In these commands, 1 refers to the PID of a process in the namespace you want to use, in this case the init process, which serves as the default for the system.

EDIT: I recently installed a dual SFP+ NIC in one of my machines, and remembered this post, so I tried running this with some 10G fibre transceivers I had lying around. It works great!

Screenshot of two terminals with iperf running, showing a speed of 9.5 gigabits

Rob M
  • 1,513
  • 1
  • 12
  • 24