poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Tue Nov 06, 2012 3:59 pm

Sorry, I omitted that I had used "/etc/init.d/udhcpd restart" to verify it did work, which it did.

The other tutorial from sirlagz uses dnsmasq with basically the same problem; the phone either verifies and hangs on acquiring an IP address or hangs on verifying.

Very stupid, because it did work at one time :cry:

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Tue Nov 06, 2012 4:19 pm

Sonny_Jim wrote: EDIT: Or just use static addresses if you can't get udhcpd to work.
On second thoughts that makes a lot of sense in my situation, for I basically only need the browser of one e-reader connected to the Pi over WiFi! That can't be too hard, will dive into that in a few days, any tips welcome ;)

Sonny_Jim
Posts: 47
Joined: Tue Oct 23, 2012 4:15 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Tue Nov 06, 2012 5:01 pm

I'm using a zd1211rw based dongle along with hostapd and dnsmasq, which seems to work OK for some devices and not with others. For example my Nintendo DS and N900 both connect fine, but my laptop doesn't want to connect. I'm fairly sure it's a problem with the wireless drivers.

hunternet93
Posts: 336
Joined: Mon Dec 12, 2011 4:34 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Tue Nov 06, 2012 5:01 pm

poing wrote:
hunternet93 wrote: Hmm. Try running the following commands and posting the results:

Code: Select all

sudo service hostapd status
sudo service udhcpd status
sudo ifconfig
sudo iwconfig
The first two commands check if HostAPD and uDHPD are running, the second two give some information on your network interfaces. It's very possible I missed a step when writing the instructions, I wrote them during a break a work and haven't had time to verify them on a Pi yet.
I have two Ralink dongles now. I tried the sirlagz tutorial and had initial success where I could log into my Pi with my phone and see the webpage on the Pi (that's what I need), but then MySQL went corrupt. So I decided to install everything from scratch but now it won't work anymore :( After five tries I'm a bit disparate.

Anyway I tried this tutorial again. What I had to do was change

Code: Select all

DEAMON_CONF=""
into

Code: Select all

DEAMON_CONF="/etc/hostapd/hostapd.conf"
in the file /etc/init.d/hostapd otherwise hostapd wouldn't start.
I don't have my Pi right now, but hostapd should find the config file automatically. If not, I'll update my tutorial.
Next I had to remove the line

Code: Select all

auth_algs=0
from /etc/hostapd/hostapd.conf for it was not allowed to have arguments.
What error did you get? auth_algs=0 is the correct line to put in the config file, which tells hostapd to allow open (passwordless) authentication.
That's where I am, I can see the Access Point but it refuses to give me an IP address, which is the same status I can reach with the sirlagz tutorial (after likewise editing as above, only then I need to change a "group" line in /etc/hostapd/hostapd.conf)

Here's the output from the requested commands:

Code: Select all

pi@raspberrypi ~ $ sudo service hostapd status
[ ok ] hostapd is running.
pi@raspberrypi ~ $ sudo service udhcpd status
Usage: /etc/init.d/udhcpd {start|stop|restart|force-reload}
pi@raspberrypi ~ $ sudo ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:13:26:2e  
          inet addr:192.168.1.123  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1302 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1086 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1140902 (1.0 MiB)  TX bytes:175176 (171.0 KiB)

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:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

mon.wlan0 Link encap:UNSPEC  HWaddr 00-0F-54-0A-AC-E2-00-00-00-00-00-00-00-00-00-00  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:130 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:12684 (12.3 KiB)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 00:0f:54:0a:ac:e2  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:18 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6196 (6.0 KiB)  TX bytes:6520 (6.3 KiB)

pi@raspberrypi ~ $ sudo iwconfig
lo        no wireless extensions.

wlan0     IEEE 802.11bgn  Mode:Master  Frequency:2.427 GHz  Tx-Power=20 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          
eth0      no wireless extensions.

mon.wlan0  IEEE 802.11bgn  Mode:Monitor  Tx-Power=20 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          
pi@raspberrypi ~ $ 
Hope someone can help.
Apparently, udhcpd doesn't report it's status when asked. Try running the command "udhcpd" and see if there are any error messages. Also, it appears that wlan0 hasn't been assigned a static IP address, maybe check /etc/network/interfaces?

hunternet93
Posts: 336
Joined: Mon Dec 12, 2011 4:34 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Tue Nov 06, 2012 5:09 pm

Sonny_Jim wrote:I'm using a zd1211rw based dongle along with hostapd and dnsmasq, which seems to work OK for some devices and not with others. For example my Nintendo DS and N900 both connect fine, but my laptop doesn't want to connect. I'm fairly sure it's a problem with the wireless drivers.
You can check for error messages on the Pi with this command:

Code: Select all

sudo cat /var/log/syslog | grep "hostapd\|udhcpd"
It will produce a lot of output, but if you can copy/paste it here (use "

Code: Select all

" and "[\code]" tags to put the output in it's own scroll box so your post isn't several miles long.)

Sonny_Jim
Posts: 47
Joined: Tue Oct 23, 2012 4:15 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Wed Nov 07, 2012 12:00 am

Here's the thing, hostapd nor the PI ever sees anything coming from my laptop, but it otherwise finds other devices, so I only have this in my laptops dmesg:

Code: Select all

[302172.509572] wlan0: direct probe to 00:17:3f:b1:43:36 (try 1/3)
[302172.708169] wlan0: direct probe to 00:17:3f:b1:43:36 (try 2/3)
[302172.908155] wlan0: direct probe to 00:17:3f:b1:43:36 (try 3/3)
[302173.108138] wlan0: direct probe to 00:17:3f:b1:43:36 timed out
The only reason I setup hostapd was because my DS doesn't support anything other than WEP for encryption and no one uses that nowadays, so I'm not that bothered about it. As someone pointed out for me, a dd-wrt router is just as configurable as a Pi, costs less than a Pi and comes with a PSU :-)

hunternet93
Posts: 336
Joined: Mon Dec 12, 2011 4:34 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Wed Nov 07, 2012 1:57 am

Sonny_Jim wrote:Here's the thing, hostapd nor the PI ever sees anything coming from my laptop, but it otherwise finds other devices, so I only have this in my laptops dmesg:

Code: Select all

[302172.509572] wlan0: direct probe to 00:17:3f:b1:43:36 (try 1/3)
[302172.708169] wlan0: direct probe to 00:17:3f:b1:43:36 (try 2/3)
[302172.908155] wlan0: direct probe to 00:17:3f:b1:43:36 (try 3/3)
[302173.108138] wlan0: direct probe to 00:17:3f:b1:43:36 timed out
The only reason I setup hostapd was because my DS doesn't support anything other than WEP for encryption and no one uses that nowadays, so I'm not that bothered about it. As someone pointed out for me, a dd-wrt router is just as configurable as a Pi, costs less than a Pi and comes with a PSU :-)
There probably is a driver issue somewhere, using a real access point/router is probably a good idea for a "serious" hotspot because it'll have good, working hardware builtin.

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Wed Nov 07, 2012 12:06 pm

hunternet93 wrote: I don't have my Pi right now, but hostapd should find the config file automatically. If not, I'll update my tutorial.
I had the same problem with the sirlagz tutorial when starting from a fresh Raspian install. The first time it worked OK, although then MySQL gave up somehow. I'm using the latest distro 2012-10-28.
hunternet93 wrote: What error did you get? auth_algs=0 is the correct line to put in the config file, which tells hostapd to allow open (passwordless) authentication.
I put the line back then restarted the Pi. hostapd will fail to start. Config file is:

Code: Select all

interface=wlan0
ssid=GlimBox_1
hw_mode=g
channel=4
wmm_enabled=0
auth_algs=0

Code: Select all

pi@raspberrypi ~ $ hostapd -d /etc/hostapd/hostapd.conf
random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
Line 6: no authentication algorithms allowed
1 errors found in configuration file '/etc/hostapd/hostapd.conf'
hunternet93 wrote: Apparently, udhcpd doesn't report it's status when asked. Try running the command "udhcpd" and see if there are any error messages. Also, it appears that wlan0 hasn't been assigned a static IP address, maybe check /etc/network/interfaces?
When I run udhcpd there is no output, this is the contents of /etc/network/interfaces:

Code: Select all

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet static
 address 192.168.2.1
 netmask 255.255.255.0

wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

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

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Wed Nov 07, 2012 12:15 pm

[quote="hunternet93"]
You can check for error messages on the Pi with this command:

Code: Select all

sudo cat /var/log/syslog | grep "hostapd\|udhcpd"
After removing that line again I restarted the Pi and run the above command:

Code: Select all

Nov  6 15:34:56 raspberrypi udhcpd[3595]: udhcpd (v1.20.2) started
Nov  6 15:34:56 raspberrypi udhcpd[3595]: max_leases=235 is too big, setting to 19
Nov  6 15:34:56 raspberrypi udhcpd[3595]: can't open '/var/lib/misc/udhcpd.leases': No such file or directory
Nov  6 15:38:44 raspberrypi udhcpd[3595]: Received SIGTERM
Nov  6 15:39:01 raspberrypi udhcpd[1983]: udhcpd (v1.20.2) started
Nov  6 15:39:01 raspberrypi udhcpd[1983]: max_leases=235 is too big, setting to 19
Nov  6 15:39:01 raspberrypi udhcpd[1983]: can't open '/var/lib/misc/udhcpd.leases': No such file or directory
Nov  6 15:43:10 raspberrypi udhcpd[1983]: Received SIGTERM
Nov  6 15:43:11 raspberrypi udhcpd[2236]: udhcpd (v1.20.2) started
Nov  6 15:43:11 raspberrypi udhcpd[2236]: max_leases=235 is too big, setting to 19
Nov  6 15:43:11 raspberrypi udhcpd[2236]: can't open '/var/lib/misc/udhcpd.leases': No such file or directory
Nov  6 15:50:41 raspberrypi udhcpd[2236]: Received SIGTERM
Nov  6 15:50:59 raspberrypi udhcpd[2005]: udhcpd (v1.20.2) started
Nov  6 15:50:59 raspberrypi udhcpd[2005]: max_leases=235 is too big, setting to 19
Nov  6 15:50:59 raspberrypi udhcpd[2005]: can't open '/var/lib/misc/udhcpd.leases': No such file or directory
Nov  6 15:53:27 raspberrypi udhcpd[2005]: Received SIGTERM
Nov  6 15:53:44 raspberrypi udhcpd[2050]: udhcpd (v1.20.2) started
Nov  6 15:53:44 raspberrypi udhcpd[2050]: max_leases=235 is too big, setting to 19
Nov  6 15:53:44 raspberrypi udhcpd[2050]: can't open '/var/lib/misc/udhcpd.leases': No such file or directory
Nov  6 15:53:44 raspberrypi udhcpd[2050]: is interface wlan0 up and configured?: Cannot assign requested address
Nov  6 15:54:27 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: authenticated
Nov  6 15:54:27 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: associated (aid 1)
Nov  6 15:54:27 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c RADIUS: starting accounting session 50992475-00000000
Nov  6 15:54:58 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: disassociated
Nov  6 15:54:59 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: authenticated
Nov  6 15:54:59 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: associated (aid 1)
Nov  6 15:54:59 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c RADIUS: starting accounting session 50992475-00000001
Nov  6 15:55:29 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: disassociated
Nov  6 15:55:30 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: authenticated
Nov  6 15:55:30 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: associated (aid 1)
Nov  6 15:55:30 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c RADIUS: starting accounting session 50992475-00000002
Nov  6 15:56:00 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: disassociated
Nov  6 15:56:01 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: authenticated
Nov  6 15:56:01 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: associated (aid 1)
Nov  6 15:56:01 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c RADIUS: starting accounting session 50992475-00000003
Nov  6 15:56:12 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: disassociated
Nov  6 15:56:13 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: deauthenticated due to inactivity
Nov  6 16:48:17 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: authenticated
Nov  6 16:48:17 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: associated (aid 1)
Nov  6 16:48:17 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c RADIUS: starting accounting session 50992475-00000004
Nov  6 16:48:41 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: disassociated
Nov  6 16:48:42 raspberrypi hostapd: wlan0: STA 78:d6:f0:45:6f:8c IEEE 802.11: deauthenticated due to inactivity
Nov  7 12:40:07 raspberrypi udhcpd[2013]: udhcpd (v1.20.2) started
Nov  7 12:40:07 raspberrypi udhcpd[2013]: max_leases=235 is too big, setting to 19
Nov  7 12:40:07 raspberrypi udhcpd[2013]: can't open '/var/lib/misc/udhcpd.leases': No such file or directory
Nov  7 13:08:56 raspberrypi udhcpd[2013]: Received SIGTERM
Nov  7 13:09:13 raspberrypi udhcpd[2034]: udhcpd (v1.20.2) started
Nov  7 13:09:13 raspberrypi udhcpd[2034]: max_leases=235 is too big, setting to 19
Nov  7 13:09:13 raspberrypi udhcpd[2034]: can't open '/var/lib/misc/udhcpd.leases': No such file or directory
Nov  7 13:09:13 raspberrypi udhcpd[2034]: is interface wlan0 up and configured?: Cannot assign requested address

hunternet93
Posts: 336
Joined: Mon Dec 12, 2011 4:34 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Wed Nov 07, 2012 12:49 pm

Last night I downloaded the 10-28-2012 Raspbian image and started setting it up. I think I found the problem: a new line has been added to /etc/network/interfaces that starts a program that interferes with hostapd. Comment out the line (by placing a "#" at the beginning of the line):

Code: Select all

 wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf 
I haven't had time to check if that's all that's required to get hostapd to start, but hopefully that resolves the problems people have been having. Also, in hostapd.conf, the line:

Code: Select all

auth_algs=0
should be on of the following:

Code: Select all

auth_algs=1 # for open authentication
auth_algs=2 # for WEP (requires more config, I'll update the tut when I have time)
auth_algs=3 # allow open and WEP
Please let me know if this gets it working!

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Wed Nov 07, 2012 2:16 pm

I changed the line to auth_algs=1 and commented out the line with wpa-roam, but still a no-go. Then I got a brainwave and disconnected the Ethernet :lol:

After about 50 restarts I found I can get my phone and E-reader to connect to the Pi IF:
- I unplug the Ethernet cable
- I send the command "sudo shutdown -r now"
- I next log in and send the command "sudo halt"
- unplug and replug power

Shoot me if you like, but it only works in this combination. I tried everything else, but if I just do a few restarts or a few halts the phone and reader will not connect (also tried to restart the phone and E-reader a few times to make sure the problem isn't them). I realise this seems very unlikely but this is how it seems to work.

Anyway, once I have connection and plug the Ethernet cable in I get Internet on the Pi but not on the phone and E-reader. My guess is that eth0 has to be configured differently and maybe then the crazy restart sequence will not be necessary any more.

hunternet93
Posts: 336
Joined: Mon Dec 12, 2011 4:34 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Wed Nov 07, 2012 2:21 pm

poing wrote:I changed the line to auth_algs=1 and commented out the line with wpa-roam, but still a no-go. Then I got a brainwave and disconnected the Ethernet :lol:

After about 50 restarts I found I can get my phone and E-reader to connect to the Pi IF:
- I unplug the Ethernet cable
- I send the command "sudo shutdown -r now"
- I next log in and send the command "sudo halt"
- unplug and replug power

Shoot me if you like, but it only works in this combination. I tried everything else, but if I just do a few restarts or a few halts the phone and reader will not connect (also tried to restart the phone and E-reader a few times to make sure the problem isn't them). I realise this seems very unlikely but this is how it seems to work.

Anyway, once I have connection and plug the Ethernet cable in I get Internet on the Pi but not on the phone and E-reader. My guess is that eth0 has to be configured differently and maybe then the crazy restart sequence will not be necessary any more.
OK, that's weird. This evening I'll run through my tutorial with a fresh copy of Raspbian and see if I run into the same issues. I think the latest image changed some of the default configuration, which is causing issues with my tutorial.

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Wed Nov 07, 2012 9:04 pm

Thinking about this: usually when strange things like this happen (talking about the needed startup sequence) people on this site cry 'power supply'. So I exchanged the 2A supply of my hub to a 10Ah battery that I plan to use for my project and changed the hub also. Result is exactly the same!

hunternet93
Posts: 336
Joined: Mon Dec 12, 2011 4:34 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Thu Nov 08, 2012 2:03 am

I ran through my tutorial on the latest Raspbian image, and found that few things need to be done differently:
1. Edit the file /etc/default/hostapd and change the line

Code: Select all

#DAEMON_CONF=""
to

Code: Select all

DAEMON_CONF="/etc/hostapd/hostapd.conf"
2. Edit the file /etc/default/udhcpd and comment out (put a # in front of) the line:

Code: Select all

DHCPD_ENABLED="no"
3. In /etc/hostapd/hostapd.conf, the line

Code: Select all

auth_algs=0
should be:

Code: Select all

auth_algs=1
4. Edit /etc/network/interfaces and comment out the lines:

Code: Select all

wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
5. Reboot and test.

Hopefully, this resolves the issues people have been having with the tutorial. If it does, I'll update the tutorial to reflect this.

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Thu Nov 08, 2012 8:40 am

IT WORKS! IT WORKS! IT WORKS! :D (dances around like a little kid ;) )

Thanks for your persistence in pulling us through, although I guess that will teach you to write a tutorial during lunch break without the hardware in front of you :mrgreen:

Anyway, all I had to change was comment out "iface default inet dhcp" for all the other changes were already made.

To make this complete, I copied some lines from the sirlagz tutorial to make the AP use WPA2 security. The file /etc/hostapd/hostapd.conf now reads like this:

Code: Select all

interface=wlan0
ssid=My_AP_Name
hw_mode=g
channel=4

wpa=2
wpa_passphrase=My_Passphrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
rsn_pairwise=CCMP

wmm_enabled=1
auth_algs=3
beacon_int=100
Thanks again, getting this to work is very important to me.

hunternet93
Posts: 336
Joined: Mon Dec 12, 2011 4:34 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Thu Nov 08, 2012 12:07 pm

poing wrote:IT WORKS! IT WORKS! IT WORKS! :D (dances around like a little kid ;) )

Thanks for your persistence in pulling us through, although I guess that will teach you to write a tutorial during lunch break without the hardware in front of you :mrgreen:

Anyway, all I had to change was comment out "iface default inet dhcp" for all the other changes were already made.

To make this complete, I copied some lines from the sirlagz tutorial to make the AP use WPA2 security. The file /etc/hostapd/hostapd.conf now reads like this:

Code: Select all

interface=wlan0
ssid=My_AP_Name
hw_mode=g
channel=4

wpa=2
wpa_passphrase=My_Passphrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
rsn_pairwise=CCMP

wmm_enabled=1
auth_algs=3
beacon_int=100
Thanks again, getting this to work is very important to me.
Cool! I'll update the tutorial when I get a chance.

hunternet93
Posts: 336
Joined: Mon Dec 12, 2011 4:34 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Thu Nov 08, 2012 2:48 pm

Ok, I've updated the tutorial and submitted it to scep, I can't edit the post directly for some reason.

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Thu Nov 08, 2012 3:46 pm

A forum is not a good place to write a tutorial. It is difficult to fix errors, nobody can improve it, and it will get lost in the mess in a couple of weeks.

You might be better adding it to the RPi wiki.
http://elinux.org/RPi_Guides

hunternet93
Posts: 336
Joined: Mon Dec 12, 2011 4:34 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Thu Nov 08, 2012 7:27 pm

bredman wrote:A forum is not a good place to write a tutorial. It is difficult to fix errors, nobody can improve it, and it will get lost in the mess in a couple of weeks.

You might be better adding it to the RPi wiki.
http://elinux.org/RPi_Guides
Per your suggestion, the tutorial is now on the eLinux wiki at http://elinux.org/RPi_Guides. Any problems/suggestions should still be posted in this thread.

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Fri Nov 09, 2012 4:57 pm

hunternet93 wrote: Per your suggestion, the tutorial is now on the eLinux wiki at http://elinux.org/RPi_Guides. Any problems/suggestions should still be posted in this thread.
Hmmm :(

Still does not work like it should. After a fresh install of the 2012-10-28 distro, running the tutorial gave success although without Internet connection for the phone, but after a reboot my phone can't connect anymore. I tried renewing the distro several times but every time I have the same result. The same goes for the [Distro] Raspberry Server: Web Edition: http://www.raspberrypi.org/phpBB3/viewt ... 36&t=19702, that I plan on using.

Sadly I lost track of what I did before exactly, which led to a working Access Point, and stupidly I have overwritten the SD card. But I now have a card with a fresh install and only the tutorial on it, so if you can give some pointers what to run I'll post the output.

Some remarks about the tutorial on eLinux;
- Where you write "Edit the file /etc/default/udhcpd.conf and change the line:" this should be "Edit the file /etc/default/udhcpd and change the line:"
- Where you write DAEMON_CONF="/etc/hostapd/hostapd.conf you omitted the last double quote.
- I can't execute sudo iptables-save > /etc/iptables.ipv4.nat as I'm not allowed to do that, had to do "sudo bash #' first; not sure everybody knows that. Subsequently the next commands were issued as root, without sudo. Don't know if that makes any difference.

hunternet93
Posts: 336
Joined: Mon Dec 12, 2011 4:34 pm

Re: [Tutorial] Using the Raspberry Pi as a WiFi hostspot

Fri Nov 09, 2012 6:44 pm

poing wrote:
hunternet93 wrote: Per your suggestion, the tutorial is now on the eLinux wiki at http://elinux.org/RPi_Guides. Any problems/suggestions should still be posted in this thread.
Hmmm :(

Still does not work like it should. After a fresh install of the 2012-10-28 distro, running the tutorial gave success although without Internet connection for the phone, but after a reboot my phone can't connect anymore. I tried renewing the distro several times but every time I have the same result. The same goes for the [Distro] Raspberry Server: Web Edition: http://www.raspberrypi.org/phpBB3/viewt ... 36&t=19702, that I plan on using.

Sadly I lost track of what I did before exactly, which led to a working Access Point, and stupidly I have overwritten the SD card. But I now have a card with a fresh install and only the tutorial on it, so if you can give some pointers what to run I'll post the output.

Some remarks about the tutorial on eLinux;
- Where you write "Edit the file /etc/default/udhcpd.conf and change the line:" this should be "Edit the file /etc/default/udhcpd and change the line:"
- Where you write DAEMON_CONF="/etc/hostapd/hostapd.conf you omitted the last double quote.
- I can't execute sudo iptables-save > /etc/iptables.ipv4.nat as I'm not allowed to do that, had to do "sudo bash #' first; not sure everybody knows that. Subsequently the next commands were issued as root, without sudo. Don't know if that makes any difference.
I fixed the errors you mentioned in the tutorial, thanks. Having a second pair of eyes helps a lot.
Sorry it's still not working for you. After you reboot, are hostapd and udhcpd running? Try:

Code: Select all

sudo service hostapd status
ps ax | grep udhcpd
The first command should output "hostapd is running" or something to that effect, the second should have a line like "5555 ? S udhcpd" (not exactly like that, but similar). Also, post the output of:

Code: Select all

sudo ifconfig
sudo iptables --list
Also, I didn't test NAT (the system that redirects traffic from wifi to ethernet and back) on the latest image as I'm traveling and don't have a wired 'net connection, I'll rig something up to test it this evening.

anath3ma
Posts: 16
Joined: Fri Nov 09, 2012 4:38 pm

Re: [Tutorial] Using the RasPi as a WiFi hostspot (8 Nov 12)

Fri Nov 09, 2012 8:27 pm

So, I did pretty much the same thing using the sirlagz.net tutorial and have a working hotspot with few complaints.

My one issue right now is: At least once every 24h from
cat /sys/devices/platform/bcm2708_usb/regvalue
i get 'invalid offset'

I'm using a ralink rt5370 wifi
uname -a = Linux raspberrypi 3.1.9+ #272 PREEMPT Tue Aug 7 22:51:44 BST 2012 armv6l GNU/Linux

So, how stable is USB and this adapter for everyone else? Am i alone with these problems? I really don't want to update/upgrade for fear of regressions, unless someone can verify that this combo works for them.

Tangentially related: What if any dwc_otg stability patches have been introduced since my version? I'd love to review them if i could find em.

Thanks

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: [Tutorial] Using the RasPi as a WiFi hostspot (8 Nov 12)

Fri Nov 09, 2012 8:31 pm

OK, thanks for coming back.

sudo service hostapd status:

Code: Select all

hostapd is running.
sudo ps ax | grep udhcpd:

Code: Select all

 2435 pts/1    S+     0:00 grep --color=auto udhcpd
sudo ifconfig:

Code: Select all

eth0      Link encap:Ethernet  HWaddr b8:27:eb:13:26:2e  
          inet addr:192.168.1.123  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4025 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1762 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2765231 (2.6 MiB)  TX bytes:213768 (208.7 KiB)

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:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

mon.wlan0 Link encap:UNSPEC  HWaddr 00-0F-54-0A-AC-E2-00-00-00-00-00-00-00-00-00-00  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:716 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:62139 (60.6 KiB)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 00:0f:54:0a:ac:e2  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1036 (1.0 KiB)  TX bytes:1090 (1.0 KiB)

sudo iptables --list:

Code: Select all

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

hunternet93
Posts: 336
Joined: Mon Dec 12, 2011 4:34 pm

Re: [Tutorial] Using the RasPi as a WiFi hostspot (8 Nov 12)

Fri Nov 09, 2012 8:51 pm

anath3ma wrote:So, I did pretty much the same thing using the sirlagz.net tutorial and have a working hotspot with few complaints.

My one issue right now is: At least once every 24h from
cat /sys/devices/platform/bcm2708_usb/regvalue
i get 'invalid offset'

I'm using a ralink rt5370 wifi
uname -a = Linux raspberrypi 3.1.9+ #272 PREEMPT Tue Aug 7 22:51:44 BST 2012 armv6l GNU/Linux

So, how stable is USB and this adapter for everyone else? Am i alone with these problems? I really don't want to update/upgrade for fear of regressions, unless someone can verify that this combo works for them.

Tangentially related: What if any dwc_otg stability patches have been introduced since my version? I'd love to review them if i could find em.

Thanks
I haven't seen any similar errors. It might be power related, does your power adapter put out at least 1 amp? Also, updating shouldn't cause any problems. I'm working out a few issues with my tutorial currently, but I'm sure it'll work.

hunternet93
Posts: 336
Joined: Mon Dec 12, 2011 4:34 pm

Re: [Tutorial] Using the RasPi as a WiFi hostspot (8 Nov 12)

Fri Nov 09, 2012 8:59 pm

poing wrote: sudo ps ax | grep udhcpd:

Code: Select all

 2435 pts/1    S+     0:00 grep --color=auto udhcpd
That's your issue right there: udhcpd isn't running. Try running:

Code: Select all

sudo udhcpd -f
and post the output. If it doesn't crash with an error, Ctrl-C it and run:

Code: Select all

sudo update-rc.d udhcpd enable
Then reboot and test. Also, I'll work on NAT tonight and make sure it works, I don't have my Pi right now.

Return to “Networking and servers”