运行 ifup wlan0 时无法打开接口文件“/etc/network/interfaces

运行 ifup wlan0 时无法打开接口文件“/etc/network/interfaces

这是我的/etc/network/interfaces文件:

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet dhcp
    wpa-ssid myssidhere
    wpa-psk mypasshere

输出iwconfig

wlp5s0    IEEE 802.11abgn  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=off   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off

iwlist 扫描的输出: lo 接口不支持扫描。

enp0s31f6 接口不支持扫描。

wlp5s0 无法读取扫描数据:网络故障

enp4s0 接口不支持扫描。

输出ls -al /etc/network/interfaces

$ ls -al /etc/network/interfaces
-rw------- 1 root root 366 Nov  3 17:24 /etc/network/interfaces

错误:

~$ sudo ifdown wlp5s0 && sudo ifup -v wlp5s0
RTNETLINK answers: No such process
Internet Systems Consortium DHCP Client 4.3.3
Copyright 2004-2015 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlp5s0/24:ec:99:59:5d:8a
Sending on   LPF/wlp5s0/24:ec:99:59:5d:8a
Sending on   Socket/fallback
Configuring interface wlp5s0=wlp5s0 (inet)
/bin/run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/ethtool
run-parts: executing /etc/network/if-pre-up.d/wireless-tools
run-parts: executing /etc/network/if-pre-up.d/wpasupplicant
wpa_supplicant: wpa-driver nl80211,wext (default)
wpa_supplicant: /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlp5s0.pid -i wlp5s0 -D nl80211,wext -C /run/wpa_supplicant
Starting /sbin/wpa_supplicant...
wpa_supplicant: creating sendsigs omission pidfile: /run/sendsigs.omit.d/wpasupplicant.wpa_supplicant.wlp5s0.pid
wpa_supplicant: ctrl_interface socket located at /run/wpa_supplicant/wlp5s0
wpa_supplicant: configuring network block -- 0
wpa_supplicant: wpa-ssid "TB9JT" -- OK
wpa_supplicant: wpa-psk ***** -- OK
wpa_supplicant: enabling network block 0 -- OK

/sbin/dhclient -1 -v -pf /run/dhclient.wlp5s0.pid -lf /var/lib/dhcp/dhclient.wlp5s0.leases -I -df /var/lib/dhcp/dhclient6.wlp5s0.leases wlp5s0  
Internet Systems Consortium DHCP Client 4.3.3
Copyright 2004-2015 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

RTNETLINK answers: Operation not possible due to RF-kill
Listening on LPF/wlp5s0/24:ec:99:59:5d:8a
Sending on   LPF/wlp5s0/24:ec:99:59:5d:8a
Sending on   Socket/fallback

眼镜

MOTHERBOARD: ASRock H170M LGA 1151 USB 3.0 Mini ITX 
CPU: Intel Core i5-6600 6M Skylake Quad-Core 3.3 GHz LGA 1151
RAM: Crucial 8GB 288-Pin DDR4 SDRAM DDR4 2133
GPU: VGA GeForce GTX 750 2GB GDDR5 PCIe
HDD: SAMSUNG 850 EVO 2.5" 250GB SATA3 SSD

我在这里做错了什么?

答案1

如您所见,您的接口不是 wlan0;而是 wlp5s0。请修改您的文件以读取:

auto lo
iface lo inet loopback

auto wlp5s0
iface wlp5s0 inet dhcp
    wpa-ssid myssidhere
    wpa-psk mypasshere

重启界面:

sudo ifdown wlp5s0 && sudo ifup -v wlp5s0

查看:

ping -c3 www.google.com

您可能需要更正文件的权限:

sudo chmod 644 /etc/network/interfaces

再检查一遍:

sudo ifdown wlp5s0 && sudo ifup -v wlp5s0

相关内容