Skip to content

esp32-ethernet-tester

A bench tool for stress-testing and validating Ethernet switch ports

Lihan__

Published July 27, 2026

Original author: micgreshamOriginal source (new tab)

esp32-ethernet-tester

Project description

ESP32 Ethernet Tester β€” A Full L1–L3 Network Assessment Bench in Your Pocket, Powered by W5500 MACRAW

#W5500 #MACRAW #ESP32S3 #NetworkTesting #RFC2544 #802.1X #PenTest #RawEthernet #PoE #PortValidation

πŸ“š Context: Professional bench tool β€” built and tuned against a real Aruba CX6300 enterprise switch. Verified: MACRAW socket-0 driver, raw-TX path, and a full custom ARP/IP/UDP/ICMP stack are all confirmed at code level.


01 β€” What is this project?

Validating and stress-testing enterprise Ethernet switch ports usually means a rack of expensive gear β€” a dedicated traffic generator for RFC 2544, a protocol analyzer for LLDP/CDP, a separate box for 802.1X supplicant testing, and yet another for security assessment. It is heavy, wired to a bench, and far out of reach for most field engineers.

ESP32 Ethernet Tester collapses all of that into a single PoE-powered board that fits in one hand. An ESP32-S3 drives a WIZnet W5500 in raw MAC (MACRAW) mode, giving the firmware complete control over every byte placed on the wire. On top of that raw layer sits a deliberately minimal, purpose-built IPv4 stack (ARP / IP / UDP / ICMP) β€” the W5500's hardware TCP/IP engine is intentionally bypassed so nothing filters or normalizes the frames.

The result is a genuinely comprehensive network bench: RFC 2544 throughput/latency/frame-loss benchmarking, LLDP/CDP discovery and advertisement, seven DHCP failure scenarios, a full 802.1X/EAP supplicant (MD5/TLS/PEAP/TTLS), SNMP recon, TCP SYN port scanning with banner grab for 30+ services, an L2 attack suite (VLAN hopping, STP root claim, CAM flood), FHRP hijack testing, DHCPv6, WireGuard VPN management, OTA updates, PCAP capture to SD, and a cron-driven scripting engine β€” all controllable over a serial CLI or a tabbed Wi-Fi web UI.

02 β€” Why raw-frame testing?

πŸ”· Full control of the wire

A conventional NIC (or a hardware-offloaded TCP/IP chip) silently handles addressing, checksums, retransmission and framing for you. That is exactly what you do not want in a network tester. To inject giant frames, PAUSE frames, malformed DHCP DISCOVERs, spoofed BPDUs or forged HSRP advertisements, the firmware needs to build the entire Ethernet frame itself and hand it to the PHY untouched. Raw MAC access is the only way to do this.

πŸ”· One PHY, every layer

Because the tester owns the raw frame, a single device can operate at L1 (PHY speed/duplex forcing), L2 (VLAN/STP/LLDP/CDP/ARP), and L3 (its own IP/UDP/ICMP stack) β€” no separate tools per layer. Discovery, injection, benchmarking and security assessment all run through the same raw pipe.

πŸ”· WIZnet ecosystem fit

Among WIZnet's line, the W5500's MACRAW mode is the natural choice for this class of tool. Its hardened SPI interface and the well-documented Sn_MR_MACRAW socket mode give a clean, deterministic raw-frame path over a short onboard PCB trace β€” far simpler and more robust than bit-banging a discrete PHY (e.g. an ENC28J60) or wrestling with the RMII timing of a LAN8742A. For a battery/PoE-powered handheld, that integration density is decisive.

03 β€” System architecture

03 β€” System architecture

Every functional module β€” from the RFC 2544 benchmark suite to the rogue 802.1X authenticator β€” ultimately calls a single primitive: W5500Raw::sendFrame(). That one code path is what makes the whole architecture coherent.

04 β€” Why W5500? ⭐

πŸ”· The technical core: MACRAW gives raw L2 access with hardware reliability

The entire project is built on one capability: the ability to put an arbitrary Ethernet frame on the wire and to receive every frame back, unfiltered. The W5500 delivers exactly this through its MACRAW socket mode.

πŸ”· Mode used: MACRAW (Sn_MR_MACRAW, Sn_MR = 0x04) β€” verified in code

This is not inferred β€” it is confirmed directly in src/w5500_raw.cpp:

  • Socket 0 is opened with _writeReg8(Sn_MR, BSB_S0_REG, Sn_MR_MACRAW) and the code verifies the socket status register reads SOCK_MACRAW.
  • MAC filtering is deliberately disabled so the tester receives all frames on the segment (essential for passive recon, PCAP capture and protocol decode).
  • On RX, the firmware correctly handles the 2-byte length prefix the W5500 prepends to each received MACRAW frame.
  • On TX, sendFrame() writes the frame into the socket TX buffer, advances Sn_TX_WR, and issues Sn_CR_SEND β€” a textbook raw transmit path.

Crucially, the W5500's hardware TCP/IP engine is bypassed entirely. The custom IpStack (src/ip_stack.cpp) builds ARP, IPv4, UDP and ICMP by hand and pushes each one through _eth.sendFrame(). This is the defining design decision: it preserves total raw-frame control while still enabling L3/DHCP testing.

πŸ”· Advantage over alternatives

  • vs. ENC28J60: the W5500 offers a far more robust, well-abstracted SPI register interface and reliable MACRAW behavior, avoiding the notorious errata and manual buffer bookkeeping of the ENC28J60.
  • vs. RMII PHYs (LAN8742A etc.): no RMII clock/timing headaches, no dependence on the ESP32's EMAC β€” just a clean SPI bus, which frees the internal MAC and simplifies a PoE handheld design.
  • vs. using the W5500's own TCP/IP offload: offload would defeat the purpose; MACRAW is precisely why W5500 fits a tester rather than a client.

πŸ”· Verified evidence βœ…

  • βœ… MACRAW socket-0 configuration confirmed in w5500_raw.cpp.
  • βœ… Raw TX path (Sn_TX_WR + Sn_CR_SEND) confirmed.
  • βœ… Custom IP stack routing all frames through sendFrame() confirmed in ip_stack.cpp.
  • βœ… Built and tuned against a real Aruba CX6300 (per README).
  • βœ… Honest, hardware-accurate documentation of MACRAW limits (FCS auto-append prevents true CRC-error and runt injection) β€” a mark of an author who actually ran this on silicon.

05 β€” Key components

🌐 WIZnet W5500 β€” MACRAW mode (raw L2 engine)

The heart of the tool. Runs on a Waveshare ESP32-S3-POE-ETH board where the W5500 is onboard and PoE-capable, connected over FSPI at 8 MHz (headroom to push toward 40 MHz on the short traces). All raw TX/RX, error injection, and the custom IP stack sit on top of it.

🧠 ESP32-S3 (Waveshare ESP32-S3-POE-ETH)

16 MB flash, 8 MB PSRAM, USB-C. Hosts the CLI parser, the ESPAsyncWebServer tabbed UI, mbedTLS for EAP-TLS/PEAP/TTLS, NVS persistence, and a dual-OTA partition scheme.

πŸ”§ Custom minimal IPv4 stack

ARP (with cache) + IPv4 + UDP + ICMP, hand-built over MACRAW. Enables ping, DHCP DORA, DNS, SNMP and port scanning β€” without touching the W5500's hardware stack.

πŸ“‘ Protocol & security suites

RFC 2544, LLDP/CDP (decode + advertise), 802.1X supplicant + rogue authenticator (hashcat-5500 output), DHCP/DHCPv6 scenarios, FHRP (HSRP/VRRP) assessment, L2 attack suite, SNMP recon, TCP SYN scanner with 30+ service banner probes.

πŸ’Ύ Field-ready infrastructure

Wi-Fi STA/AP web UI, HTTPS + basic-auth, WireGuard tunnel for remote management, SD-card PCAP/log/script storage, cron scheduler, TFTP/HTTP OTA.

06 β€” Application scenarios

01. Enterprise switch-port commissioning

Before handing a new switch to production, an engineer plugs in the tester, runs test all for RFC 2544 numbers, confirms LLDP neighbor data, verifies DHCP behavior, and validates 802.1X enforcement β€” all from one handheld.

02. Field troubleshooting without a laptop

PoE-powered and web-driven, the tester can be dropped on a remote port and reached over Wi-Fi (or WireGuard back to HQ), with results logged to SD and scheduled via cron for unattended overnight checks.

03. Authorized network security assessment

In armed mode, a pentester exercises ARP MITM, STP root claims, VLAN hopping, rogue DHCP/DHCPv6/DNS, FHRP hijack and a rogue 802.1X authenticator to validate that the network's hardening (DHCP snooping, Root Guard, DAI, 802.1X, FHRP auth) actually holds.

04. Protocol education & lab work

Because every frame is built by hand, the codebase is a living reference for how LLDP, CDP, HSRP, VRRP, EAP, DHCP and MS-CHAPv2 actually look on the wire β€” a genuinely instructive MACRAW project.

Conclusion

A single hand-sized, PoE-powered board turns the W5500's MACRAW mode into a full L1–L3 network test-and-assessment bench that was previously the domain of rack-mounted, five-figure instruments.

  • βœ… Complete raw-frame control via W5500 MACRAW (verified in source)
  • βœ… Custom ARP/IP/UDP/ICMP stack layered over raw L2 β€” hardware TCP/IP intentionally bypassed
  • βœ… RFC 2544 benchmark suite (throughput/latency/loss/back-to-back)
  • βœ… Full 802.1X/EAP supplicant + rogue authenticator with hashcat output
  • βœ… Deep L2/L3 security assessment toolkit (VLAN/STP/ARP/FHRP/DHCP/DNS/SNMP)
  • βœ… Tabbed Wi-Fi web UI + serial CLI + scripting/cron automation
  • βœ… Field-grade infra: PoE, HTTPS, WireGuard, SD PCAP/logs, OTA
  • βœ… Validated against real enterprise hardware (Aruba CX6300)
  • βœ… Honest documentation of MACRAW hardware limits β€” engineering integrity

Q&A

Q. Which W5500 socket mode does this use, and why not the hardware TCP/IP stack? It uses MACRAW (Sn_MR_MACRAW) on socket 0 with MAC filtering off. A network tester must control and observe every byte on the wire, so the hardware TCP/IP offload is deliberately bypassed and a custom lightweight IP stack is built on top of the raw frames instead.

Q. Why can't it inject true CRC-error or runt frames? In MACRAW mode the W5500 always computes and appends a valid 4-byte FCS and auto-pads short frames to the 60-byte minimum. So corrupted-CRC and sub-64-byte runt frames can't leave the wire β€” a genuine hardware behavior the author documents honestly rather than hiding.

Q. Is the raw-frame path actually implemented, or is it just claimed? Confirmed in src/w5500_raw.cpp: sendFrame() writes to the socket TX buffer, advances Sn_TX_WR, and issues Sn_CR_SEND; every higher-level module (RFC 2544, injection, IP stack) routes through this one primitive.

Q. What board does it run on? A Waveshare ESP32-S3-POE-ETH with an onboard, PoE-capable W5500 over FSPI at 8 MHz β€” no external Ethernet wiring required.


[ν•œκΈ€ 버전] ESP32 Ethernet Tester β€” W5500 MACRAW둜 κ΅¬ν˜„ν•œ, 손바λ‹₯ μœ„μ˜ L1–L3 λ„€νŠΈμ›Œν¬ 진단 벀치

#W5500 #MACRAW #ESP32S3 #NetworkTesting #RFC2544 #802.1X #PenTest #RawEthernet #PoE #PortValidation

πŸ“š μ»¨ν…μŠ€νŠΈ: μ‹€μ œ Aruba CX6300 μ—”ν„°ν”„λΌμ΄μ¦ˆ μŠ€μœ„μΉ˜λ₯Ό μƒλŒ€λ‘œ μ œμž‘Β·νŠœλ‹ν•œ μ „λ¬Έκ°€μš© 벀치 툴. 검증됨: MACRAW μ†ŒμΌ“ 0 λ“œλΌμ΄λ²„, raw-TX 경둜, μ»€μŠ€ν…€ ARP/IP/UDP/ICMP μŠ€νƒμ„ λͺ¨λ‘ μ½”λ“œ λ ˆλ²¨μ—μ„œ 확인.


01 β€” 이 ν”„λ‘œμ νŠΈλŠ” 무엇인가?

μ—”ν„°ν”„λΌμ΄μ¦ˆ 이더넷 μŠ€μœ„μΉ˜ 포트λ₯Ό κ²€μ¦ν•˜κ³  슀트레슀 ν…ŒμŠ€νŠΈν•˜λ €λ©΄ 보톡 κ°’λΉ„μ‹Ό μž₯λΉ„ λž™μ΄ ν•„μš”ν•˜λ‹€. RFC 2544용 μ „μš© νŠΈλž˜ν”½ μ œλ„ˆλ ˆμ΄ν„°, LLDP/CDP λΆ„μ„μš© ν”„λ‘œν† μ½œ 애널라이저, 802.1X μ„œν”Œλ¦¬μ»¨νŠΈ ν…ŒμŠ€νŠΈμš© 별도 μž₯λΉ„, λ³΄μ•ˆ ν‰κ°€μš© 또 λ‹€λ₯Έ μž₯λΉ„κΉŒμ§€. 무겁고, λ²€μΉ˜μ— λ¬Άμ—¬ 있고, ν˜„μž₯ μ—”μ§€λ‹ˆμ–΄μ—κ²ŒλŠ” 사싀상 손이 λ‹Ώμ§€ μ•ŠλŠ”λ‹€.

ESP32 Ethernet TesterλŠ” 이 λͺ¨λ“  것을 PoE둜 κ΅¬λ™λ˜λŠ” 손바λ‹₯만 ν•œ λ³΄λ“œ ν•˜λ‚˜λ‘œ μ••μΆ•ν•œλ‹€. ESP32-S3κ°€ WIZnet W5500을 raw MAC(MACRAW) λͺ¨λ“œλ‘œ κ΅¬λ™ν•˜μ—¬, νŽŒμ›¨μ–΄κ°€ νšŒμ„  μœ„μ— μ˜¬λΌκ°€λŠ” λͺ¨λ“  λ°”μ΄νŠΈλ₯Ό μ™„μ „νžˆ μ œμ–΄ν•œλ‹€. κ·Έ raw λ ˆμ΄μ–΄ μœ„μ—λŠ” μ˜λ„μ μœΌλ‘œ μ΅œμ†Œν™”ν•œ μ „μš© IPv4 μŠ€νƒ(ARP / IP / UDP / ICMP)이 μ–Ήν˜€ μžˆλ‹€ β€” W5500의 ν•˜λ“œμ›¨μ–΄ TCP/IP 엔진을 μΌλΆ€λŸ¬ μš°νšŒν•΄μ„œ, ν”„λ ˆμž„μ„ ν•„ν„°λ§ν•˜κ±°λ‚˜ μ •κ·œν™”ν•˜λŠ” μš”μ†Œκ°€ ν•˜λ‚˜λ„ 없도둝 λ§Œλ“€μ—ˆλ‹€.

κ·Έ 결과물은 μ§„μ •ν•œ 의미의 μ’…ν•© λ„€νŠΈμ›Œν¬ λ²€μΉ˜λ‹€. RFC 2544 μ²˜λ¦¬λŸ‰/μ§€μ—°/ν”„λ ˆμž„μ†μ‹€ λ²€μΉ˜λ§ˆν‚Ή, LLDP/CDP λ””μŠ€μ»€λ²„λ¦¬ 및 κ΄‘κ³ , 7κ°€μ§€ DHCP μ‹€νŒ¨ μ‹œλ‚˜λ¦¬μ˜€, μ™„μ „ν•œ 802.1X/EAP μ„œν”Œλ¦¬μ»¨νŠΈ(MD5/TLS/PEAP/TTLS), SNMP μ •μ°°, 30μ’… 이상 μ„œλΉ„μŠ€ λ°°λ„ˆ 그랩이 κ°€λŠ₯ν•œ TCP SYN 포트 μŠ€μΊ”, L2 곡격 μŠ€μœ„νŠΈ(VLAN 홉핑, STP 루트 νƒˆμ·¨, CAM ν”ŒλŸ¬λ”©), FHRP ν•˜μ΄μž¬ν‚Ή ν…ŒμŠ€νŠΈ, DHCPv6, WireGuard VPN 관리, OTA μ—…λ°μ΄νŠΈ, SD μΉ΄λ“œ PCAP 캑처, cron 기반 μŠ€ν¬λ¦½νŒ… μ—”μ§„κΉŒμ§€ β€” 이 μ „λΆ€λ₯Ό μ‹œλ¦¬μ–Ό CLI λ˜λŠ” νƒ­ 방식 Wi-Fi μ›Ή UI둜 μ œμ–΄ν•œλ‹€.

 

RFC2544 μ„±λŠ₯ ν…ŒμŠ€νŠΈ β€” μ²˜λ¦¬λŸ‰(무손싀 μ΅œλŒ€ 전솑λ₯ ), μ§€μ—°(μ΅œμ†Œ/μ΅œλŒ€/평균 RTT), back-to-back(무손싀 μ΅œλŒ€ 연속 λ²„μŠ€νŠΈ)을 μΈ‘μ •. μŠ€μœ„μΉ˜ 포트의 순수 μ„±λŠ₯ 수치λ₯Ό λ½‘λŠ” ν‘œμ€€ 벀치마크.

μ—λŸ¬ ν”„λ ˆμž„ μ£Όμž… ν…ŒμŠ€νŠΈ β€” runt(64λ°”μ΄νŠΈ 미만), giant, jumbo, broadcast, multicast λ“± λΉ„μ •μƒΒ·λŒ€λŸ‰ ν”„λ ˆμž„μ„ μ£Όμž…ν•΄ ν¬νŠΈκ°€ μ–΄λ–»κ²Œ μ²˜λ¦¬ν•˜λŠ”μ§€ μ‹œν—˜.

LLDP/CDP λ””μŠ€μ»€λ²„λ¦¬ β€” 이웃 μž₯λΉ„κ°€ κ΄‘κ³ ν•˜λŠ” 정보(포트 ID, VLAN, 관리 IP λ“±)λ₯Ό μˆ˜μ‹ Β·λ””μ½”λ“œ. λ°˜λŒ€λ‘œ μžμ‹ μ˜ 정보λ₯Ό κ΄‘κ³ ν•˜λŠ” ν…ŒμŠ€νŠΈλ„ κ°€λŠ₯.

DHCP μ‹œλ‚˜λ¦¬μ˜€ ν…ŒμŠ€νŠΈ β€” 정상 DORA νšλ“λΏ μ•„λ‹ˆλΌ μ—¬λŸ¬ μ‹€νŒ¨/이상 μ‹œλ‚˜λ¦¬μ˜€λ₯Ό 검증. DHCPv6도 포함.

802.1X / EAP 인증 ν…ŒμŠ€νŠΈ β€” MD5, TLS, PEAP, TTLS λ°©μ‹μ˜ μ„œν”Œλ¦¬μ»¨νŠΈ 인증을 μ‹œλ„. 포트의 802.1X κ°•μ œ μ—¬λΆ€ 검증.

포트 μŠ€μΊ” & λ°°λ„ˆ 그랩 β€” TCP SYN μŠ€μΊ”μœΌλ‘œ μ—΄λ¦° 포트λ₯Ό μ°Ύκ³ , 30μ’… 이상 μ„œλΉ„μŠ€μ˜ λ°°λ„ˆ 정보λ₯Ό μˆ˜μ§‘.

SNMP μ •μ°° β€” SNMP둜 λŒ€μƒ μž₯λΉ„μ˜ 정보λ₯Ό μˆ˜μ§‘.

L2 곡격 ν…ŒμŠ€νŠΈ β€” VLAN 홉핑, STP 루트 ν΄λ ˆμž„, CAM ν…Œμ΄λΈ” ν”ŒλŸ¬λ”© λ“± L2 계측 곡격을 톡해 μŠ€μœ„μΉ˜μ˜ λ°©μ–΄ 섀정이 μ‹€μ œλ‘œ μž‘λ™ν•˜λŠ”μ§€ 검증.

FHRP ν•˜μ΄μž¬ν‚Ή ν…ŒμŠ€νŠΈ β€” HSRP/VRRP 같은 κ²Œμ΄νŠΈμ›¨μ΄ 이쀑화 ν”„λ‘œν† μ½œμ— λŒ€ν•œ νƒˆμ·¨ μ‹œλ„.

κΈ°λ³Έ L3 진단 β€” ping(ICMP), DNS 쑰회 λ“± μ»€μŠ€ν…€ IP μŠ€νƒ 기반의 κΈ°λ³Έ λ„€νŠΈμ›Œν¬ 도달성 확인.

크게 보면 μ„±λŠ₯ μΈ‘μ •(RFC2544), 슀트레슀/μ—λŸ¬ μ£Όμž…, ν”„λ‘œν† μ½œ λ””μŠ€μ»€λ²„λ¦¬(LLDP/CDP), 인증·DHCP 검증(802.1X/DHCP), λ³΄μ•ˆ 평가(ν¬νŠΈμŠ€μΊ”Β·L2곡격·FHRPΒ·SNMP) λ‹€μ„― 갈래둜 λ‚˜λ‰œλ‹€κ³  보면 돼.

02 β€” μ™œ raw-frame ν…ŒμŠ€νŒ…μΈκ°€?

πŸ”· νšŒμ„ μ˜ μ™„μ „ν•œ μ œμ–΄κΆŒ

일반적인 NIC(λ˜λŠ” ν•˜λ“œμ›¨μ–΄ μ˜€ν”„λ‘œλ“œ TCP/IP μΉ©)λŠ” μ£Όμ†Œ 처리, 체크섬, μž¬μ „μ†‘, ν”„λ ˆμ΄λ°μ„ μ•Œμ•„μ„œ μ²˜λ¦¬ν•΄μ€€λ‹€. 그런데 λ„€νŠΈμ›Œν¬ ν…ŒμŠ€ν„°μ—μ„œλŠ” λ°”λ‘œ 그것이 ν•˜λ©΄ μ•ˆ λ˜λŠ” 일이닀. μžμ΄μ–ΈνŠΈ ν”„λ ˆμž„, PAUSE ν”„λ ˆμž„, λ³€ν˜•λœ DHCP DISCOVER, μœ„μ‘° BPDU, μ‘°μž‘λœ HSRP κ΄‘κ³ λ₯Ό μ£Όμž…ν•˜λ €λ©΄, νŽŒμ›¨μ–΄κ°€ 이더넷 ν”„λ ˆμž„ 전체λ₯Ό 직접 λ§Œλ“€μ–΄ PHY에 μ†λŒ€μ§€ μ•Šμ€ μ±„λ‘œ λ„˜κ²¨μ•Ό ν•œλ‹€. Raw MAC μ ‘κ·Όλ§Œμ΄ 이걸 κ°€λŠ₯ν•˜κ²Œ ν•œλ‹€.

πŸ”· ν•˜λ‚˜μ˜ PHY, λͺ¨λ“  계측

ν…ŒμŠ€ν„°κ°€ raw ν”„λ ˆμž„μ„ μ†Œμœ ν•˜κΈ° λ•Œλ¬Έμ—, 단일 μž₯λΉ„κ°€ L1(PHY 속도/λ“€ν”Œλ ‰μŠ€ κ°•μ œ), L2(VLAN/STP/LLDP/CDP/ARP), L3(자체 IP/UDP/ICMP μŠ€νƒ)μ—μ„œ λͺ¨λ‘ λ™μž‘ν•œλ‹€ β€” κ³„μΈ΅λ§ˆλ‹€ 별도 μž₯λΉ„κ°€ ν•„μš” μ—†λ‹€. λ””μŠ€μ»€λ²„λ¦¬, μΈμ μ…˜, λ²€μΉ˜λ§ˆν‚Ή, λ³΄μ•ˆ 평가가 μ „λΆ€ λ™μΌν•œ raw νŒŒμ΄ν”„λ₯Ό 톡해 λŒμ•„κ°„λ‹€.

πŸ”· WIZnet μƒνƒœκ³„ λ‚΄ 적합성

WIZnet 라인업 μ€‘μ—μ„œ 이런 μ’…λ₯˜μ˜ νˆ΄μ—λŠ” W5500의 MACRAW λͺ¨λ“œκ°€ μžμ—°μŠ€λŸ¬μš΄ 선택이닀. κ²¬κ³ ν•œ SPI μΈν„°νŽ˜μ΄μŠ€μ™€ 잘 λ¬Έμ„œν™”λœ Sn_MR_MACRAW μ†ŒμΌ“ λͺ¨λ“œκ°€, 짧은 μ˜¨λ³΄λ“œ PCB 트레이슀 μœ„μ—μ„œ κΉ¨λ—ν•˜κ³  결정둠적인 raw-frame 경둜λ₯Ό μ œκ³΅ν•œλ‹€ β€” κ°œλ³„ PHY(예: ENC28J60)λ₯Ό λΉ„νŠΈλ±…μž‰ν•˜κ±°λ‚˜ LAN8742A의 RMII 타이밍과 μ”¨λ¦„ν•˜λŠ” 것보닀 훨씬 λ‹¨μˆœν•˜κ³  μ•ˆμ •μ μ΄λ‹€. 배터리/PoE ꡬ동 ν•Έλ“œν—¬λ“œμ—μ„œλŠ” 이 톡합 밀도가 결정적이닀.

03 β€” μ‹œμŠ€ν…œ μ•„ν‚€ν…μ²˜πŸ”· WIZnet μƒνƒœκ³„ λ‚΄ 적합성

RFC 2544 벀치마크 μŠ€μœ„νŠΈλΆ€ν„° 둜그(rogue) 802.1X μΈμ¦μžκΉŒμ§€, λͺ¨λ“  κΈ°λŠ₯ λͺ¨λ“ˆμ€ κ²°κ΅­ 단 ν•˜λ‚˜μ˜ ν”„λ¦¬λ―Έν‹°λΈŒ W5500Raw::sendFrame()을 ν˜ΈμΆœν•œλ‹€. 이 단일 μ½”λ“œ κ²½λ‘œκ°€ 전체 μ•„ν‚€ν…μ²˜λ₯Ό ν•˜λ‚˜λ‘œ λ¬ΆλŠ” νž˜μ΄λ‹€.

 

 

04 β€” μ™œ W5500인가? ⭐

πŸ”· 기술적 핡심: MACRAWκ°€ ν•˜λ“œμ›¨μ–΄ μ‹ λ’°μ„±κ³Ό ν•¨κ»˜ raw L2 접근을 μ œκ³΅ν•œλ‹€

이 ν”„λ‘œμ νŠΈ μ „μ²΄λŠ” 단 ν•˜λ‚˜μ˜ λŠ₯λ ₯ μœ„μ— μ„Έμ›Œμ Έ μžˆλ‹€. μž„μ˜μ˜ 이더넷 ν”„λ ˆμž„μ„ νšŒμ„  μœ„μ— 올리고, λ˜λŒμ•„μ˜€λŠ” λͺ¨λ“  ν”„λ ˆμž„μ„ 필터링 없이 μˆ˜μ‹ ν•˜λŠ” λŠ₯λ ₯. W5500은 이것을 MACRAW μ†ŒμΌ“ λͺ¨λ“œλ‘œ μ •ν™•νžˆ μ œκ³΅ν•œλ‹€.

πŸ”· μ‚¬μš© λͺ¨λ“œ: MACRAW (Sn_MR_MACRAW, Sn_MR = 0x04) β€” μ½”λ“œμ—μ„œ 검증됨

이건 좔둠이 μ•„λ‹ˆλΌ src/w5500_raw.cppμ—μ„œ 직접 ν™•μΈλœ 사싀이닀.

  • μ†ŒμΌ“ 0을 _writeReg8(Sn_MR, BSB_S0_REG, Sn_MR_MACRAW)둜 μ—΄κ³ , μ†ŒμΌ“ μƒνƒœ λ ˆμ§€μŠ€ν„°κ°€ SOCK_MACRAW둜 μ½νžˆλŠ”μ§€ κ²€μ¦ν•œλ‹€.
  • MAC 필터링을 μ˜λ„μ μœΌλ‘œ λΉ„ν™œμ„±ν™”ν•˜μ—¬ μ„Έκ·Έλ¨ΌνŠΈ μƒμ˜ λͺ¨λ“  ν”„λ ˆμž„μ„ μˆ˜μ‹ ν•œλ‹€ (νŒ¨μ‹œλΈŒ μ •μ°°, PCAP 캑처, ν”„λ‘œν† μ½œ λ””μ½”λ“œμ— ν•„μˆ˜).
  • RX μ‹œ W5500이 각 μˆ˜μ‹  MACRAW ν”„λ ˆμž„ μ•žμ— λΆ™μ΄λŠ” 2λ°”μ΄νŠΈ 길이 ν”„λ¦¬ν”½μŠ€λ₯Ό μ˜¬λ°”λ₯΄κ²Œ μ²˜λ¦¬ν•œλ‹€.
  • TX μ‹œ sendFrame()이 ν”„λ ˆμž„μ„ μ†ŒμΌ“ TX 버퍼에 μ“°κ³ , Sn_TX_WR을 μ „μ§„μ‹œν‚¨ λ’€ Sn_CR_SENDλ₯Ό λ°œν–‰ν•œλ‹€ β€” κ΅κ³Όμ„œμ μΈ raw 전솑 경둜.

무엇보닀도, W5500의 ν•˜λ“œμ›¨μ–΄ TCP/IP 엔진은 μ™„μ „νžˆ μš°νšŒλœλ‹€. μ»€μŠ€ν…€ IpStack(src/ip_stack.cpp)이 ARP, IPv4, UDP, ICMPλ₯Ό μ†μœΌλ‘œ 직접 λ§Œλ“€μ–΄ 각각을 _eth.sendFrame()으둜 λ°€μ–΄ λ„£λŠ”λ‹€. 이것이 이 ν”„λ‘œμ νŠΈλ₯Ό μ •μ˜ν•˜λŠ” 섀계 결정이닀. μ™„μ „ν•œ raw-frame μ œμ–΄κΆŒμ„ μœ μ§€ν•˜λ©΄μ„œλ„ L3/DHCP ν…ŒμŠ€νŠΈλ₯Ό κ°€λŠ₯ν•˜κ²Œ ν•œλ‹€.

πŸ”· λŒ€μ²΄ μ†”λ£¨μ…˜ λŒ€λΉ„ μš°μœ„

  • vs. ENC28J60: W5500은 훨씬 κ²¬κ³ ν•˜κ³  잘 μΆ”μƒν™”λœ SPI λ ˆμ§€μŠ€ν„° μΈν„°νŽ˜μ΄μŠ€μ™€ μ‹ λ’°μ„± μžˆλŠ” MACRAW λ™μž‘μ„ μ œκ³΅ν•˜μ—¬, ENC28J60의 μ•…λͺ… 높은 errata와 μˆ˜λ™ 버퍼 관리 뢀담을 ν”Όν•œλ‹€.
  • vs. RMII PHY (LAN8742A λ“±): RMII 클둝/타이밍 골칫거리가 μ—†κ³  ESP32의 λ‚΄μž₯ EMAC에 μ˜μ‘΄ν•˜μ§€ μ•ŠλŠ”λ‹€ β€” κΉ¨λ—ν•œ SPI λ²„μŠ€λ§ŒμœΌλ‘œ μΆ©λΆ„ν•΄, λ‚΄λΆ€ MAC을 ν•΄λ°©μ‹œν‚€κ³  PoE ν•Έλ“œν—¬λ“œ 섀계λ₯Ό λ‹¨μˆœν™”ν•œλ‹€.
  • vs. W5500 자체 TCP/IP μ˜€ν”„λ‘œλ“œ: μ˜€ν”„λ‘œλ“œλŠ” λͺ©μ  자체λ₯Ό λ¬΄λ„ˆλœ¨λ¦°λ‹€. MACRAWμ•Όλ§λ‘œ W5500이 ν΄λΌμ΄μ–ΈνŠΈκ°€ μ•„λ‹ˆλΌ ν…ŒμŠ€ν„°μ— λ§žλŠ” μ΄μœ λ‹€.

πŸ”· κ²€μ¦λœ 증거 βœ…

  • βœ… w5500_raw.cppμ—μ„œ MACRAW μ†ŒμΌ“ 0 μ„€μ • 확인.
  • βœ… raw TX 경둜(Sn_TX_WR + Sn_CR_SEND) 확인.
  • βœ… ip_stack.cppμ—μ„œ λͺ¨λ“  ν”„λ ˆμž„μ„ sendFrame()으둜 λΌμš°νŒ…ν•˜λŠ” μ»€μŠ€ν…€ IP μŠ€νƒ 확인.
  • βœ… μ‹€μ œ Aruba CX6300 μƒλŒ€λ‘œ μ œμž‘Β·νŠœλ‹ (README 기재).
  • βœ… MACRAW ν•˜λ“œμ›¨μ–΄ ν•œκ³„(FCS μžλ™ λΆ€μ°©μœΌλ‘œ μΈν•œ μ§„μ§œ CRC-μ—λŸ¬/runt μ£Όμž… λΆˆκ°€)λ₯Ό μ •μ§ν•˜κ²Œ λ¬Έμ„œν™” β€” μ‹€μ œ μ‹€λ¦¬μ½˜ μœ„μ—μ„œ 돌렀본 μ €μžμ˜ 흔적.

05 β€” 핡심 ꡬ성 μš”μ†Œ

🌐 WIZnet W5500 β€” MACRAW λͺ¨λ“œ (raw L2 μ—”μ§„)

이 툴의 심μž₯. Waveshare ESP32-S3-POE-ETH λ³΄λ“œ μœ„μ—μ„œ λ™μž‘ν•˜λ©°, W5500이 μ˜¨λ³΄λ“œ PoE μ§€μ›μœΌλ‘œ ν†΅ν•©λ˜μ–΄ FSPI 8 MHz둜 μ—°κ²°λœλ‹€ (짧은 트레이슀라 40 MHzκΉŒμ§€ 올릴 μ—¬μœ  있음). λͺ¨λ“  raw TX/RX, μ—λŸ¬ μΈμ μ…˜, μ»€μŠ€ν…€ IP μŠ€νƒμ΄ 이 μœ„μ— μ–Ήν˜€ μžˆλ‹€.

🧠 ESP32-S3 (Waveshare ESP32-S3-POE-ETH)

16 MB ν”Œλž˜μ‹œ, 8 MB PSRAM, USB-C. CLI νŒŒμ„œ, ESPAsyncWebServer νƒ­ UI, EAP-TLS/PEAP/TTLS용 mbedTLS, NVS μ˜μ†ν™”, λ“€μ–Ό OTA νŒŒν‹°μ…˜ μŠ€ν‚΄μ„ ν˜ΈμŠ€νŒ…ν•œλ‹€.

πŸ”§ μ»€μŠ€ν…€ μ΅œμ†Œ IPv4 μŠ€νƒ

ARP(μΊμ‹œ 포함) + IPv4 + UDP + ICMPλ₯Ό MACRAW μœ„μ— μ†μœΌλ‘œ κ΅¬ν˜„. W5500 ν•˜λ“œμ›¨μ–΄ μŠ€νƒμ„ κ±΄λ“œλ¦¬μ§€ μ•Šκ³  ping, DHCP DORA, DNS, SNMP, 포트 μŠ€μΊ”μ„ κ°€λŠ₯ν•˜κ²Œ ν•œλ‹€.

πŸ“‘ ν”„λ‘œν† μ½œ & λ³΄μ•ˆ μŠ€μœ„νŠΈ

RFC 2544, LLDP/CDP(λ””μ½”λ“œ + κ΄‘κ³ ), 802.1X μ„œν”Œλ¦¬μ»¨νŠΈ + 둜그 인증자(hashcat-5500 좜λ ₯), DHCP/DHCPv6 μ‹œλ‚˜λ¦¬μ˜€, FHRP(HSRP/VRRP) 평가, L2 곡격 μŠ€μœ„νŠΈ, SNMP μ •μ°°, 30μ’… 이상 μ„œλΉ„μŠ€ λ°°λ„ˆ ν”„λ‘œλΈŒ TCP SYN μŠ€μΊλ„ˆ.

πŸ’Ύ ν˜„μž₯ λŒ€μ‘ 인프라

Wi-Fi STA/AP μ›Ή UI, HTTPS + basic-auth, 원격 κ΄€λ¦¬μš© WireGuard 터널, SD μΉ΄λ“œ PCAP/둜그/슀크립트 μ €μž₯, cron μŠ€μΌ€μ€„λŸ¬, TFTP/HTTP OTA.

06 β€” μ‘μš© μ‹œλ‚˜λ¦¬μ˜€

01. μ—”ν„°ν”„λΌμ΄μ¦ˆ μŠ€μœ„μΉ˜ 포트 컀미셔닝

μƒˆ μŠ€μœ„μΉ˜λ₯Ό ν”„λ‘œλ•μ…˜μ— λ„˜κΈ°κΈ° μ „, μ—”μ§€λ‹ˆμ–΄κ°€ ν…ŒμŠ€ν„°λ₯Ό 꽂고 test all둜 RFC 2544 수치λ₯Ό 뽑고, LLDP 이웃 정보λ₯Ό ν™•μΈν•˜κ³ , DHCP λ™μž‘μ„ κ²€μ¦ν•˜κ³ , 802.1X κ°•μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•œλ‹€ β€” μ „λΆ€ ν•Έλ“œν—¬λ“œ ν•˜λ‚˜λ‘œ.

02. λ…ΈνŠΈλΆ μ—†λŠ” ν˜„μž₯ νŠΈλŸ¬λΈ”μŠˆνŒ…

PoE ꡬ동에 μ›Ή 기반이라, 원격 ν¬νŠΈμ— λ˜μ Έλ†“κ³  Wi-Fi(λ˜λŠ” λ³Έμ‚¬λ‘œ μ΄μ–΄μ§€λŠ” WireGuard)둜 접속할 수 μžˆλ‹€. κ²°κ³ΌλŠ” SD에 λ‘œκΉ…λ˜κ³  cron으둜 μ˜ˆμ•½ν•΄ 무인 μ•Όκ°„ μ κ²€κΉŒμ§€ λŒλ¦°λ‹€.

03. μΈκ°€λœ λ„€νŠΈμ›Œν¬ λ³΄μ•ˆ 평가

armed λͺ¨λ“œμ—μ„œ νŽœν…ŒμŠ€ν„°κ°€ ARP MITM, STP 루트 νƒˆμ·¨, VLAN 홉핑, 둜그 DHCP/DHCPv6/DNS, FHRP ν•˜μ΄μž¬ν‚Ή, 둜그 802.1X 인증자λ₯Ό μ‹€ν–‰ν•˜μ—¬, λ„€νŠΈμ›Œν¬μ˜ ν•˜λ“œλ‹(DHCP μŠ€λˆ„ν•‘, Root Guard, DAI, 802.1X, FHRP 인증)이 μ‹€μ œλ‘œ λ²„ν‹°λŠ”μ§€ κ²€μ¦ν•œλ‹€.

04. ν”„λ‘œν† μ½œ ꡐ윑 & 랩 μ‹€μŠ΅

λͺ¨λ“  ν”„λ ˆμž„μ„ μ†μœΌλ‘œ λ§Œλ“€κΈ° λ•Œλ¬Έμ—, 이 μ½”λ“œλ² μ΄μŠ€λŠ” LLDP, CDP, HSRP, VRRP, EAP, DHCP, MS-CHAPv2κ°€ νšŒμ„  μœ„μ—μ„œ μ‹€μ œλ‘œ μ–΄λ–»κ²Œ μƒκ²ΌλŠ”μ§€ λ³΄μ—¬μ£ΌλŠ” μ‚΄μ•„μžˆλŠ” λ ˆνΌλŸ°μŠ€λ‹€ β€” μ •λ§λ‘œ 배울 게 λ§Žμ€ MACRAW ν”„λ‘œμ νŠΈ.

κ²°λ‘ 

손바λ‹₯만 ν•œ PoE ꡬ동 λ³΄λ“œ ν•˜λ‚˜κ°€, W5500의 MACRAW λͺ¨λ“œλ₯Ό μ˜ˆμ „μ—” λž™ 마운트 5자리 수 μž₯λΉ„μ˜ μ˜μ—­μ΄μ—ˆλ˜ μ™„μ „ν•œ L1–L3 λ„€νŠΈμ›Œν¬ ν…ŒμŠ€νŠΈΒ·ν‰κ°€ 벀치둜 λ°”κΏ”λ†“μ•˜λ‹€.

  • βœ… W5500 MACRAWλ₯Ό ν†΅ν•œ μ™„μ „ν•œ raw-frame μ œμ–΄ (μ†ŒμŠ€μ—μ„œ 검증)
  • βœ… raw L2 μœ„μ— 얹은 μ»€μŠ€ν…€ ARP/IP/UDP/ICMP μŠ€νƒ β€” ν•˜λ“œμ›¨μ–΄ TCP/IP μ˜λ„μ  우회
  • βœ… RFC 2544 벀치마크 μŠ€μœ„νŠΈ (μ²˜λ¦¬λŸ‰/μ§€μ—°/손싀/back-to-back)
  • βœ… μ™„μ „ν•œ 802.1X/EAP μ„œν”Œλ¦¬μ»¨νŠΈ + hashcat 좜λ ₯ 둜그 인증자
  • βœ… 깊이 μžˆλŠ” L2/L3 λ³΄μ•ˆ 평가 νˆ΄ν‚· (VLAN/STP/ARP/FHRP/DHCP/DNS/SNMP)
  • βœ… νƒ­ 방식 Wi-Fi μ›Ή UI + μ‹œλ¦¬μ–Ό CLI + μŠ€ν¬λ¦½νŒ…/cron μžλ™ν™”
  • βœ… ν˜„μž₯κΈ‰ 인프라: PoE, HTTPS, WireGuard, SD PCAP/둜그, OTA
  • βœ… μ‹€μ œ μ—”ν„°ν”„λΌμ΄μ¦ˆ ν•˜λ“œμ›¨μ–΄(Aruba CX6300)둜 검증
  • βœ… MACRAW ν•˜λ“œμ›¨μ–΄ ν•œκ³„λ₯Ό μ •μ§ν•˜κ²Œ λ¬Έμ„œν™” β€” μ—”μ§€λ‹ˆμ–΄λ§ μ§„μ •μ„±

Q&A

Q. W5500의 μ–΄λ–€ μ†ŒμΌ“ λͺ¨λ“œλ₯Ό μ“°λ©°, μ™œ ν•˜λ“œμ›¨μ–΄ TCP/IP μŠ€νƒμ„ μ•ˆ μ“°λ‚˜? μ†ŒμΌ“ 0을 MACRAW(Sn_MR_MACRAW)둜, MAC 필터링을 끈 μƒνƒœλ‘œ μ‚¬μš©ν•œλ‹€. λ„€νŠΈμ›Œν¬ ν…ŒμŠ€ν„°λŠ” νšŒμ„  μœ„ λͺ¨λ“  λ°”μ΄νŠΈλ₯Ό μ œμ–΄ν•˜κ³  κ΄€μ°°ν•΄μ•Ό ν•˜λ―€λ‘œ, ν•˜λ“œμ›¨μ–΄ TCP/IP μ˜€ν”„λ‘œλ“œλ₯Ό μΌλΆ€λŸ¬ μš°νšŒν•˜κ³  raw ν”„λ ˆμž„ μœ„μ— μ»€μŠ€ν…€ κ²½λŸ‰ IP μŠ€νƒμ„ 직접 μ˜¬λ Έλ‹€.

Q. μ™œ μ§„μ§œ CRC-μ—λŸ¬λ‚˜ runt ν”„λ ˆμž„μ„ μ£Όμž…ν•  수 μ—†λ‚˜? MACRAW λͺ¨λ“œμ—μ„œ W5500은 항상 μœ νš¨ν•œ 4λ°”μ΄νŠΈ FCSλ₯Ό 계산해 뢙이고, 짧은 ν”„λ ˆμž„μ„ 60λ°”μ΄νŠΈ μ΅œμ†Œκ°’μœΌλ‘œ μžλ™ νŒ¨λ”©ν•œλ‹€. κ·Έλž˜μ„œ CRCκ°€ κΉ¨μ§„ ν”„λ ˆμž„κ³Ό 64λ°”μ΄νŠΈ 미만 runt ν”„λ ˆμž„μ€ νšŒμ„ μœΌλ‘œ λ‚˜κ°ˆ 수 μ—†λ‹€ β€” μ €μžκ°€ μˆ¨κΈ°μ§€ μ•Šκ³  μ •μ§ν•˜κ²Œ λ¬Έμ„œν™”ν•œ μ‹€μ œ ν•˜λ“œμ›¨μ–΄ λ™μž‘μ΄λ‹€.

Q. raw-frame κ²½λ‘œκ°€ μ‹€μ œλ‘œ κ΅¬ν˜„λœ 건가, μ•„λ‹ˆλ©΄ μ£Όμž₯뿐인가? src/w5500_raw.cppμ—μ„œ 확인됨: sendFrame()이 μ†ŒμΌ“ TX 버퍼에 μ“°κ³ , Sn_TX_WR을 μ „μ§„μ‹œν‚€κ³ , Sn_CR_SENDλ₯Ό λ°œν–‰ν•œλ‹€. μƒμœ„ λͺ¨λ“ˆ μ „λΆ€(RFC 2544, μΈμ μ…˜, IP μŠ€νƒ)κ°€ 이 단일 ν”„λ¦¬λ―Έν‹°λΈŒλ₯Ό κ±°μΉœλ‹€.

Q. μ–΄λ–€ λ³΄λ“œμ—μ„œ λŒμ•„κ°€λ‚˜? μ˜¨λ³΄λ“œ PoE 지원 W5500을 FSPI 8 MHz둜 얹은 Waveshare ESP32-S3-POE-ETH β€” μ™ΈλΆ€ 이더넷 λ°°μ„  λΆˆν•„μš”.


Original Link: https://github.com/micgresham/esp32-ethernet-tester

Comments

Comments