0009 MP2.5GD(Dual 2.5G ETH):修订间差异

来自Mcuzone Wiki
(创建页面,内容为“== '''关键词''' == 树莓派5、PCIe、Switch、RL8125、2.5Gbps、以太网、iperf3测速 == '''一、简介''' == 树莓派5具备一个16Pin的PCIe接口,我们可以利用该接口进行多种外设的扩展。这次我们通过PCIe接口搭配PCIe Switch芯片扩展成两路PCIe接口,然后通过2个RTL8125芯片实现双2.5Gbps以太网的扩展。该扩展板在树莓派系统下无需驱动,上电后即可自动识别成eth1和eth2。如果使…”)
 
 
(未显示同一用户的8个中间版本)
第1行: 第1行:
== '''关键词''' ==
[[0009 MP2.5GD(双2.5G以太网)|切换语言为中文]]
树莓派5、PCIe、Switch、RL8125、2.5Gbps、以太网、iperf3测速


== '''一、简介''' ==
== '''Keywords''' ==
树莓派5具备一个16Pin的PCIe接口,我们可以利用该接口进行多种外设的扩展。这次我们通过PCIe接口搭配PCIe Switch芯片扩展成两路PCIe接口,然后通过2个RTL8125芯片实现双2.5Gbps以太网的扩展。该扩展板在树莓派系统下无需驱动,上电后即可自动识别成eth1和eth2。如果使用Ubuntu系统则需要先安装RTL8125的驱动才可使用。
Raspberry Pi 5, PCIe, Switch, RL8125, 2.5Gbps, Ethernet, iperf3 Ethernet Speed Test


== '''二、硬件资源''' ==
== '''I. Introduction''' ==
1. 基于树莓派5的PCIE接口,采用3cm PCIE屏蔽线和树莓派5链接;
The Raspberry Pi 5 is equipped with a 16-pin PCIe interface, through which we can attach various PCIe devices. This time, we expand the PCIe interface into two PCIe ports using a PCIe Switch chip, and then through two RTL8125 chips, we achieve dual 2.5Gbps Ethernet expansion. The expansion board is driver-free under the Raspberry Pi OS and is automatically recognized as eth1 and eth2 upon power-up. If using Ubuntu system, the RTL8125 driver needs to be installed first in order to use the board.


2. 采用PCIe Switch芯片,将PCIE一扩二, 扩展两路RTL8125,2.5Gbps以太网;
== '''II. Hardware Spec''' ==
1. Use a 0.5mm 16-pin PCIe cable to connect to the PCIe interface on the Raspberry Pi 5.


3. 树莓派官方OS和Openwrt系统免驱,Ubuntu系统下需安装驱动;
2. Using a PCIe Switch chip to expand one PCIe port into two, extending to two RTL8125 2.5Gbps Ethernet ports.


4. 板载2.54-2p辅助供电接口,在同时使用2路2.5G网口满负载工作时若遇到供电不足,可以通过辅助供电接口供电;
3. The RTL8125 2.5G Ethernet adapter is driver-free in the official Raspberry Pi OS and OpenWrt systems, but requires driver installation in Ubuntu systems.


5. 四个M2.5固定孔,和树莓派5匹配;板子上方内凹设计,方便40Pin GPIO的操作使用;
4. The onboard 2.54-2p auxiliary power supply interface can be used to provide additional power if there is insufficient power when both 2.5G Ethernet ports are operating at full load simultaneously.


6. 采用优质电子元器件和沉金工艺,无铅生产;PCB通过UL认证和ROHS认证,防火等级94V-0。
5.Gold immersion PCB process, lead-free production, certified by UL, compliant with ROHS standards, and has a fire rating of 94V-0.


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_45.jpg
6. The board has four M2.5 mounting holes, with a recessed design on the top of the board to facilitate the use of the 40-Pin GPIO.


== '''三、系统烧写及设置''' ==
== '''III. Software Spec''' ==


=== 3.1 概述 ===
=== 3.1Overview ===
本文档采用树莓派OS、Ubuntu OS和OpenWrt系统进行测试。
This document uses the Raspberry Pi OS, Ubuntu system and OpenWrt system for testing.


1) 树莓派OS的版本为2024-07-04-raspios-bookworm-arm64.img.xz,树莓派OS下载地址:
1)The version of the Raspberry Pi OS is: 2024-07-04-raspios-bookworm-arm64.img.xz
 
You can download the Raspberry Pi OS in:


https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit
https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit


2) Ubuntu OS的版本为ubuntu-24.04-preinstalled-desktop-arm64+raspi.img.xz,Ubuntu OS下载地址:
2)The version of the Ubuntu system is: ubuntu-24.04-preinstalled-desktop-arm64+raspi.img.xz
 
You can download the Ubuntu system in:


https://ubuntu.com/download/raspberry-pi
https://ubuntu.com/download/raspberry-pi


3) OpenWrt系统版本为:openwrt-bcm27xx-bcm2712-rpi-5-squashfs-sysupgrade-linux-6.1.100-20240805.img.gz
3)The version of the OpenWrt system is: openwrt-bcm27xx-bcm2712-rpi-5-squashfs-sysupgrade-linux-6.1.100-20240805.img.gz


=== 3.2 系统烧写在SD(TF)卡上 ===
=== 3.2 System flashed onto the SD (TF) card ===
[[0005 MPS2242 2280 2280P(单SSD扩展板)#3.2 从TF卡启动|点击直达烧写方法说明]]
[[0005 MPS2242 2280 2280P(Single SSD Expansion Board)#3.2 Boot from TF card|Click here to read the instructions for System flashing]]


== '''四、树莓派系统下使用演示''' ==
== '''IV. Work with Raspberry Pi OS''' ==


=== 4.1 Internet网络测试 ===
=== 4.1 4.1 Internet test ===
MP2.5GD扩展板上的2.5G网口在树莓派OS下即插即用,系统起来后,在树莓派终端中输入ifconfig -a命令,两个网口分别被识别为eth1和eth2:
The 2.5G Ethernet ports on the MP2.5GD expansion board are plug-and-play without requiring drivers under Raspberry Pi OS. Once the system is up, excute the command <code>ifconfig -a</code> in the Raspberry Pi terminal, and the 2.5G Ethernet ports will be recognized as eth1 and eth2:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_04.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_04.jpg


对两个网口分别连外网(200M宽带)测速,结果如下:
Open https://www.speedtest.cn/ on the PC to test speed. The speed test results for the 2.5G Ethernet ports connected to the Internet (200M broadband) are as follows:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_39.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_48.jpg


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_40.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_49.jpg


'''''注意:网络测速受网络环境和测试方法影响,速度请以实际为准,本测试仅供参考。'''''
'''''Note: The speed test can be affected by the network environment and the testing method. Speeds should be considered based on actual results; this test is for reference only.'''''


=== 4.2 2.5G内网测试 ===
=== 4.2 2.5G intranet test ===
安装网络测速工具iperf3:
Install the network speed testing tool iperf3:


<code>sudo apt install iperf3</code>
<code>sudo apt install iperf3</code>
第60行: 第64行:
http://www.mcuzone.com/wiki/0008_MPS2_5G/0008_MPS2_5G_04.jpg
http://www.mcuzone.com/wiki/0008_MPS2_5G/0008_MPS2_5G_04.jpg


利用iperf3,通过2.5G路由器,在树莓派OS与PC之间进行测速。
Use iperf3 to perform speed tests between the Raspberry Pi OS and the PC through a 2.5G router.


'''''4.2.1 eth1测速结果如下:'''''
'''''4.2.1 The speed test results for eth1 are as follows:'''''


当树莓派OS作为client时,速度大约为2.02Gbps:
When Raspberry Pi OS acts as a client, the speed is about 2.02 Gbps:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_07.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_07.jpg


当树莓派OS作为server时,速度大约为1.84Gbps:
When Raspberry Pi OS acts as a server, the speed is about 1.84 Gbps:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_08.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_08.jpg


'''''4.2.2 eth2测速结果如下:'''''
'''''4.2.2 The speed test results for eth2 are as follows:'''''


当树莓派OS作为client时,速度大约为2.01Gbps:
When Raspberry Pi OS acts as a client, the speed is about 2.01 Gbps:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_09.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_09.jpg


当树莓派OS作为server时,速度大约为1.84Gbps:
When Raspberry Pi OS acts as a server, the speed is about 1.84 Gbps:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_10.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_10.jpg


'''''注意:网络测速受网络环境和测试方法影响,速度请以实际为准,本测试仅供参考。'''''
'''''Note: The speed test can be affected by the network environment and the testing method. Speeds should be considered based on actual results; this test is for reference only.'''''


=== 4.3 固定2.5G网口的MAC地址 ===
=== 4.3 Fix the MAC address of the 2.5G Ethernet port ===
2.5G网口为RTL8125网卡,在使用过程中的MAC地址是不固定的,每次重新上电后MAC地址都会随机改变。下面讲解如何为RTL8125网卡设置固定MAC地址。
The 2.5G Ethernet port uses the RTL8125 network card, and during use, the MAC address is not fixed. Each time the device is powered on again, the MAC address changes randomly. The following explains how to set a fixed MAC address for the RTL8125 network card.


本讲解也适用于Ubuntu系统。
This explanation also applies to the Ubuntu system.


首先在树莓派终端中查看RTL8125网卡的识别信息:
First, check the identification information of the RTL8125 network card in terminal:


<code>ipconfig -a</code>
<code>ipconfig -a</code>
第95行: 第99行:
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_46.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_46.jpg


这里两块RTL8125网卡分别为eth1和eth2,实际操作中可能会因为系统识别名称不同而不同。
Here, two RTL8125 network cards are identified as eth1 and eth2, but in practice, the names recognized by the system might be different.


然后输入:
Then input:


<code>sudo mousepad /etc/systemd/system/macspoof@eth1.service</code>
<code>sudo mousepad /etc/systemd/system/macspoof@eth1.service</code>


或:
Or:


<code>sudo nano /etc/systemd/system/macspoof@eth1.service</code>
<code>sudo nano /etc/systemd/system/macspoof@eth1.service</code>


eth1为上面显示的网卡识别名称。
eth1 is the name recognized by the system for the network card shown above.


运行上面的命令后会新建一个文档,输入以下文本:
Executing the above command will create a new document, then enter the following text:


[<code>Unit]</code>
[<code>Unit]</code>
第133行: 第137行:
<code>WantedBy=multi-user.target</code>
<code>WantedBy=multi-user.target</code>


其中“xx:xx:xx:xx:xx:xx”为想要指定的MAC地址,可以按MAC地址格式自行确定(不要和其它网络设备重复),设置完成后保存并退出。
Here, "xx:xx:xx:xx:xx:xx" represents the MAC address you wish to assign. You can determine it according to the MAC address format (make sure it does not duplicate the MAC address of other network devices). After setting it, save and exit.


随后输入下面的命令使能服务:
Then execute the following command to enable the service:


<code>sudo systemctl enable macspoof@eth1.service</code>
<code>sudo systemctl enable macspoof@eth1.service</code>


这样就完成了对eth1的固定MAC地址。
This completes the fixation of the MAC address for eth1.


对如eth2这样的其它网卡,也是按照上述步骤进行操作。
For other network interfaces such as eth2, follow the same steps as described above.


全部操作完毕后重启系统,系统重启完毕后,执行<code>ipconfig -a</code>即可看到MAC地址更改成功:
After completing all operations, restart the system. Once the system has finished rebooting, execute <code>ipconfig -a</code> to see that the MAC address has been successfully changed:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_47.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_47.jpg


== '''五、Ubuntu系统下使用演示''' ==
== '''V. Work with Ubuntu System''' ==


=== 5.1 安装Ubuntu系统下RTL8125驱动 ===
=== 5.1 Install the RTL8125 driver in Ubuntu system ===
MP2.5GD扩展板上的2.5G网口在Ubuntu系统下不能即插即用,需要安装RTL8125驱动。
The 2.5G Ethernet port on the MP2.5GD expansion board is not plug-and-play in Ubuntu system and requires the installation of the RTL8125 driver.


因为树莓派5的无线网卡模块在Ubuntu系统下是即插即用的,所以我们需要使用无线网卡连接无线网络:
Since the wireless network card module of the Raspberry Pi 5 is plug-and-play in the Ubuntu system, we need to use the wireless network card to connect to a wireless network:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_11.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_11.jpg


也可以使用网线连接树莓派5上的原生网口。
You can also use an Ethernet cable to connect to the native Ethernet port on the Raspberry Pi 5.


Ubuntu系统默认不安装ifconfig工具,所以需要手动安装:
The ifconfig tool is not installed by default in Ubuntu system, so it needs to be installed manually:


<code>sudo apt install net-tools</code>
<code>sudo apt install net-tools</code>
第164行: 第168行:
http://www.mcuzone.com/wiki/0008_MPS2_5G/0008_MPS2_5G_13.jpg
http://www.mcuzone.com/wiki/0008_MPS2_5G/0008_MPS2_5G_13.jpg


输入<code>ifconfig -a</code>,可见此时并没有显示2.5G网卡:
Excute <code>ifconfig</code> -a, and you can see that the 2.5G network cards is not displayed at this time.


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_12.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_12.jpg


接下来我们开始安装RTL8125驱动。
Next, we will begin installing the RTL8125 driver:


首先需要更新系统:
First, you need to update the system:


<code>sudo apt-get update</code>
<code>sudo apt-get update</code>
第176行: 第180行:
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_13.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_13.jpg


接着准备编译环境:
Next, prepare the compilation environment:


<code>sudo apt-get install --reinstall linux-headers-$(uname -r) linux-headers-generic build-essential dkms</code>
<code>sudo apt-get install --reinstall linux-headers-$(uname -r) linux-headers-generic build-essential dkms</code>
第182行: 第186行:
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_14.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_14.jpg


然后安装驱动:
Then install the driver:


<code>sudo apt-get install r8125-dkms</code>
<code>sudo apt-get install r8125-dkms</code>
按提示安装即可:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_15.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_15.jpg


安装完成后输入:
After installation is complete, excute:


<code>sudo modprobe r8125</code>
<code>sudo modprobe r8125</code>
第196行: 第198行:
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_16.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_16.jpg


输入<code>ifconfig -a</code>就可以看到两个enxxx的网卡接口,这样就安装完毕2.5G网卡驱动:
Enter <code>ifconfig -a</code> to see two network interfaces called enxxx, which indicates that the 2.5G network cards driver has been successfully installed:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_17.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_17.jpg


=== 5.2 Internet网络测试 ===
=== 5.2 Internet test ===
对两个网口分别连外网(200M宽带)测速,结果如下:
Open https://www.speedtest.cn/ on the PC to test speed. The speed test results for the 2.5G Ethernet ports connected to the Internet (200M broadband) are as follows:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_18.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_50.jpg


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_19.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_51.jpg


'''''注意:网络测速受网络环境和测试方法影响,速度请以实际为准,本测试仅供参考。'''''
'''''Note: The speed test can be affected by the network environment and the testing method. Speeds should be considered based on actual results; this test is for reference only.'''''


如果使用Ubuntu内置的Firefox浏览器时运行速度很慢或者经常无响应,建议安装轻量浏览器Falkon:
If the built-in Firefox browser in Ubuntu system runs very slowly or frequently becomes unresponsive, it is recommended to install the lightweight browser Falkon:


<code>sudo apt install falkon</code>
<code>sudo apt install falkon</code>


=== 5.3 2.5G内网测试 ===
=== 5.3 2.5G intranet test ===
安装网络测速软件iperf3:
Install the network speed testing tool iperf3:


<code>sudo apt install iperf3</code>
<code>sudo apt install iperf3</code>
第220行: 第222行:
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_20.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_20.jpg


利用iperf3,在Ubuntu系统与PC之间进行测速。
Use iperf3 to perform speed tests between the Raspberry Pi OS and the PC through a 2.5G router.


'''''enp3s0测速结果如下'''''
'''''The speed test results for enp3s0 are as follows:'''''


当Ubuntu系统作为client时,速度大约为2.34Gbps:
When Ubuntu system acts as a client, the speed is about 2.34 Gbps:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_21.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_21.jpg


当Ubuntu系统作为server时,速度大约为1.83Gbps:
When Ubuntu system acts as a server, the speed is about 1.83Gbps:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_22.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_22.jpg


'''''enp4s0测速结果如下:'''''
'''''The speed test results for enp4s0 are as follows:'''''


当Ubuntu系统作为client时,速度大约为2.35Gbps:
When Ubuntu system acts as a client, the speed is about 2.35 Gbps:http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_23.jpg


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_23.jpg
When Ubuntu system acts as a server, the speed is about 1.83Gbps:
 
当Ubuntu系统作为server时,速度大约为1.83Gbps:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_24.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_24.jpg


'''''注意:网络测速受网络环境和测试方法影响,速度请以实际为准,本测试仅供参考。'''''
'''''Note: The speed test can be affected by the network environment and the testing method. Speeds should be considered based on actual results; this test is for reference only.'''''


== '''六、OpenWrt系统操作演示''' ==
== '''VI. Work with OpenWrt System''' ==


=== 6.1 概述 ===
=== 6.1 Overview ===
MP2.5GD扩展板在OpenWrt系统下,扩展板上的'''两个2.5G网口可以作为LAN口''',树莓派5上的'''原生千兆网口可以作为WAN口''',这样就能配置成一个双LAN口的2.5G路由器,同时接在LAN口上的设备之间的传输速度最高可达2.5Gbps。。
Under the OpenWrt system, '''the two 2.5G Ethernet ports on the MP2.5GD expansion board can serve as LAN ports''', while '''the native Gigabit Ethernet port on the Raspberry Pi 5 can serve as the WAN port'''. This way, it can be configured as a dual-LAN-port 2.5G router, allowing devices connected to the LAN ports to achieve transfer speeds of up to 2.5 Gbps between them.


=== 6.2 准备工作 ===
=== 6.2 Preparation ===
本文档使用的OpenWrt系统为:openwrt-bcm27xx-bcm2712-rpi-5-squashfs-sysupgrade-linux-6.1.100-20240805.img.gz
After flashing the OpenWrt system and powering it up, we connect an Ethernet cable from the Raspberry Pi 5's built-in Ethernet port to the PC's Ethernet port. Once the connection between the PC's network card and the Raspberry Pi 5's Ethernet port is successful, we find Network and Internet settings in Windows, then open the connected network under Ethernet to view the default gateway IP address. This address is the backend configuration page address for the OpenWrt system. As shown in the figure, the address for this test is 192.168.198.1:
 
烧写OpenWrt系统并上电启动后,我们将网线一端插在树莓派5的原生网口上,另一端插在PC上,待PC的网卡与树莓派5上的网口连接成功后,我们在Windows设置中找到网络和Internet,在以太网中打开连接的网络查看默认网关的IP地址,这个地址就是OpenWrt系统的后台配置页面地址,如图所示,本文测试的地址为192.168.198.1:


http://www.mcuzone.com/wiki/2001_CM4_Ultra/2001_CM4_Ultra_53.jpg
http://www.mcuzone.com/wiki/2001_CM4_Ultra/2001_CM4_Ultra_53.jpg


然后打开网页浏览器输入192.168.198.1进入OpenWrt系统。默认用户名为<code>root</code>,默认密码为<code>password</code>
Then open a web browser and enter 192.168.198.1 to access the OpenWrt system. The default username is <code>root</code>, and the default password is <code>password</code>:


http://www.mcuzone.com/wiki/2001_CM4_Ultra/2001_CM4_Ultra_54.jpg
http://www.mcuzone.com/wiki/2001_CM4_Ultra/2001_CM4_Ultra_54.jpg


=== 6.3 MP2.5D双LAN口的配置和应用 ===
=== 6.3 Configuration and Application of the MP2.5D Dual LAN Ports ===
进入“系统 - TTYD终端”,输入ifconfig -a命令,可以看到有eth0、eth1、eth2三个网口,其中eth0为树莓派5的原生网口,eth1和eth2为扩展板的两个2.5G网口:
Go to "System - TTYD Terminal," enter the <code>ifconfig -a</code> command, and you can see three network interfaces, eth0, eth1 and eth2. eth0 is the native Ethernet port of the Raspberry Pi 5, eth1 and eth2 ate the 2.5G Ethernet ports of the expansion board:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_25.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_25.jpg


点击“网络 - 接口”,点击“修改”:
Open "Network - Interfaces", and click "EDIT":


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_26.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_26.jpg


在“物理设置”中,把eth1和eth2(2.5G网口)选中,然后点击“保存&应用”按钮:
In the "Physical Settings", select eth1 and eth2 (2.5G Ethernet ports), then click the "SAVE & APPLY" button:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_27.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_27.jpg


将网线从树莓派5的原生网口中拔出,插入任意一个2.5G网口,待PC的网卡与2.5G网口连接成功后,我们刷新管理页面,点击“网络 - 接口”,点击“修改”:
Remove the network cable from the native Ethernet port of the Raspberry Pi 5 and insert it into any of the 2.5G Ethernet ports. After the PC's network card successfully connects to the 2.5G port, refresh the management page, click on "Network - Interfaces", and then click "EDIT":


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_28.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_28.jpg


在“物理设置”中,把eth0前面的勾去掉,然后点击“保存”按钮:
In the "Physical Settings", remove the checkmark from in front of eth0, and then click the "SAVE" button:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_29.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_29.jpg


回到“网络 - 接口”,点击“添加新接口”:
Go back to "Network - Interfaces", and click "Add new interface":


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_30.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_30.jpg


接口名称设置为WAN,接口协议选择DHCP客户端,接口选择eth0后点击“提交”按钮:
Set "Name of the new interface" as WAN, choose "DHCP client" for "Protocol of the new interface," select "eth0" for "Cover the following interface," and then click the "SUBMIT" button:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_31.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_31.jpg


在防火墙设置中选择WAN口后点击“保存&应用”按钮:
In the "Firewall Settings", select the WAN and then click the "SAVE & APPLY" button:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_32.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_32.jpg


把连接Internet网络的网线插到树莓派5的原生网口上,然后回到“网络 - 接口”,稍等片刻,就可以看见新建的WAN接口获取了IP地址,这样PC就可以通过此扩展板上网了:
Plug the network cable connected to the Internet into the native Ethernet port of the Raspberry Pi 5, then go back to "Network - Interfaces". After a moment, you will see that the newly created WAN interface has obtained an IP address. This way, the PC can access the internal network through the expansion board:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_33.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_33.jpg
第299行: 第297行:
测速(200M宽带)结果如下:
测速(200M宽带)结果如下:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_38.jpg
Open https://www.speedtest.cn/ on the PC to test speed. The speed test results of the Internet (200M broadband) are as follows:


把两台具有2.5G网卡的PC(本文档为了区分,两台PC所使用的系统,一台Windows系统,一台Ubuntu系统,用户可以根据自己的需求使用适合的系统)分别接到eth1和eth2上,利用iperf3测速,结果如下:
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_52.jpg
 
Connect two PCs, each equipped with a 2.5G network card, to eth1 and eth2 respectively (To differentiate for the purposes of this document, one PC uses the Windows system, and the other uses the Ubuntu system. You can choose the appropriate system based on ypur need), and use iperf3 to perform a speed test. The results are as follows:


http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_43.jpg
http://www.mcuzone.com/wiki/0009_MP2_5GD/0009_MP2_5GD_43.jpg


实测Windows作为client端,Ubuntu作为server端,速度约为1.68Gbps;Windows作为server端,Ubuntu作为client端,速度约为2.17Gbps。
In practical tests, when Windows serves as the client and Ubuntu as the server, the speed is about 1.68 Gbps; when Windows serves as the server and Ubuntu as the client, the speed is about 2.17 Gbps.


'''''注意:网络测速受网络环境和测试方法影响,速度请以实际为准,本测试仅供参考。'''''
'''''Note: The speed test can be affected by the network environment and the testing method. Speeds should be considered based on actual results; this test is for reference only.'''''


=== 6.4 其它应用 ===
=== 6.4 Other Applications ===
树莓派5的无线模块可以作为无线AP,也可以作为无线WAN口,关于这些应用的实现,请参考下列链接:
树莓派5的无线模块可以作为无线AP,也可以作为无线WAN口,关于这些应用的实现,请参考下列链接:


[[0008 MPS2.5G(SSD和2.5G以太网)#6.4 树莓派自带WiFI做无线AP(master模式)使用|树莓派自带WiFI做无线AP(master模式)使用]]
The wireless module of the Raspberry Pi 5 can function as a wireless AP or as a wireless WAN port. For the implementation of these applications, please refer to the following link:
 
[[0008 MPS2.5G(SSD and 2.5G ETH)#6.4 Use the Raspberry Pi's built-in WiFi as a wireless AP (in master mode)|1. Use the Raspberry Pi's built-in WiFi as a wireless AP (in master mode)]]


[[0008 MPS2.5G(SSD和2.5G以太网)#6.5 树莓派自带WiFi做Client使用|树莓派自带WiFi做Client使用]]
[[0008 MPS2.5G(SSD and 2.5G ETH)#6.5 Use the Raspberry Pi's built-in WiFi as a Client|2. Use the Raspberry Pi's built-in WiFi as a Client]]


{{联系我们_图标}}
{{Contact_Us_icon}}

2024年10月17日 (四) 14:50的最新版本

切换语言为中文

Keywords

Raspberry Pi 5, PCIe, Switch, RL8125, 2.5Gbps, Ethernet, iperf3 Ethernet Speed Test

I. Introduction

The Raspberry Pi 5 is equipped with a 16-pin PCIe interface, through which we can attach various PCIe devices. This time, we expand the PCIe interface into two PCIe ports using a PCIe Switch chip, and then through two RTL8125 chips, we achieve dual 2.5Gbps Ethernet expansion. The expansion board is driver-free under the Raspberry Pi OS and is automatically recognized as eth1 and eth2 upon power-up. If using Ubuntu system, the RTL8125 driver needs to be installed first in order to use the board.

II. Hardware Spec

1. Use a 0.5mm 16-pin PCIe cable to connect to the PCIe interface on the Raspberry Pi 5.

2. Using a PCIe Switch chip to expand one PCIe port into two, extending to two RTL8125 2.5Gbps Ethernet ports.

3. The RTL8125 2.5G Ethernet adapter is driver-free in the official Raspberry Pi OS and OpenWrt systems, but requires driver installation in Ubuntu systems.

4. The onboard 2.54-2p auxiliary power supply interface can be used to provide additional power if there is insufficient power when both 2.5G Ethernet ports are operating at full load simultaneously.

5.Gold immersion PCB process, lead-free production, certified by UL, compliant with ROHS standards, and has a fire rating of 94V-0.

6. The board has four M2.5 mounting holes, with a recessed design on the top of the board to facilitate the use of the 40-Pin GPIO.

III. Software Spec

3.1Overview

This document uses the Raspberry Pi OS, Ubuntu system and OpenWrt system for testing.

1)The version of the Raspberry Pi OS is: 2024-07-04-raspios-bookworm-arm64.img.xz

You can download the Raspberry Pi OS in:

https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit

2)The version of the Ubuntu system is: ubuntu-24.04-preinstalled-desktop-arm64+raspi.img.xz

You can download the Ubuntu system in:

https://ubuntu.com/download/raspberry-pi

3)The version of the OpenWrt system is: openwrt-bcm27xx-bcm2712-rpi-5-squashfs-sysupgrade-linux-6.1.100-20240805.img.gz

3.2 System flashed onto the SD (TF) card

Click here to read the instructions for System flashing

IV. Work with Raspberry Pi OS

4.1 4.1 Internet test

The 2.5G Ethernet ports on the MP2.5GD expansion board are plug-and-play without requiring drivers under Raspberry Pi OS. Once the system is up, excute the command ifconfig -a in the Raspberry Pi terminal, and the 2.5G Ethernet ports will be recognized as eth1 and eth2:

0009_MP2_5GD_04.jpg

Open https://www.speedtest.cn/ on the PC to test speed. The speed test results for the 2.5G Ethernet ports connected to the Internet (200M broadband) are as follows:

0009_MP2_5GD_48.jpg

0009_MP2_5GD_49.jpg

Note: The speed test can be affected by the network environment and the testing method. Speeds should be considered based on actual results; this test is for reference only.

4.2 2.5G intranet test

Install the network speed testing tool iperf3:

sudo apt install iperf3

0008_MPS2_5G_04.jpg

Use iperf3 to perform speed tests between the Raspberry Pi OS and the PC through a 2.5G router.

4.2.1 The speed test results for eth1 are as follows:

When Raspberry Pi OS acts as a client, the speed is about 2.02 Gbps:

0009_MP2_5GD_07.jpg

When Raspberry Pi OS acts as a server, the speed is about 1.84 Gbps:

0009_MP2_5GD_08.jpg

4.2.2 The speed test results for eth2 are as follows:

When Raspberry Pi OS acts as a client, the speed is about 2.01 Gbps:

0009_MP2_5GD_09.jpg

When Raspberry Pi OS acts as a server, the speed is about 1.84 Gbps:

0009_MP2_5GD_10.jpg

Note: The speed test can be affected by the network environment and the testing method. Speeds should be considered based on actual results; this test is for reference only.

4.3 Fix the MAC address of the 2.5G Ethernet port

The 2.5G Ethernet port uses the RTL8125 network card, and during use, the MAC address is not fixed. Each time the device is powered on again, the MAC address changes randomly. The following explains how to set a fixed MAC address for the RTL8125 network card.

This explanation also applies to the Ubuntu system.

First, check the identification information of the RTL8125 network card in terminal:

ipconfig -a

0009_MP2_5GD_46.jpg

Here, two RTL8125 network cards are identified as eth1 and eth2, but in practice, the names recognized by the system might be different.

Then input:

sudo mousepad /etc/systemd/system/macspoof@eth1.service

Or:

sudo nano /etc/systemd/system/macspoof@eth1.service

eth1 is the name recognized by the system for the network card shown above.

Executing the above command will create a new document, then enter the following text:

[Unit]

Description=MAC Address Change %I

Wants=network-pre.target

Before=network-pre.target

BindsTo=sys-subsystem-net-devices-%i.device

After=sys-subsystem-net-devices-%i.device

[Service]

Type=oneshot

ExecStart=/usr/bin/ip link set dev %i address xx:xx:xx:xx:xx:xx

ExecStart=/usr/bin/ip link set dev %i up

[Install]

WantedBy=multi-user.target

Here, "xx:xx:xx:xx:xx:xx" represents the MAC address you wish to assign. You can determine it according to the MAC address format (make sure it does not duplicate the MAC address of other network devices). After setting it, save and exit.

Then execute the following command to enable the service:

sudo systemctl enable macspoof@eth1.service

This completes the fixation of the MAC address for eth1.

For other network interfaces such as eth2, follow the same steps as described above.

After completing all operations, restart the system. Once the system has finished rebooting, execute ipconfig -a to see that the MAC address has been successfully changed:

0009_MP2_5GD_47.jpg

V. Work with Ubuntu System

5.1 Install the RTL8125 driver in Ubuntu system

The 2.5G Ethernet port on the MP2.5GD expansion board is not plug-and-play in Ubuntu system and requires the installation of the RTL8125 driver.

Since the wireless network card module of the Raspberry Pi 5 is plug-and-play in the Ubuntu system, we need to use the wireless network card to connect to a wireless network:

0009_MP2_5GD_11.jpg

You can also use an Ethernet cable to connect to the native Ethernet port on the Raspberry Pi 5.

The ifconfig tool is not installed by default in Ubuntu system, so it needs to be installed manually:

sudo apt install net-tools

0008_MPS2_5G_13.jpg

Excute ifconfig -a, and you can see that the 2.5G network cards is not displayed at this time.

0009_MP2_5GD_12.jpg

Next, we will begin installing the RTL8125 driver:

First, you need to update the system:

sudo apt-get update

0009_MP2_5GD_13.jpg

Next, prepare the compilation environment:

sudo apt-get install --reinstall linux-headers-$(uname -r) linux-headers-generic build-essential dkms

0009_MP2_5GD_14.jpg

Then install the driver:

sudo apt-get install r8125-dkms

0009_MP2_5GD_15.jpg

After installation is complete, excute:

sudo modprobe r8125

0009_MP2_5GD_16.jpg

Enter ifconfig -a to see two network interfaces called enxxx, which indicates that the 2.5G network cards driver has been successfully installed:

0009_MP2_5GD_17.jpg

5.2 Internet test

Open https://www.speedtest.cn/ on the PC to test speed. The speed test results for the 2.5G Ethernet ports connected to the Internet (200M broadband) are as follows:

0009_MP2_5GD_50.jpg

0009_MP2_5GD_51.jpg

Note: The speed test can be affected by the network environment and the testing method. Speeds should be considered based on actual results; this test is for reference only.

If the built-in Firefox browser in Ubuntu system runs very slowly or frequently becomes unresponsive, it is recommended to install the lightweight browser Falkon:

sudo apt install falkon

5.3 2.5G intranet test

Install the network speed testing tool iperf3:

sudo apt install iperf3

0009_MP2_5GD_20.jpg

Use iperf3 to perform speed tests between the Raspberry Pi OS and the PC through a 2.5G router.

The speed test results for enp3s0 are as follows:

When Ubuntu system acts as a client, the speed is about 2.34 Gbps:

0009_MP2_5GD_21.jpg

When Ubuntu system acts as a server, the speed is about 1.83Gbps:

0009_MP2_5GD_22.jpg

The speed test results for enp4s0 are as follows:

When Ubuntu system acts as a client, the speed is about 2.35 Gbps:0009_MP2_5GD_23.jpg

When Ubuntu system acts as a server, the speed is about 1.83Gbps:

0009_MP2_5GD_24.jpg

Note: The speed test can be affected by the network environment and the testing method. Speeds should be considered based on actual results; this test is for reference only.

VI. Work with OpenWrt System

6.1 Overview

Under the OpenWrt system, the two 2.5G Ethernet ports on the MP2.5GD expansion board can serve as LAN ports, while the native Gigabit Ethernet port on the Raspberry Pi 5 can serve as the WAN port. This way, it can be configured as a dual-LAN-port 2.5G router, allowing devices connected to the LAN ports to achieve transfer speeds of up to 2.5 Gbps between them.

6.2 Preparation

After flashing the OpenWrt system and powering it up, we connect an Ethernet cable from the Raspberry Pi 5's built-in Ethernet port to the PC's Ethernet port. Once the connection between the PC's network card and the Raspberry Pi 5's Ethernet port is successful, we find Network and Internet settings in Windows, then open the connected network under Ethernet to view the default gateway IP address. This address is the backend configuration page address for the OpenWrt system. As shown in the figure, the address for this test is 192.168.198.1:

2001_CM4_Ultra_53.jpg

Then open a web browser and enter 192.168.198.1 to access the OpenWrt system. The default username is root, and the default password is password:

2001_CM4_Ultra_54.jpg

6.3 Configuration and Application of the MP2.5D Dual LAN Ports

Go to "System - TTYD Terminal," enter the ifconfig -a command, and you can see three network interfaces, eth0, eth1 and eth2. eth0 is the native Ethernet port of the Raspberry Pi 5, eth1 and eth2 ate the 2.5G Ethernet ports of the expansion board:

0009_MP2_5GD_25.jpg

Open "Network - Interfaces", and click "EDIT":

0009_MP2_5GD_26.jpg

In the "Physical Settings", select eth1 and eth2 (2.5G Ethernet ports), then click the "SAVE & APPLY" button:

0009_MP2_5GD_27.jpg

Remove the network cable from the native Ethernet port of the Raspberry Pi 5 and insert it into any of the 2.5G Ethernet ports. After the PC's network card successfully connects to the 2.5G port, refresh the management page, click on "Network - Interfaces", and then click "EDIT":

0009_MP2_5GD_28.jpg

In the "Physical Settings", remove the checkmark from in front of eth0, and then click the "SAVE" button:

0009_MP2_5GD_29.jpg

Go back to "Network - Interfaces", and click "Add new interface":

0009_MP2_5GD_30.jpg

Set "Name of the new interface" as WAN, choose "DHCP client" for "Protocol of the new interface," select "eth0" for "Cover the following interface," and then click the "SUBMIT" button:

0009_MP2_5GD_31.jpg

In the "Firewall Settings", select the WAN and then click the "SAVE & APPLY" button:

0009_MP2_5GD_32.jpg

Plug the network cable connected to the Internet into the native Ethernet port of the Raspberry Pi 5, then go back to "Network - Interfaces". After a moment, you will see that the newly created WAN interface has obtained an IP address. This way, the PC can access the internal network through the expansion board:

0009_MP2_5GD_33.jpg

测速(200M宽带)结果如下:

Open https://www.speedtest.cn/ on the PC to test speed. The speed test results of the Internet (200M broadband) are as follows:

0009_MP2_5GD_52.jpg

Connect two PCs, each equipped with a 2.5G network card, to eth1 and eth2 respectively (To differentiate for the purposes of this document, one PC uses the Windows system, and the other uses the Ubuntu system. You can choose the appropriate system based on ypur need), and use iperf3 to perform a speed test. The results are as follows:

0009_MP2_5GD_43.jpg

In practical tests, when Windows serves as the client and Ubuntu as the server, the speed is about 1.68 Gbps; when Windows serves as the server and Ubuntu as the client, the speed is about 2.17 Gbps.

Note: The speed test can be affected by the network environment and the testing method. Speeds should be considered based on actual results; this test is for reference only.

6.4 Other Applications

树莓派5的无线模块可以作为无线AP,也可以作为无线WAN口,关于这些应用的实现,请参考下列链接:

The wireless module of the Raspberry Pi 5 can function as a wireless AP or as a wireless WAN port. For the implementation of these applications, please refer to the following link:

1. Use the Raspberry Pi's built-in WiFi as a wireless AP (in master mode)

2. Use the Raspberry Pi's built-in WiFi as a Client

Contact Us

0001_x.jpg 0002_fb.jpg 0004_ytb.jpg 0003_bb.jpg 0005_qq.jpg QQ:8204136

Email: mcuzone@vip.qq.com

Tel: +86(0)13957118045

If there are any omissions, errors, or infringements on this page, please contact us through the above methods. Thank you!

Copyright 2004-2024 Wildchip