蘭雅sRGB 个人笔记 https://262235.xyz
提供编程和电脑应用视频教程,工具和源代码
C, C++, Python Programming, Source Code, Video

旧Hexo博客 | Github | IP定位WebAPI | Docker Hub
编程中文文档 | 网盘分享 | 中文Linux命令

Debian命令行配置Wifi网络

查看无线网卡设备名称

iwconfig

$ iwconfig

lo        no wireless extensions.

enp3s0    no wireless extensions.

wlp1s0    IEEE 802.11  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm   
          Retry short limit:7   RTS thr=2347 B   Fragment thr:off
          Encryption key:off
          Power Management:off

建立Wifi密码配置文件

$ mkdir -p /etc/wpa_supplicant
$ wpa_passphrase NET-WIFI  wifi0988 | tee  /etc/wpa_supplicant/wap_supplicant.conf

network={
    ssid="NET-WIFI"
    #psk="wifi0988"
    psk=a5285ee353231742c48f8977b3434f66cdc29ed34af2f23d82e54afd50bf1dd4
}

interfaces 文件添加无线配置

vim /etc/network/interfaces

auto  wlp1s0
iface wlp1s0 inet dhcp
wpa-conf /etc/wpa_supplicant/wap_supplicant.conf

加载无线网卡名称 wlp1s0

ifdown wlp1s0 && ifup wlp1s0

$ ifdown wlp1s0 && ifup wlp1s0

Killed old client process
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlp1s0/00:e0:4c:91:b8:49
Sending on   LPF/wlp1s0/00:e0:4c:91:b8:49
Sending on   Socket/fallback
DHCPRELEASE of 192.168.0.187 on wlp1s0 to 192.168.0.1 port 67
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlp1s0/00:e0:4c:91:b8:49
Sending on   LPF/wlp1s0/00:e0:4c:91:b8:49
Sending on   Socket/fallback
DHCPDISCOVER on wlp1s0 to 255.255.255.255 port 67 interval 8

DHCPOFFER of 192.168.0.187 from 192.168.0.1
DHCPREQUEST for 192.168.0.187 on wlp1s0 to 255.255.255.255 port 67
DHCPACK of 192.168.0.187 from 192.168.0.1
bound to 192.168.0.187 -- renewal in 43088 seconds.

$ ip a

3: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:e0:4c:91:b8:49 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.187/24 brd 192.168.0.255 scope global dynamic wlp1s0
       valid_lft 86384sec preferred_lft 86384sec
    inet6 fe80::2e0:4cff:fe91:b849/64 scope link 
       valid_lft forever preferred_lft forever
本原创文章自由转载,转载请注明本博来源及网址 | 当前页面:兰雅sRGB个人笔记 » Debian命令行配置Wifi网络