我需要一个在 Poky(Yocto 项目参考发行版)1.7.3 上运行的 Linux 的静态 IP。
一切工作都通过 DHCP 进行。现在我尝试使用 wlan0 的 .network 配置来获取静态 IP,但不起作用。我遵循以下示例:https://wiki.archlinux.org/index.php/systemd-networkd#Wired_adapter_using_a_static_IP 我的 wlan0.network 如下所示:
[Match]
Name=wlan0
[Network]
Address=192.168.10.111
Gateway=192.168.10.1
重启后,我仍然通过 DHCP 获取 IP(例如 102.168.10.102)。
如果我这样做,它确实有效:ifconfig wlan0 192.168.10.111
可能出了什么问题,为什么它不能与 .network 配置文件一起工作?
journalctl | grep wlan
给出:
Jul 13 13:07:33 reach kernel: vwlan gpio 96
Jul 13 13:07:33 reach kernel: vwlan: 1800 mV
Jul 13 13:07:33 reach kernel: found wifi platform device wlan
Jul 13 13:07:34 reach kernel: Register interface [wlan0] MAC: 00:00:00:00:00:00
Jul 13 13:07:38 reach systemd-networkd[186]: wlan0: gained carrier
Jul 13 13:07:38 reach systemd-networkd[186]: wlan0: could not set route: Network is unreachable
Jul 13 13:07:38 reach systemd-networkd[186]: wlan0: link configured
Jul 13 13:07:38 reach mDNSResponder[227]: mDNSPlatformSendUDP got error 99 (Cannot assign requested address) sending packet to FF02:0000:0000:0000:0000:0000:0000:00FB on interface FE80:0000:0000:0000:92B6:86FF:FE06:D3F3/wlan0/3
Jul 13 13:07:38 reach mDNSResponder[227]: mDNSPlatformSendUDP got error 99 (Cannot assign requested address) sending packet to FF02:0000:0000:0000:0000:0000:0000:00FB on interface FE80:0000:0000:0000:92B6:86FF:FE06:D3F3/wlan0/3
Jul 13 13:07:38 reach mDNSResponder[227]: mDNSPlatformSendUDP got error 99 (Cannot assign requested address) sending packet to FF02:0000:0000:0000:0000:0000:0000:00FB on interface FE80:0000:0000:0000:92B6:86FF:FE06:D3F3/wlan0/3
Jul 13 13:07:45 reach systemd[1]: wpa_supplicant_wlan0_event.service: main process exited, code=exited, status=255/n/a
Jul 13 13:07:45 reach wpa_cli[312]: Failed to connect to non-global ctrl_ifname: wlan0 error: No such file or directory
Jul 13 13:07:45 reach systemd[1]: Unit wpa_supplicant_wlan0_event.service entered failed state.
Jul 13 13:07:46 reach systemd-networkd[186]: wlan0: lost carrier
Jul 13 13:07:46 reach wpa_cli[317]: Failed to connect to non-global ctrl_ifname: p2p-dev-wlan0 error: No such file or directory
Jul 13 13:07:46 reach systemd[1]: wpa_supplicant_wlan0_event.service holdoff time over, scheduling restart.
Jul 13 13:07:50 reach systemd-networkd[186]: wlan0: gained carrier