问题原文
原帖链接 · Jacky Lee · CC BY-SA 4.0
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?
已采纳解答
原帖链接 · Rob M · CC BY-SA 4.0
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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
