gpt4 book ai didi

linux - 连接到 WEP wifi 时没有 DHCP 响应

转载 作者:太空宇宙 更新时间:2023-11-04 10:45:10 25 4
gpt4 key购买 nike

我无法在 Linux (Mint) 上连接到 WEP wifi:我没有收到 DHCP 提议。

我的 bash 脚本(我以 root 身份启动)执行以下操作:

pkill dhclient
pkill wpa_supplicant #just in case
ip link set dev wlan0 down
ip addr flush dev wlan0
iwconfig wlan0 essid "MyWifi"
iwconfig wlan0 enc off
ip link set dev wlan0 up
dhclient -v wlan0

当我启动它时,我没有收到 DHCP 提议:

Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/e8:4e:06:24:b2:9e
Sending on LPF/wlan0/e8:4e:06:24:b2:9e
Sending on Socket/fallback
DHCPREQUEST of 192.168.100.101 on wlan0 to 255.255.255.255 port 67 (xid=0x19efd6f2)
DHCPREQUEST of 192.168.100.101 on wlan0 to 255.255.255.255 port 67 (xid=0x19efd6f2)
DHCPREQUEST of 192.168.100.101 on wlan0 to 255.255.255.255 port 67 (xid=0x19efd6f2)
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3 (xid=0x17d23b2f)
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3 (xid=0x17d23b2f)
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5 (xid=0x17d23b2f)
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 11 (xid=0x17d23b2f)
...

重要:

  • 我没有 NetworkManager(未运行和删除 - I saw that was a common issue),我更喜欢使用命令行。
  • 当我扫描我的 wifi 时,我发现它没问题:

    sudo iwlist wlan0 scan
    wlan0 Scan completed :
    Cell 01 - Address: 20:C9
    [..]
    Cell 02 - Address: 02:26:C6:2F:46:7E
    Channel:9
    Frequency:2.452 GHz (Channel 9)
    Quality=54/70 Signal level=-56 dBm
    Encryption key:off
    ESSID:"MyWifi"
    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 48 Mb/s
    54 Mb/s; 6 Mb/s; 9 Mb/s
    Bit Rates:12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
    Mode:Ad-Hoc
    Extra:tsf=0000000001ed4e21
    Extra: Last beacon: 32ms ago
    IE: Unknown: 000B6950686F6E65204D795769
    IE: Unknown: 010882848B96606C0C12
    IE: Unknown: 030109
    IE: Unknown: 06020000
    IE: Unknown: 2A0100
    IE: Unknown: 320418243048
  • 我知道 wifi 可以工作,因为我有其他设备连接到它

  • 我知道我的 wifi 加密狗也能正常工作,因为我设法连接到其他 wifi (WPA)。

最佳答案

好的,我找到了解决方案。默认情况下,我使用的是“托管”模式。但在 iwlist 扫描中,它说“临时”:

 Mode:Ad-Hoc

因此,连接到我的 Wifi 的正确脚本是:

 #!/bin/bash
pkill dhclient
pkill wpa_supplicant #just in case
ip link set dev wlan0 down
ip addr flush dev wlan0
iwconfig wlan0 essid "MyWifi"
iwconfig wlan0 enc off
iwconfig wlan0 key off
iwconfig wlan0 mode Ad-Hoc
ip link set dev wlan0 up
dhclient -v wlan0

那行得通:)

关于linux - 连接到 WEP wifi 时没有 DHCP 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33377699/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com