我设置wlan0
配置(bcm43
从黑名单中取消注释):
root@NanoPC-T2:~# ifconfig -a
eth0 Link encap:Ethernet HWaddr 5e:a5:4f:cc:83:8a
inet addr:195.165.101.232 Bcast:195.165.101.255 Mask:255.255.255.0
inet6 addr: fe80::7ca8:5fff:fecc:738a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:21331 errors:0 dropped:11440 overruns:0 frame:0
TX packets:390 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1734079 (1.7 MB) TX bytes:64331 (64.3 KB)
Interrupt:48
ip6tnl0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:1452 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:3958 errors:0 dropped:0 overruns:0 frame:0
TX packets:3958 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:293200 (293.2 KB) TX bytes:293200 (293.2 KB)
sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
usb0 Link encap:Ethernet HWaddr e2:47:73:46:b9:8f
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 15:a1:a2:a3:c5:4e
inet6 addr: fe80::25d4:a2ff:fea3:c54e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:468 (468.0 B)
并且还设置了/etc/network/interfaces
cat /etc/network/interfaces
auto lo eth0
iface lo inet loopback
iface eth0 inet static
address 195.165.101.232
netmask 255.255.255.0
gateway 195.165.101.254
iface wlan0 inet static
address 195.165.101.232
netmask 255.255.255.0
gateway 195.165.101.254
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
和wpa_supplicant.conf
cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=CN
network={
ssid="V01"
psk="123456"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}
我也这样做,ifconfig wlan0 up
但是当我断开以太网连接时,我无法从 wifi 连接或 ping 到该 IP。
nmcli c
NAME UUID TYPE DEVICE
V01 0c4435f2-7301-8574-9b1b-deb7fd2a7603 802-11-wireless --
V1 1 80b21422-c7ea-568c-8b4c-6f1d8a9dc9f8 802-11-wireless --
答案1
您不能在多个接口上使用相同的 IP 地址(不过,您可以使用绑定将多个接口合并为一个)。
因此(正如您在输出中看到的ifconfig
)wlan0
未分配 IPv4 地址。