0015 MP2.5G(Single 2.5G ETH OPT PoE):修订间差异

来自Mcuzone Wiki
无编辑摘要
第8行: 第8行:


== '''II. Hardware Spec''' ==
== '''II. Hardware Spec''' ==
1. 采用0.5mm 16P PCIe线连接树莓派5的PCIE接口;
1. Use a 0.5mm 16-pin PCIe cable to connect to the PCIe interface on the Raspberry Pi 5.


2. 扩展一路2.5Gbps以太网;
2. Expand one 2.5Gbps Ethernet port.


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.
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.
第20行: 第20行:
http://www.mcuzone.com/wiki/0015_MP2_5G/0015_MP2_5G_30.jpg
http://www.mcuzone.com/wiki/0015_MP2_5G/0015_MP2_5G_30.jpg


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


=== 3.1 概述 ===
=== 3.1 Overview ===
本文档采用树莓派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 Internet test ===
MP2.5G扩展板上的2.5G网口在树莓派OS下免驱 即插即用,系统起来后,在树莓派终端中输入ifconfig -a命令,2.5G网口被识别为eth1:
The 2.5G Ethernet port on the MP2.5G expansion board is 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 port will be recognized as eth1:


http://www.mcuzone.com/wiki/0015_MP2_5G/0015_MP2_5G_01.jpg
http://www.mcuzone.com/wiki/0015_MP2_5G/0015_MP2_5G_01.jpg


使用[https://test.ustc.edu.cn/ 中国科技大学测速网站],对2.5G网口连外网(200M宽带)测速,结果如下:
Open https://test.ustc.edu.cn/ on the PC to test speed. The speed test results for the 2.5G Ethernet port connected to the Internet (200M broadband) are as follows:


http://www.mcuzone.com/wiki/0015_MP2_5G/0015_MP2_5G_02.jpg
http://www.mcuzone.com/wiki/0015_MP2_5G/0015_MP2_5G_02.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>
第58行: 第62行:
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.


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


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


http://www.mcuzone.com/wiki/0015_MP2_5G/0015_MP2_5G_03.jpg
http://www.mcuzone.com/wiki/0015_MP2_5G/0015_MP2_5G_03.jpg


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


http://www.mcuzone.com/wiki/0015_MP2_5G/0015_MP2_5G_04.jpg
http://www.mcuzone.com/wiki/0015_MP2_5G/0015_MP2_5G_04.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 固定2.5G网口的MAC地址 ===

2024年10月17日 (四) 09:53的版本

切换语言为中文

Keywords

Raspberry Pi 5, PCIe, 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 utilize the PCIe interface to achieve the expansion of a single 2.5Gbps Ethernet port using the RTL8125 chip. The expansion board is automatically recognized as eth1 in the Raspberry Pi OS without requiring any drivers upon power-up. If using Ubuntu system, the RTL8125 driver needs to be installed first before it can be used.

II. Hardware Spec

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

2. Expand one 2.5Gbps Ethernet port.

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. Gold immersion PCB process, lead-free production, certified by UL, compliant with ROHS standards, and has a fire rating of 94V-0.

5. 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.

0015_MP2_5G_30.jpg

III. Software Spec

3.1 Overview

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 Internet test

The 2.5G Ethernet port on the MP2.5G expansion board is 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 port will be recognized as eth1:

0015_MP2_5G_01.jpg

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

0015_MP2_5G_02.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.

The speed test results for eth1 are as follows:

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

0015_MP2_5G_03.jpg

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

0015_MP2_5G_04.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地址

2.5G网口为RTL8125网卡,在使用过程中的MAC地址是不固定的,每次重新上电后MAC地址都会随机改变。下面讲解如何为RTL8125网卡设置固定MAC地址。

本讲解也适用于Ubuntu系统。

首先在树莓派终端中查看RTL8125网卡的识别信息:

ipconfig -a

0015_MP2_5G_28.jpg

这里的RTL8125网卡为eth1,实际操作中可能会因为系统识别名称不同而不同。

然后输入:

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

或:

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

eth1为上面显示的网卡识别名称。

运行上面的命令后会新建一个文档,输入以下文本:

[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

其中“xx:xx:xx:xx:xx:xx”为想要指定的MAC地址,可以按MAC地址格式自行确定(不要和其它网络设备重复),设置完成后保存并退出。

随后输入下面的命令使能服务:

sudo systemctl enable macspoof@eth1.service

这样就完成了对eth1的固定MAC地址。

全部操作完毕后重启系统,系统重启完毕后,执行ipconfig -a即可看到MAC地址更改成功:

0015_MP2_5G_29.jpg

五、Ubuntu系统下使用演示

5.1 安装Ubuntu系统下RTL8125驱动

MP2.5G扩展板上的2.5G网口在Ubuntu系统下不能即插即用,需要安装RTL8125驱动。

因为树莓派5的无线网卡模块在Ubuntu系统下是即插即用的,所以我们需要使用无线网卡连接无线网络:

0009_MP2_5GD_11.jpg

也可以使用网线连接树莓派5上的原生网口。

Ubuntu系统默认不安装ifconfig工具,所以需要手动安装:

sudo apt install net-tools

0008_MPS2_5G_13.jpg

输入ifconfig -a,可见此时并没有显示2.5G网卡:

0009_MP2_5GD_12.jpg

接下来我们开始安装RTL8125驱动。

首先需要更新系统:

sudo apt-get update

0009_MP2_5GD_13.jpg

接着准备编译环境:

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

0009_MP2_5GD_14.jpg

然后安装驱动:

sudo apt-get install r8125-dkms

按提示安装即可:

0009_MP2_5GD_15.jpg

安装完成后输入:

sudo modprobe r8125

0009_MP2_5GD_16.jpg

输入ifconfig -a就可以看到一个enxxx的网卡接口,这样就安装完毕2.5G网卡驱动:

0015_MP2_5G_05.jpg

5.2 Internet网络测试

将2.5G网口连外网(200M宽带)测速,结果如下:

0015_MP2_5G_06.jpg

注意:网络测速受网络环境和测试方法影响,速度请以实际为准,本测试仅供参考。

如果使用Ubuntu内置的Firefox浏览器时运行速度很慢或者经常无响应,建议安装轻量浏览器Falkon:

sudo apt install falkon

5.3 2.5G内网测试

安装网络测速软件iperf3:

sudo apt install iperf3

0009_MP2_5GD_20.jpg

利用iperf3,在Ubuntu系统与PC之间进行测速。

测速结果如下:

当Ubuntu系统作为client时,速度大约为2.35Gbps:

0015_MP2_5G_07.jpg

当Ubuntu系统作为server时,速度大约为1.85Gbps:

0015_MP2_5G_08.jpg

注意:网络测速受网络环境和测试方法影响,速度请以实际为准,本测试仅供参考。

六、OpenWrt系统操作演示

6.1 概述

MP2.5G扩展板在OpenWrt系统下,默认树莓派上的原生千兆网口为LAN口,我们可以把扩展板上的2.5G网口作为LAN口,而把树莓派5上的原生网口作为WAN口,这样就能利用2.5G网口在内网高速传输文件。

6.2 准备工作

本文档使用的OpenWrt系统为:openwrt-bcm27xx-bcm2712-rpi-5-squashfs-sysupgrade-linux-6.1.100-20240805.img.gz

烧写OpenWrt系统并上电启动后,我们将网线一端插在树莓派5的原生网口上,另一端插在PC上,待PC的网卡与树莓派5上的网口连接成功后,我们在Windows设置中找到网络和Internet,在以太网中打开连接的网络查看默认网关的IP地址,这个地址就是OpenWrt系统的后台配置页面地址,如图所示,本文测试的地址为192.168.198.1:

2001_CM4_Ultra_53.jpg

然后打开网页浏览器输入192.168.198.1进入OpenWrt系统。默认用户名为root,默认密码为password

2001_CM4_Ultra_54.jpg

6.3 MP2.5G的2.5G网口的配置和应用

进入“系统 - TTYD终端”,输入ifconfig -a命令,可以看到有eth0和eth1两个网口,其中eth0为树莓派5的原生网口,eth1为扩展板的2.5G网口:

0015_MP2_5G_09.jpg

我们使用的宽带一般不会超过千兆,为了获得更好的内网性能,建议将树莓派5的原生千兆配置从默认的LAN配置为WAN,然后把扩展板的2.5G以太网(eth1)口配置为LAN。

点击“网络 - 接口”,点击“修改”:

0015_MP2_5G_10.jpg

在“物理设置”中,把eth1选中,然后点击“保存&应用”按钮:

0015_MP2_5G_11.jpg

将网线从树莓派5的原生网口中拔出,插入2.5G网口(eth1),待PC的网卡与2.5G网口连接成功后,我们刷新管理页面,点击“网络 - 接口”,点击“修改”:

0015_MP2_5G_12.jpg

在“物理设置”中,把eth0前面的勾去掉,然后点击“保存”按钮:

0015_MP2_5G_13.jpg

回到“网络 - 接口”,点击“添加新接口”:

0015_MP2_5G_14.jpg

接口名称设置为WAN,接口协议选择DHCP客户端,接口选择eth0后点击“提交”按钮:

0015_MP2_5G_15.jpg

在防火墙设置中选择WAN口后点击“保存&应用”按钮:

0015_MP2_5G_16.jpg

把连接Internet网络的网线插到树莓派5的原生网口上,然后回到“网络 - 接口”,稍等片刻,就可以看见新建的WAN接口获取了IP地址,这样PC就可以通过连接2.5G网口(eth1)进入内网上网了,此时网络结构为千兆网口(接Internet,树莓派上)进,2.5G网口(接内网,扩展板上)出:

0015_MP2_5G_17.jpg

我们在树莓派5的USB3.0接口上插入一个支持USB3.0的U盘或者移动硬盘,参考下面链接,将这个U盘或者移动硬盘配置为共享目录:

设置SSD硬盘为共享目录

设置完毕后,我们在资源管理器中输入\\192.168.198.1(地址为扩展板的地址,视实际情况而不同),就能看到所映射的共享目录了:

0015_MP2_5G_18.jpg

将任意文件拖拽到桌面进行读取速度测试:

0015_MP2_5G_19.jpg

将任意文件拖拽到SSD进行写入速度测试:

0015_MP2_5G_20.jpg

注意:网络测速受网络环境和测试方法影响,速度请以实际为准,本测试仅供参考。

6.4 其它应用

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

树莓派自带WiFI做无线AP(master模式)使用

树莓派自带WiFi做Client使用

联系我们

4f7e81daf8791971.jpg 79c020da7ad0af9b.jpg 2851e01a0549e6f7.gif 0003_bb.jpg 0005_qq.jpg QQ:8204136

邮件:mcuzone@vip.qq.com

电话:13957118045

如本页面有任何疏漏、错误或者侵权,请通过上述途径联系我们,谢谢!

Copyright 2004-2024 野芯科技