net_device 不是二层设备:Linux 网络接口抽象到底抽象了什么
net_device 不是“网卡/二层设备”的专用抽象,而是通用网络接口对象。Ethernet、bridge、VLAN 是 L2,TUN、loopback、PPP 也是 net_device,但属于 L3。
Engineering notes and ranked practice on OpenWrt / Yocto / NVIDIA Tegra and edge AI gateways: understand by reading, grow through practice; traceable, reproducible, bounded.
Practice and exams · routing/bridging/debugging
138 questions cover ip addr / ip link / ip route / bridge, VLANs, policy routing, NAT, raw IP and iPerf3 throughput. Exams grade at the end; practice gives instant feedback.
This is not command memorization; it builds a troubleshooting order: link → bridge → rule → table → route → NAT → capture.
Draw 25 random questions from the 100 / 38 bank; 20 to pass. Submit at the end.
PracticeGrade immediately; previous, skip and jump to any question.
Attention, FFN, positional encoding, training and inference
OpenWrtUCI, netifd, ubus, fw4, ImageBuilder
OpenWrtUCI, netifd, bridge/VLAN, static routes, PPPoE
VLAN802.1Q, PVID, access/trunk, bridge vlan filtering
ACLgetfacl/setfacl, mask, default ACLs, inheritance and backup
prplOS / AMXData model, transactions, NetModel, USP
YoctoLayers, recipes, BitBake, images
PPPoEpppd, LCP, auth, DNS, teardown
iPerf3TCP/UDP, reverse, loss, trustworthy results
net_device 不是“网卡/二层设备”的专用抽象,而是通用网络接口对象。Ethernet、bridge、VLAN 是 L2,TUN、loopback、PPP 也是 net_device,但属于 L3。
ip tuntap add dev tun0 mode tun 的核心是 open /dev/net/tun + TUNSETIFF。它只创建接口,不管 ip link up、ip addr add;持久化要 TUNSETPERSIST。
先用 ip/tcpdump/ping 纯命令行创建和验证 TUN,再用 60 行 C 程序读包、改 ICMP、写回 TUN,让 ping 真正收到 reply。
TUN 是三层 IP 的门,不是 802.15.4 帧的入口。MCU 给 IPv6 才能直接灌 TUN;给 802.15.4 帧必须先经 OpenThread/6LoWPAN 转成 IPv6,内核才做路由转发。
802.15.4 是 IEEE 的低速低功耗无线 PHY/MAC 标准。Thread 和 Zigbee 都跑在它上面,但射频芯片可以通用,协议栈、固件和射频能力不能想当然互换。
OpenThread 上 OpenWrt 不是把协议栈源码搬进内核,而是 RCP 射频固件 + OpenWrt 的 openthread-br 包 + netifd proto。本文给出 UCI 配置、建网和排障路径。
Subscribe via RSS to get new posts automatically.
Technical questions, feedback and leads: use the guestbook.