我正在尝试让我的 Raspberry Pi 无线工作,这样我就可以像使用 Raspbian 一样连接到我的两个独立网络。我在网上学习了一些教程,这是最后一个似乎对我有帮助的教程:https://medium.com/a-swift-misadventure/how-to-setup-your-raspberry-pi-2-3-with-ubuntu-16-04-without-cables-headlessly-9e3eaad32c01
但还是没有网络。
ifconfig:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.17 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::ba27:ebff:fea3:7b04 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:a3:7b:04 txqueuelen 1000 (Ethernet)
RX packets 619 bytes 142348 (142.3 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 326 bytes 47342 (47.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 211 bytes 52909 (52.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 211 bytes 52909 (52.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
配置:
lo no wireless extensions.
eth0 no wireless extensions.
wlan0 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm
Retry short limit:7 RTS thr=2347 B Fragment thr:off
Power Management:on
lsusb:
Bus 001 Device 005: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
尝试过这个:https://help.ubuntu.com/lts/serverguide/network-configuration.html.en
nmcli radio wifi 开启:
Error: NetworkManager is not running.
nmcli——版本:
nmcli tool, version 1.10.6
任何帮助都值得感激,我已经厌倦了被电缆绊倒并且无法连接到无线和开发 PLC。
lsb_release-d:
Description: Ubuntu 18.04 LTS
猫/etc/netplan/*.yaml:
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
version: 2
ethernets:
eth0:
dhcp4: true
match:
macaddress: b8:27:eb:a3:7b:04
set-name: eth0
答案1
您需要更新您的 netplan 配置。
以下是我的配置/etc/netplan/00-snapd-config.yaml
。我最初使用创建了它console-conf
,但必须手动编辑它才能使其工作。
ubuntu@ubuntu:~$ sudo cat /etc/netplan/00-snapd-config.yaml
# This is the network config written by 'console_conf'
network:
ethernets:
eth0:
dhcp4: true
match:
macaddress: b8:27:eb:03:91:12
set-name: eth0
version: 2
wifis:
wlan0:
access-points:
my_wifi_ssid: {password: my_wifi_password}
addresses: []
dhcp4: true
nameservers: {}
我首先console-conf
使用安装sudo apt install console-conf
,然后使用 运行它sudo console-conf
。
有趣的是,即使这个工具也无法生成正确的配置。出现以下错误消息:
Network configuration failed: 'Error in network definition
//etc/netplan/00-snapd-config.yaml line 4 column 6: eth0:
set-name: requires match: properties\n'
我手动修改了/etc/netplan/00-snapd-config.yaml
- 我从中复制了该ethernets
部分50-cloud-init.yaml
并在各处使用了一致的缩进。
最后我运行sudo netplan apply
。瞧——互联网现在无需以太网电缆就可以工作了!
附言:我怀疑您是否需要经历这个过程console-conf
- 只需复制我的配置并使其适应您的用例即可。
答案2
我设法通过安装网络管理器并运行 nmtui 将我的 pi3b+ 连接到 ubuntu 服务器 18.04(从 ubuntu-18.04.2-preinstalled-server-arm64+raspi3.img.xz 安装)上的 wifi,nmtui 显示可用 wifi 网络的 ncurses 界面并让您连接和配置它们。