大网数据广告活动
服务器运维问答

Can I connect two Ethernet ports on the same adapter on the same host to test to check port performance and perform stress test?

· 52CE 我爱测

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 p…

问题原文

原帖链接 · 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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2023-12-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。