【问题标题】:Rasberry PI : Unable to set my RPI as a routerRaspberry PI:无法将我的 RPI 设置为路由器
【发布时间】:2013-12-13 10:08:00
【问题描述】:

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

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

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

以下是我的配置:

/etc/网络/接口

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

【问题讨论】:

  • 你的加密狗有什么芯片组?
  • lsusb ==> 总线 001 设备 004:ID 148f:5370 Ralink Technology, Corp. RT5370 无线适配器
  • 这听起来可能很愚蠢,但我听说 wpa 密钥有最小长度,您可以尝试使用 8 个字符的密码。
  • 是的,超过 6 个字符,我也更新了问题
  • 你可以尝试使用 dnsmasq 吗?

标签: linux networking raspberry-pi embedded-linux router


【解决方案1】:

你见过吗?

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。正如我们在您的日志中看到的那样。

【讨论】:

  • 谢谢我在我的 /etc/hostapd/hostapd.conf 文件中添加了相同的内容,但是问题仍然存在。我现在得到这个日志:12 月 13 日 10:48:22 raspberrypi hostapd: wlan0: STA b8:b4:2e:76:ad:1b RADIUS: 开始记帐会话 52AAE56D-00000000 Dec 13 10:48:22 raspberrypi hostapd: wlan0: STA b8:b4:2e:76:ad:1b WPA:成对密钥握手完成 (RSN) 12 月 13 日 10:48:22 raspberrypi dnsmasq-dhcp[2116]: DHCPREQUEST(wlan0) 10.0.0.10 b8:b4:2e:76 :ad:1b Dec 13 10:48:22 raspberrypi dnsmasq-dhcp[2116]: DHCPNAK(wlan0) 10.0.0.10 b8:b4:2e:76:ad:1b 地址错误
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-23
  • 1970-01-01
相关资源
最近更新 更多