ZYNQ7000芯片Linux环境下网桥测试
前置条件
- 具有双网口的ZYNQ7000开发板一块
Kernel配置
defconfig配置修改
CONFIG_XILINX_GMII2RGMII=y
CONFIG_BRIDGE=y
dts配置
aliases {
ethernet0 = &gem0;
ethernet1 = &gem1;
serial0 = &uart0;
spi0 = &qspi;
mmc0 = &sdhci0;
gpio0 = &gpio0;
};
&gem0 {
status = "okay";
max-speed = <1000>;
phy-mode = "rgmii-id";
phy-handle = <ðernet_phy>;
snps,fixed-burst;
snps,aal;
snps,force_sf_dma_mode;
mdio {
compatible = "snps,dwmac-mdio";
#address-cells = <1>;
#size-cells = <0>;
ethernet_phy: ethernet_phy@1{
reg = <1>;
};
};
};
&gem1 {
status = "okay";
max-speed = <1000>;
phy-mode = "rgmii-id";
phy-handle = <&phy>;
snps,fixed-burst;
snps,aal;
snps,force_sf_dma_mode;
local-mac-address = [00 0a 35 00 01 02];
mdio {
compatible = "snps,dwmac-mdio";
#address-cells = <1>;
#size-cells = <0>;
phy: phy@2 {
reg = <2>;
};
gmiitorgmii: gmiitorgmii@8 {
compatible = "xlnx,gmii-to-rgmii-1.0";
reg = <8>;
phy-handle = <&phy>;
};
};
};
进入Kernl命令行后使用brctl创建网桥
创建网桥br0
brctl addbr br0
将两个网口加入网桥
brctl addif br0 eth0
brctl addif br0 eth1
启动网桥以及两个网口
ifconfig br0 up
ifconfig eth0 up
ifconfig eth1 up
查看网口状态
ifconfig -a
查看网桥状态
brctl show
或者
ip link show
在window下使用ping命令测试效果
ping -S 192.168.1.12 192.168.1.20 -t -l 1024
在开发板中使用tcpdump工具抓包查看真实转发效果
tcpdump icmp -i br0