gpt4 book ai didi

linux - 树莓派 : Unable to set my RPI as a router

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:35:07 25 4
gpt4 key购买 nike

我有一个 RPI,它通过有线连接到我们组织的路由器,并且在其 USB 端口中插入了一个 WIFI 加密狗。

首先我遵循了这个指令集:

http://sirlagz.net/2012/08/09/how-to-use-the-raspberry-pi-as-a-wireless-access-pointrouter-part-1/

下面是我的配置:

/etc/网络/接口(interface)

auto lo
iface lo inet loopback

iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet static
wireless-essid Test
wireless-key ABCDEFGHIJ
wireless-channel 11
wireless-mode managed
address 192.xxx.x.2
network 192.xxx.1.0
netmask 255.255.255.0
route add default gw 198.xxx.1.1

以下是系统日志:

Dec 13 09:46:07 raspberrypi hostapd: wlan0: STA b8:b4:2e:76:ad:1b IEEE 802.11: authenticated
Dec 13 09:46:07 raspberrypi hostapd: wlan0: STA b8:b4:2e:76:ad:1b IEEE 802.11: associated (aid 1)
Dec 13 09:46:07 raspberrypi hostapd: wlan0: STA b8:b4:2e:76:ad:1b RADIUS: starting accounting session 52AAD693-00000003
Dec 13 09:46:07 raspberrypi dnsmasq-dhcp[2114]: DHCPDISCOVER(wlan0) b8:b4:xx:xx:xx:xx
Dec 13 09:46:07 raspberrypi dnsmasq-dhcp[2114]: DHCPOFFER(wlan0) 192.xx.1.57

下面是我的 hostapd 配置:

interface=wlan0
driver=nl80211
ctrl_interface=/var/run/hostapd
ssid=TEST
wpa_passphrase=TESTTESTTEST
hw_mode=g
channel=11
wmm_enabled=0

以下是 DHCP 配置:

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

send host-name = rasberrypi;
subnet 192.xxx.1.0 netmask 255.255.255.0 {
range 192.xxx.1.3 192.xxx.1.240;
option subnet-mask 255.255.255.0;
option routers 192.xxx.1.2;
option domain-name "test.in";
default-lease-time 21600;
max-lease-time 43200;
};

问题是,在我的 WIFI 移动设备上为我的 WIFI essid 选择并输入密码后,我一直收到“获取 IP 地址..”并且根本没有连接。我尝试使用其他设备但输出相同。

我的配置和设置是否正常?

# iwconfig
mon.wlan0 IEEE 802.11bgn Mode:Monitor Frequency:2.462 GHz Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:on

wlan0 IEEE 802.11bgn Mode:Master Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:on

lo no wireless extensions.

eth0 no wireless extensions.

我还设置了 dnsmasq,下面是我的配置:

root@raspberrypi:~# cat /etc/dnsmasq.conf  | grep -v '#'
interface=wlan0
dhcp-range=192.xxx.1.2,192.xxx.1.254,255.255.255.0,12h

我确实在系统日志中看到以下几行:

Dec 13 09:46:07 raspberrypi dnsmasq-dhcp[2114]: DHCPDISCOVER(wlan0) b8:b4:2e:76:ad:1b
Dec 13 09:46:07 raspberrypi dnsmasq-dhcp[2114]: DHCPOFFER(wlan0) 192.xxx.1.57 b8:b4:2e:76:ad:1b
Dec 13 09:46:11 raspberrypi dnsmasq-dhcp[2114]: DHCPDISCOVER(wlan0) b8:b4:2e:76:ad:1b
Dec 13 09:46:11 raspberrypi dnsmasq-dhcp[2114]: DHCPOFFER(wlan0) 192.xxx.1.57 b8:b4:2e:76:ad:1b
Dec 13 09:46:19 raspberrypi dnsmasq-dhcp[2114]: DHCPDISCOVER(wlan0) b8:b4:2e:76:ad:1b
Dec 13 09:46:19 raspberrypi dnsmasq-dhcp[2114]: DHCPOFFER(wlan0) 192.xxx.1.57 b8:b4:2e:76:ad:1b
Dec 13 09:46:35 raspberrypi dnsmasq-dhcp[2114]: DHCPDISCOVER(wlan0) b8:b4:2e:76:ad:1b
Dec 13 09:46:35 raspberrypi dnsmasq-dhcp[2114]: DHCPOFFER(wlan0) 192.xxx.1.57 b8:b4:2e:76:ad:1b

最佳答案

你见过吗?

wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
rsn_pairwise=CCMP
# I've set these to WPA-PSK to indicate that we are using a Pre-Shared Key with CCMP encryption.
# Otherwise, hostapd also has a built in RADIUS server that we can use for authentcation
# But I'll leave that to another post.

在您的 hostapd 配置中至少添加:wpa_key_mgmt=WPA-PSK,否则默认情况下它将使用 RADIUS。正如我们在您的日志中看到的那样。

关于linux - 树莓派 : Unable to set my RPI as a router,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20563787/

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