# eapol-testing
**Repository Path**: elliott10/eapol-testing
## Basic Information
- **Project Name**: eapol-testing
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 1
- **Created**: 2021-07-06
- **Last Updated**: 2022-06-15
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
### 网络验证过程的测试步骤
* 1. zCore操作系统目前测试运行在Qemu虚拟机中。
假设测试机运行环境在Ubuntu 20.04, 请在本机先安装好命令`qemu-system-x86_64`, `brctl`
* 2. 硬件连接
如果有开发板,可以把开发板的有线网接口,直接用网线连接到本测试机.
此时便可以直接在开发板中的有线网卡上抓网络帧了, 如开发板中运行:`sudo tcpdump -XXvven --number -i eth1`
(抓网络帧可以不用设置IP地址)
另:
Qemu dump网络包参数:`-object filter-dump,id=net0,netdev=net0,file=packets.pcap`
tcpdump查看dump包:`tcpdump -XXnr qemu.pcap`
* 3. 运行
- 3.1
```
./run.sh
```
- 3.2 此时会启动虚拟机,启动时会自动设置好虚拟网桥virbr0的网络环境, 其中本测试机是有线网是eth0, 远程开发板是eth1
```
Qemu---tap0---virbr0-----[RJ45网口]-----[开发板网口eth1]
|
eth0----+
```
在运行着虚拟机Qemu时,命令`brctl showstp virbr0`查看应有三个网络接口信息显示, 类似: virbr0, tap0, eth0
- 3.3 等待一会, 看到发送网络帧的如下Log.
```
[17.453635185s WARN 0 0:0] eframe : Frame { buffer: [FF, FF, FF, FF, FF, FF, 54, 51, 9F, 71, C0, 99, 88, 8E, 1, 1, 0, 0, 0] }
[17.455507749s WARN 0 0:0] <-- EAPOL Start from smoltcp
[17.45727875s WARN 0 0:0] EAP Response, eframe : Frame { buffer: [ff, ff, ff, ff, ff, ff, 54, 51, 9f, 71, c0, 99, 88, 8e, ...] }
[17.461449543s WARN 0 0:0] EAP Response, eframe : Frame { buffer: [ff, ff, ff, ff, ff, ff, 54, 51, 9f, 71, c0, 99, 88, 8e, ...] }
[17.465721253s WARN 0 0:0] EAP Response, eframe : Frame { buffer: [ff, ff, ff, ff, ff, ff, 54, 51, 9f, 71, c0, 99, 88, 8e, ...] }
```
- 3.3 此时在网络连接的开发板中,应该也能抓到一个EAPOL Start, 三个EAP Response 的网络帧:
```
19 17:32:04.940233 54:51:9f:71:c0:99 > ff:ff:ff:ff:ff:ff, ethertype EAPOL (0x888e), length 22: EAPOL start (1) v1, len 0
0x0000: ffff ffff ffff 5451 9f71 c099 888e 0101 ......TQ.q......
0x0010: 0000 0000 0000 ......
20 17:32:05.261529 54:51:9f:71:c0:99 > ff:ff:ff:ff:ff:ff, ethertype EAPOL (0x888e), length 29: EAP packet (0) v1, len 7, Response (2), id 4, len 7
Type Identity (1), Identity: cj
0x0000: ffff ffff ffff 5451 9f71 c099 888e 0100 ......TQ.q......
0x0010: 0007 0204 0007 0163 6a00 0000 00 .......cj....
21 17:32:05.602967 54:51:9f:71:c0:99 > ff:ff:ff:ff:ff:ff, ethertype EAPOL (0x888e), length 203: EAP packet (0) v1, len 181, Response (2), id 5, len 181
Type unknown (57)
0x0000: ffff ffff ffff 5451 9f71 c099 888e 0100 ......TQ.q......
0x0010: 00b5 0205 00b5 390d 0000 0001 0000 0082 ......9.........
0x0020: 0000 c058 2b9d be36 5d69 6404 9657 b539 ...X+..6]id..W.9
0x0030: a6fc 736f 01c4 e0b4 5125 278c 936e efc9 ..so....Q%'..n..
0x0040: 8030 070e 000d 0058 20c0 582b 9dbe 365d .0.....X..X+..6]
0x0050: 6964 0496 57b5 39a6 fc73 6f01 c4e0 b451 id..W.9..so....Q
0x0060: 2527 8c93 6eef c980 3030 0000 0000 0000 %'..n...00......
0x0070: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0080: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0090: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00c0: 0000 0000 2500 0000 0000 00 ....%......
22 17:32:05.980807 54:51:9f:71:c0:99 > ff:ff:ff:ff:ff:ff, ethertype EAPOL (0x888e), length 849: EAP packet (0) v1, len 827, Response (2), id 6, len 827
Type unknown (57)
0x0000: ffff ffff ffff 5451 9f71 c099 888e 0100 ......TQ.q......
0x0010: 033b 0206 033b 3929 581e f56b e7db c35a .;...;9)X..k...Z
0x0020: a776 4737 12e3 5b3c 0ac0 7f61 7a3c 7531 .vG7..[<...az
在QEMU调试E1000网卡,可参考:https://linux.cn/article-10452-1.html