Ubuntu 18.04 LTS 配置 WEPA WiFi 为静态地址

Ubuntu 18.04 LTS 配置 WEPA WiFi 为静态地址

我有一台 Ubuntu 18.04.02 LTS(无头)服务器,它一直与以太网通信。情况要求我现在使用 USB Wifi 加密狗切换到 Wifi。我过去曾将此 Wifi 加密狗用于运行 Debian 的 Raspberry Pi 和 Beaglebone 设备,因此这相当简单。(笑疯了?)

由于文件不完整且相互矛盾,我现在发现自己完全迷失了。

我已将配置添加到我的/etc/netplan/50-cloud-init.yaml文件中,如下所示

network:
    version: 2
    renderer: networkd
    ethernets:
        enp2s0:
            addresses:
            - 192.168.1.200/24
            gateway4: 192.168.1.254
            nameservers:
                addresses:
                - 192.168.1.254

   wifis:
       wlx0013efc2047b:
           access-points:
               "MyWiFiAccessPoint":
                password: "hexpassword"
        addresses:
        - 192.168.1.250/24
        gateway4: 192.168.1.254
        nameservers:
            addresses:
            - 192.168.1.254

显然我的配置文件有真实的接入点详细信息。网络管理员似乎对这个配置很满意。

ifconfig列出设备为存在但未连接。结果如下:

enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 192.168.1.200  netmask 255.255.255.0  broadcast 192.168.1.255
    inet6 fe80::230:1bff:fe46:b77f  prefixlen 64  scopeid 0x20<link>
    ether 00:30:1b:46:b7:7f  txqueuelen 1000  (Ethernet)
    RX packets 26035  bytes 7333457 (7.3 MB)
    RX errors 0  dropped 4735  overruns 0  frame 0
    TX packets 18222  bytes 2680521 (2.6 MB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    device interrupt 17

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 252  bytes 20431 (20.4 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 252  bytes 20431 (20.4 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlx0013efc2047b: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    ether 00:13:ef:c2:04:7b  txqueuelen 1000  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ip link show的结果为:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 00:30:1b:46:b7:7f brd ff:ff:ff:ff:ff:ff

3: wlx0013efc2047b: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
link/ether 00:13:ef:c2:04:7b brd ff:ff:ff:ff:ff:ff

看起来设备可用,但我的服务器没有加入我的 WiFi 网络。

lusb 给出以下内容:

Bus 001 Device 002: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

有人可以帮忙吗?

答案1

检查事项:

  • networkctl status wlx0013efc2074b验证 networkd 是否认为它应该管理该设备
  • iwconfig wlx0013efc2074b验证设备是否已成功与 AP 关联

相关内容