跳转至

第一次联网

以下命令在ubuntu22.04上测试通过

1. 检查无线网卡是否被识别

##### 1.1 如果是USB无线网卡

Bash
lsusb
以下为输出
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 046d:c534 Logitech, Inc. Unifying Receiver
Bus 001 Device 004: ID 048d:5702 Integrated Technology Express, Inc. ITE Device
Bus 001 Device 009: ID 0bda:b711 Realtek Semiconductor Corp. RTL8188GU 802.11n WLAN Adapter (After Modeswitch)   这里有WLAN,为无线网卡。   RTL8188GU为网卡驱动型号,安装驱动的话,应该安装RTL8188GU驱动,我这里使用的是 水星MW150US_V2.0无线网卡
Bus 001 Device 003: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
1.2 如果是PCI无线网卡
Bash
lspci

2. 检查网络接口

Bash
nmcli device status
以下为输出
DEVICE  TYPE      STATE   CONNECTION     
enp3s0  ethernet  已连接  netplan-enp3s0 
lo      loopback  未托管  --       

Text Only
ip link
以下为输出
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: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 74:56:3c:38:a6:eb brd ff:ff:ff:ff:ff:ff

无线网卡显示wlan0或者类似名称,这里缺少驱动。

3. 安装驱动

安装驱动后显示如下:

这里以安装rtl8188gu驱动为例,

https://github.com/McMCCRU/rtl8188gu# ,编译安装

Text Only
nmcli device status  或 ip link 显示网络信息
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: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 74:56:3c:38:a6:eb brd ff:ff:ff:ff:ff:ff
4: wlx005cc2403763: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000   这个就是无线网卡
    link/ether 00:5c:c2:40:37:63 brd ff:ff:ff:ff:ff:ff
Bash
sudo lshw -C network 显示网路信息
[sudo] ken 的密码: 

  *-network          有线网络       
       description: Ethernet interface
       product: RTL8125 2.5GbE Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: enp3s0
       version: 05
       serial: 74:56:3c:38:a6:eb
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=6.2.0-26-generic duplex=full firmware=rtl8125b-2_0.0.2 07/13/20 ip=192.168.110.237 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:18 ioport:3000(size=256) memory:42100000-4210ffff memory:42110000-42113fff
  *-network   无线网络
       description: Wireless interface
       physical id: 7
       bus info: usb@1:11.1
       logical name: wlx005cc2403763
       serial: 00:5c:c2:40:37:63
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=rtl8710bu driverversion=6.2.0-26-generic ip=172.16.101.209 multicast=yes wireless=IEEE 802.11bgn

3. 连接wifi

如果是图形界面,这里可以使用右上角或者设置进行wifi连接

显示wifi

Bash
nmcli device wifi list
IN-USE  BSSID              SSID              MODE   CHAN  RATE        SIGNAL  B>
        7A:86:90:5B:3C:8D  麦当劳freewifi    Infra  1     270 Mbit/s  89      ▂>
        FE:7D:72:72:86:92  areyouOk          Infra  6     130 Mbit/s  80      ▂>
        EC:41:F9:79:16:20  ZTE_791620        Infra  9     135 Mbit/s  75      ▂>
        78:A1:3E:50:41:71  --                Infra  6     130 Mbit/s  62      ▂>
        78:A1:3E:50:41:70  LJW               Infra  6     130 Mbit/s  62      ▂>
        44:39:B1:BD:FC:38  🍔🍔🍔            Infra  8     130 Mbit/s  59      ▂>
        EA:4B:B1:36:C1:4C  WIFIAP            Infra  11    270 Mbit/s  47      ▂>
        5C:46:B0:9A:9B:3D  hehehehehe        Infra  6     65 Mbit/s   45      ▂>
        C2:5E:BE:E6:A4:A3  666               Infra  1     130 Mbit/s  42      ▂>
        3E:FF:D8:3D:C2:B0  山东炒货          Infra  11    130 Mbit/s  42      ▂>
        E2:A0:F6:F6:A2:98  HUAWEI-1B         Infra  1     130 Mbit/s  40      ▂>
        E2:A0:F6:F6:A2:A6  HUAWEI-1B_Wi-Fi5  Infra  1     130 Mbit/s  39  

连接wifi

Bash
nmcli device wifi connect LJM password wifipassword, 这里LJM和wifipassword换成wifi名称和密码。