在 Linux 上为特定 USB 网络设备设置稳定接口名:摆脱 MAC 地址和 USB 端口变化

在 Linux 上使用 USB 蜂窝网络设备、便携式路由器或手机 USB 网络共享时,经常会遇到一个看似不起眼、实际上很影响自动化的问题: 同一台 USB 网络设备重新启动后,网卡名称可能发生变化。 如果系统配置、路由优先级、监控脚本或自动化服务依赖固定接口名,这种变化就会带来麻烦。 一种常见做法是根据 MAC 地址生成接口名,另一种做法是绑定 USB 物理端口。但这两种方式都有局限。 更稳妥的方案是: 识别设备本身,而不是识别它当前的 MAC 地址或插在哪一个 USB 口。 本文记录一种基于 systemd.link 和 udev 设备属性的实现方式。 一、问题:USB 网络接口名称并不一定稳定 许多 USB 网络共享设备通过 RNDIS、CDC Ethernet 等方式向 Linux 暴露网络接口。 系统可能根据 MAC 地址生成类似这样的名称: 如果设备每次重新启动都会生成新的 MAC 地址,那么就可能出现: 对于普通桌面使用,这通常没有太大问题。 但对于一台长期运行的 Linux 主机,如果配置中存在: 或者脚本中需要: 那么接口名变化就会破坏自动化。 二、第一种解决方法:绑定 …

Designing Reliable Multi-Uplink Networking on a Raspberry Pi with dhcpcd, Wi-Fi, and USB Cellular Fallback

A Raspberry Pi used as a portable server or remote-management node often needs more than one way to reach the network. A practical design may include three independent uplinks: The challenge is not merely getting all three interfaces online. The system should also have a predictable priority order, survive reboots, …

Operating a Tor Relay from Japan: Scarcity, Network Diversity, and Contribution

Japan has world-class broadband infrastructure, extensive fiber deployment, major Internet exchanges, and sophisticated hosting providers. Yet the number of publicly visible Tor relays in Japan can be surprisingly small—often only a few dozen Running relays in a given consensus snapshot. The apparent contradiction becomes easier to understand when broadband speed …

How the Tor Directory System Automatically Evaluates Relays

A Tor relay does not join the network through a conventional account-registration or manual approval process. The Tor directory system continuously discovers, evaluates, measures, and publishes relay information through a distributed protocol operated by Directory Authorities and supporting measurement infrastructure. 1. There Is No Central Relay Registration Database A new …

Understanding Tor Relay Flags: Running, Valid, Fast, Stable, HSDir, and Guard

Tor relay flags describe what the network currently knows about a relay and which roles that relay is eligible to perform. They are not badges manually assigned by Tor Project staff. Most are calculated automatically by Directory Authorities according to protocol rules and network measurements. Running Running means the Directory …