Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Pi as a WiFi access point does not work

by remi on Sun Sep 08, 2013 7:32 am

I bought an onion pi from adafruit and I am having a lot of trouble setting it up.

As part of the onion pi tutorial I tried to make a wireless access point [1] but the very first install instruction fails:

sudo apt-get install isc-dhcp-server
gives
[FAIL] Starting ISC DHCP server: dhcpd[....] check syslog for diagnostics. ... failed!
failed!

tail /var/log/syslog
raspberrypi dhcpd: No subnet declaration for eth0 (192.168.2.5).
raspberrypi dhcpd: ** Ignoring requests on eth0. If this is not what
raspberrypi dhcpd: you want, please write a subnet declaration
raspberrypi dhcpd: in your dhcpd.conf file for the network segment
raspberrypi dhcpd: to which interface eth0 is attached. **
raspberrypi dhcpd:
raspberrypi dhcpd: Not configured to listen on any interfaces!

So I tried another tutorial [2] that is advertised at the beginning of the ada tutorial.
I had to change the driver that they use and it almost works. I can now connect to my 'Onion Pi' network, but when I try to browse to a page the page doesn't load for a while, then the computer tries to re-connect and that fails.

What should I do to make this work?

Can someone please help?

[1] http://learn.adafruit.com/setting-up-a- ... cess-point
[2] http://elinux.org/RPI-Wireless-Hotspot
remi
 
Posts: 7
Joined: Sun Sep 08, 2013 7:03 am

Re: Pi as a WiFi access point does not work

by adafruit_support_rick on Sun Sep 08, 2013 9:32 am

The original series of error messages you posted sound like your Pi is not connected to a network. It's trying the wired ethernet interface ("eth0"), but it's either not configured correctly or it's not attached at all.
Were you connected to a wired network at the time?
If so, have you changed eth0 from dhcp to a static configuration?
User avatar
adafruit_support_rick
 
Posts: 8473
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Pi as a WiFi access point does not work

by remi on Sun Sep 08, 2013 9:59 am

The Pi is connected to the internet. It can download and I can remote ssh to it.

If so, have you changed eth0 from dhcp to a static configuration?

Not completely sure what you mean. I just did exactly as described in the ada tutorial.
remi
 
Posts: 7
Joined: Sun Sep 08, 2013 7:03 am

Re: Pi as a WiFi access point does not work

by adafruit_support_mike on Sun Sep 08, 2013 7:34 pm

You need to edit your /etc/dhcp/dhcpd.conf file to tell the server what range of addresses you want to use.

The error message in your first post says your ethernet connection is on a network using addresses in the 192.168.2.x block, so to serve addresses for that block you'd want a stanza that looks like so:

Code: Select all
subnet 192.168.2.0 netmask 255.255.255.0 {
    range 192.168.2.128 192.168.2.254;
    option routers 192.168.2.1;
    option domain-name-servers 8.8.8.8, 4.2.2.2;
}

You could use different values for the 'range' line.. the range above puts all DHCP-served addresses in the top half of the address space, leaving room for machines with statically configured addresses in the 1-127 range.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7015
Joined: Thu Feb 11, 2010 1:51 pm

Re: Pi as a WiFi access point does not work

by remi on Mon Sep 09, 2013 2:54 am

My /etc/dhcp/dhcpd.conf contains (among a lot of other lines) this:

Code: Select all
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.130 192.168.2.155;
option broadcast-address 192.168.2.255;
option routers 192.168.2.5;
default-lease-time 600;
max-lease-time 7200;
option domain-name "local";
option domain-name-servers 8.8.8.8, 8.8.4.4;
}


My pi is on 192.168.2.5

When I run sudo service isc-dhcp-server start it fails, and the syslog says this:
dhcpd: No subnet declaration for wlan0 (192.168.5.2).

Notice the difference between 2.5 en 5.2
remi
 
Posts: 7
Joined: Sun Sep 08, 2013 7:03 am

Re: Pi as a WiFi access point does not work

by adafruit_support_rick on Mon Sep 09, 2013 8:49 am

Can you post what's in your /etc/network/interfaces file?
User avatar
adafruit_support_rick
 
Posts: 8473
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Pi as a WiFi access point does not work

by remi on Mon Sep 09, 2013 12:30 pm

Code: Select all
auto lo
iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
#iface wlan0 inet manual
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp

iface wlan0 inet static
  address 192.168.2.5
  netmask 255.255.255.0

up iptables-restore < /etc/iptables.ipv4.nat


I did mistype the address 192.168.2.5 but now I corrected it.

So now these two are running:
Code: Select all
pi@raspberrypi ~ $ sudo service isc-dhcp-server status
Status of ISC DHCP server: dhcpd is running.
pi@raspberrypi ~ $ sudo service hostapd status
[ ok ] hostapd is running.


But pi wifi still doesn't work..

EDIT:

When I connect to the network and fail to load a page, this is what syslog tells me:
Code: Select all
pi@raspberrypi ~ $ tail /var/log/syslog
Sep  9 17:26:35 raspberrypi hostapd: wlan0: STA 68:a8:6d:50:ce:44 WPA: pairwise key handshake completed (RSN)
Sep  9 17:28:46 raspberrypi hostapd: wlan0: STA 68:a8:6d:50:ce:44 IEEE 802.11: disassociated
Sep  9 17:30:45 raspberrypi hostapd: wlan0: STA 68:a8:6d:50:ce:44 IEEE 802.11: associated
Sep  9 17:30:45 raspberrypi hostapd: wlan0: STA 68:a8:6d:50:ce:44 RADIUS: starting accounting session 522E0433-00000002
Sep  9 17:30:45 raspberrypi hostapd: wlan0: STA 68:a8:6d:50:ce:44 WPA: pairwise key handshake completed (RSN)
Sep  9 17:30:47 raspberrypi dhcpd: DHCPREQUEST for 192.168.2.2 from 68:a8:6d:50:ce:44 via wlan0: unknown lease 192.168.2.2.
Sep  9 17:30:49 raspberrypi dhcpd: DHCPREQUEST for 192.168.2.2 from 68:a8:6d:50:ce:44 via wlan0: unknown lease 192.168.2.2.
Sep  9 17:30:54 raspberrypi dhcpd: DHCPREQUEST for 192.168.2.130 from 68:a8:6d:50:ce:44 via wlan0
Sep  9 17:30:54 raspberrypi dhcpd: DHCPACK on 192.168.2.130 to 68:a8:6d:50:ce:44 via wlan0
Sep  9 17:31:49 raspberrypi hostapd: wlan0: STA 68:a8:6d:50:ce:44 IEEE 802.11: disassociated
remi
 
Posts: 7
Joined: Sun Sep 08, 2013 7:03 am

Re: Pi as a WiFi access point does not work

by adafruit_support_rick on Mon Sep 09, 2013 12:47 pm

You appear to have disabled the WPA negotiation - you've commented out the reference to the wpa_supplicant.conf script.
I think you need to add that back in:
Code: Select all
allow-hotplug wlan0
iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp
User avatar
adafruit_support_rick
 
Posts: 8473
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Pi as a WiFi access point does not work

by remi on Mon Sep 09, 2013 1:42 pm

I changed it but it still doesn't work.

Code: Select all
pi@raspberrypi ~ $ tail /var/log/syslog
Sep  9 18:39:27 raspberrypi dhcpd: Wrote 1 leases to leases file.
Sep  9 18:39:27 raspberrypi dhcpd: Multiple interfaces match the same subnet: wlan0 eth0
Sep  9 18:39:27 raspberrypi dhcpd: Multiple interfaces match the same shared network: wlan0 eth0
Sep  9 18:40:05 raspberrypi hostapd: wlan0: STA 68:a8:6d:50:ce:44 IEEE 802.11: associated
Sep  9 18:40:05 raspberrypi hostapd: wlan0: STA 68:a8:6d:50:ce:44 RADIUS: starting accounting session 522E15D6-00000000
Sep  9 18:40:05 raspberrypi hostapd: wlan0: STA 68:a8:6d:50:ce:44 WPA: pairwise key handshake completed (RSN)
Sep  9 18:40:06 raspberrypi dhcpd: DHCPREQUEST for 192.168.2.2 from 68:a8:6d:50:ce:44 via wlan0: unknown lease 192.168.2.2.
Sep  9 18:40:09 raspberrypi dhcpd: DHCPREQUEST for 192.168.2.130 from 68:a8:6d:50:ce:44 via wlan0
Sep  9 18:40:09 raspberrypi dhcpd: DHCPACK on 192.168.2.130 to 68:a8:6d:50:ce:44 via wlan0
Sep  9 18:40:22 raspberrypi hostapd: wlan0: STA 68:a8:6d:50:ce:44 IEEE 802.11: disassociated
remi
 
Posts: 7
Joined: Sun Sep 08, 2013 7:03 am

Re: Pi as a WiFi access point does not work

by adafruit_support_rick on Mon Sep 09, 2013 6:09 pm

We might have to wait for Mike to chime in here - my linux-fu is not up to the challenge.
Mike is off for a couple of days...
User avatar
adafruit_support_rick
 
Posts: 8473
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: Pi as a WiFi access point does not work

by remi on Tue Sep 10, 2013 1:18 am

Ok. Thanks!
remi
 
Posts: 7
Joined: Sun Sep 08, 2013 7:03 am

Re: Pi as a WiFi access point does not work

by adafruit_support_mike on Tue Sep 10, 2013 8:24 am

Actually, I think I can do this one-handed: the error messages suggest that your en0 and wlan0 interfaces both have addresses from the 192.168.2.0/255.255.255.0 block. It's a little hard to tell because your /etc/network/interfaces file has en0 configured to get an address from a dhcp server on the wired network.

First, could you post the output from `ifconfig -a` so we can take a look at the exact settings for each interface? Second, if both interfaces are in the same block, move the wlan0 settings to another block.. 192.168.3.0/255.255.255.255, for instance.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7015
Joined: Thu Feb 11, 2010 1:51 pm

Re: Pi as a WiFi access point does not work

by remi on Thu Sep 12, 2013 11:35 am

If I change the ip address in /etc/dhcp/dhcpd.conf from 192.168.2.0 to 192.168.3.0 I can not restart the isc-dhcp-server

Where exactly should I use 192.168.3.x over 192.168.2.x ?

Code: Select all
pi@raspberrypi ~ $ ifconfig -a
eth0      Link encap:Ethernet  HWaddr b8:27:eb:7d:bd:bc 
          inet addr:192.168.2.3  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1492  Metric:1
          RX packets:75486 errors:0 dropped:0 overruns:0 frame:0
          TX packets:58722 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6016342 (5.7 MiB)  TX bytes:6525350 (6.2 MiB)

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1289 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1289 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:124872 (121.9 KiB)  TX bytes:124872 (121.9 KiB)

wlan0     Link encap:Ethernet  HWaddr 44:33:4c:6c:09:37 
          inet addr:192.168.2.5  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
remi
 
Posts: 7
Joined: Sun Sep 08, 2013 7:03 am

Re: Pi as a WiFi access point does not work

by adafruit_support_mike on Sun Sep 15, 2013 9:22 pm

You also need to edit /etc/network/interfaces to put the wlan0 interface in the same address block as the DHCP server.

There's a good set of instructions in our tutorial: http://learn.adafruit.com/setting-up-a- ... l-software
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 7015
Joined: Thu Feb 11, 2010 1:51 pm

Re: Pi as a WiFi access point does not work

by th3goodth3badth3ugly on Sat Oct 19, 2013 11:19 pm

It appears that following the tutorials you have posted guarantees someone to have errors. I also have the same errors that remi is having. Try the tutorial yourself and see what happens. It really doesn't take that long to do it...

A solution would be AWESOME btw.
th3goodth3badth3ugly
 
Posts: 3
Joined: Thu Aug 08, 2013 6:36 pm