差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

兩邊的前次修訂版 前次修改
下次修改
前次修改
tech:debian_net_tips [2021/01/16 14:41] – 更換 plugin jonathantech:debian_net_tips [2022/01/23 21:38] (目前版本) jonathan
行 1: 行 1:
-====== [draft]Debin Wi-Fi 網路介面設定 ======+====== Debin Wi-Fi 網路介面設定 ======
 因為設備有 wifi 網卡與 Ethernet 網卡, 安裝時只有自動抓到有線網卡, 現在想要啟動 wifi 網卡來使用 因為設備有 wifi 網卡與 Ethernet 網卡, 安裝時只有自動抓到有線網卡, 現在想要啟動 wifi 網卡來使用
 +  * 設定環境 PVE 7.1 (debian_version : 11.2 Bullseye)
 +  * 預計連上 SSID : **ichiayi** WiFi AP
  
 ===== 設定程序 ===== ===== 設定程序 =====
行 6: 行 8:
   - 確認 wifi 網卡名稱 <code sh>   - 確認 wifi 網卡名稱 <code sh>
 ls -lt /sys/class/net/| grep -v virtual</code>結果類似以下<cli> ls -lt /sys/class/net/| grep -v virtual</code>結果類似以下<cli>
-root@aac:/etc/network# ls -lt /sys/class/net/| grep -v virtual+root@nuc:~# ls -lt /sys/class/net/| grep -v virtual
 total 0 total 0
-lrwxrwxrwx 1 root root 0 Jul 18 13:38 wlp2s0 -> ../../devices/pci0000:00/0000:00:13.3/0000:02:00.0/net/wlp2s0 +lrwxrwxrwx 1 root root    Jan 23 13:06 wlp0s20f3 -> ../../devices/pci0000:00/0000:00:14.3/net/wlp0s20f3 
-lrwxrwxrwx 1 root root 0 Jul 18 13:30 enp1s0 -> ../../devices/pci0000:00/0000:00:13.0/0000:01:00.0/net/enp1s0 +-rw-r--r-- 1 root root 4096 Jan 23 13:06 bonding_masters 
-</cli>所以 wifi 網卡名稱就是 **wlp2s0**+lrwxrwxrwx 1 root root    Jan 23 13:06 eno1 -> ../../devices/pci0000:00/0000:00:1f.6/net/eno1 
 +</cli>所以 wifi 網卡名稱就是 **wlp0s20f3** 
 +  - 用 WiFi AP 的 SSID/密碼 產生連上 psk<cli> 
 +root@nuc:~# wpa_passphrase ichiayi **ichiayi_password** 
 +network={ 
 +        ssid="ichiayi" 
 +        #psk="**ichiayi_password**" 
 +        psk=1dfdf**************************************************1087dcd52 
 +
 +</cli>
   - 建立 WPA 認證相關設定檔案<code sh>   - 建立 WPA 認證相關設定檔案<code sh>
 mkdir -p /etc/wpa_supplicant mkdir -p /etc/wpa_supplicant
行 22: 行 33:
 network={ network={
         ssid="ichiayi"         ssid="ichiayi"
 +        proto=WPA2
         key_mgmt=WPA-PSK         key_mgmt=WPA-PSK
-        psk="ketchup_and_mustard"+        psk=1dfdf**************************************************1087dcd52
 } }
 </file> </file>
   - 編輯 interfaces 網路介面設定<code sh>vi /etc/network/interfaces</code>內容類似以下<file>   - 編輯 interfaces 網路介面設定<code sh>vi /etc/network/interfaces</code>內容類似以下<file>
 : :
-auto wlp2s0 +auto wlp0s20f3 
-iface wlp2s0 inet static +iface wlp0s20f3 inet dhcp 
-        address 192.168.11.5 +        pre-up wpa_supplicant -B -Dwext -iwlp0s20f3 -c/etc/wpa_supplicant/wpa_supplicant.conf
-        netmask 255.255.255.0 +
-        wireless-essid ichiayi +
-        pre-up wpa_supplicant -B -Dwext -iwlp2s0 -c/etc/wpa_supplicant/wpa_supplicant.conf+
         post-down killall -q wpa_supplicant         post-down killall -q wpa_supplicant
 : :
 </file> </file>
-  - 使用 ifup 啟動 wifi 網卡, 指令類似以下<code sh>+  - 啟動 wpa_supplicant 服務<cli>
 systemctl restart wpa_supplicant systemctl restart wpa_supplicant
-ifup wlp2s0 +</cli> 
-</code>+  - 重啟網路服務<cli> 
 +systemctl restart networking.service 
 +</cli> 
 +  - 驗證是否正常連上 WiFi AP<cli> 
 +wpa_cli -i wlp0s20f3 status 
 +</cli>如果正確連上應該類似以下的訊息<cli> 
 +root@nuc:~# wpa_cli -i wlp0s20f3 status 
 +bssid=28:6c:07:68:fe:89 
 +freq=0 
 +ssid=ichiayi 
 +id=0 
 +mode=station 
 +wifi_generation=5 
 +pairwise_cipher=CCMP 
 +group_cipher=TKIP 
 +key_mgmt=WPA2-PSK 
 +wpa_state=COMPLETED 
 +ip_address=192.168.31.251 
 +address=04:ea:56:87:58:34 
 +uuid=14ea0bcc-c7f5-592c-ba49-159bbe31e49d 
 +</cli> 
 +  - 使用 ip addr show wlp0s20f3 就可看到目前的設定<cli> 
 +root@nuc:~# ip addr show wlp0s20f3 
 +3: wlp0s20f3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 
 +    link/ether 04:ea:56:87:58:34 brd ff:ff:ff:ff:ff:ff 
 +    inet 192.168.31.251/24 brd 192.168.31.255 scope global dynamic wlp0s20f3 
 +       valid_lft 39290sec preferred_lft 39290sec 
 +    inet6 fe80::6ea:56ff:fe87:5834/64 scope link  
 +       valid_lft forever preferred_lft forever 
 +</cli>
  
 +<note>
 +  * 如果有修改 /etc/wpa_supplicant/wpa_supplicant.conf 需要執行 reconfig 來生效<cli>
 +root@nuc:~# wpa_cli -i wlp0s20f3 reconfig
 +OK
 +root@nuc:~# wpa_cli -i wlp0s20f3 status
 +bssid=62:a4:4c:67:26:74
 +freq=0
 +ssid=ichiayi_n56u_5G
 +id=0
 +:
 +</cli>
 +</note>
  
 +<WRAP center round alert 60%>
 +**針對在 PVE 環境將 WiFi 網卡加入 Bridge 並沒有設定成功**
 +  * 目前似乎是 **bridging does not work with WiFi** (主要是 VM 要使用 WiFi Bridge 的問題)
 +  * 找尋的相關資料如下: 
 +    * https://unix.stackexchange.com/questions/363332/how-do-i-configure-a-network-interface-bridge-from-wifi-to-ethernet-with-debian
 +    * https://pve.proxmox.com/wiki/WLAN
 +    * https://forum.proxmox.com/threads/wlan-doesnt-stay-in-bridge.49978/
 +    * https://blog.csdn.net/qq_19905867/article/details/114118476
 +    * https://www.reddit.com/r/Proxmox/comments/pttmr2/can_i_use_proxmox_with_only_wifi_broken_ethernet/
 +</WRAP>
  
 ===== 參考網址 ===== ===== 參考網址 =====
行 48: 行 108:
   * https://wiki.debian.org/WiFi   * https://wiki.debian.org/WiFi
   * http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch13_:_Linux_Wireless_Networking#.XxKqtygzZPY   * http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch13_:_Linux_Wireless_Networking#.XxKqtygzZPY
 +  * https://codeleading.com/article/88945302379/
  
-{{tag>pve network draft}}+{{tag>pve network}}
  
  • tech/debian_net_tips.1610779273.txt.gz
  • 上一次變更: 2021/01/16 14:41
  • jonathan