1

I have tried three different tutorials to attempt to set up my RPi as an wifi access point.

  1. Adafruit
  2. elinux
  3. (Page one of) sirlagz

In all cases, I cannot connect properly to the RPi. I can see the wifi network from other devices, but my Android phone gets stuck on "Obtaining IP address…".

I know that my Ralink RT5370 should work. I have also attempted to follow the suggestions here and manually start udhcpd or dnsmasq after the RPi obtains its wlan0 IP address. This did not help.

This is the output for (page one of) the third tutorial. In all cases, I can see inet addr for wlan0 (but nothing for mon.wlan0).

$ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:43:fe:10  
          inet addr:192.168.1.91  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4373 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3167 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:320392 (312.8 KiB)  TX bytes:484473 (473.1 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:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:260 (260.0 B)  TX bytes:260 (260.0 B)

mon.wlan0 Link encap:UNSPEC  HWaddr 7C-DD-90-41-31-35-00-00-00-00-00-00-00-00-00-00  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 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:393 (393.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 7c:dd:90:41:31:35  
          inet addr:10.0.0.1  Bcast:10.0.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:60 errors:0 dropped:0 overruns:0 frame:0
          TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:15182 (14.8 KiB)  TX bytes:10725 (10.4 KiB)

Contents of /etc/iptables.ipv4.nat

# Generated by iptables-save v1.4.14 on Sat Sep 28 10:59:25 2013
*nat
:PREROUTING ACCEPT [2:338]
:INPUT ACCEPT [2:338]
:OUTPUT ACCEPT [1:260]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Sat Sep 28 10:59:25 2013
# Generated by iptables-save v1.4.14 on Sat Sep 28 10:59:25 2013
*filter
:INPUT ACCEPT [151:8950]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [145:15700]
:fail2ban-ssh - [0:0]
-A INPUT -p tcp -m multiport --dports 22 -j fail2ban-ssh
-A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i wlan0 -o eth0 -j ACCEPT
-A fail2ban-ssh -j RETURN
COMMIT
# Completed on Sat Sep 28 10:59:25 2013
  • Opening up ports 67 and 68 didn't help. I tried sudo ufw allow 67:68/udp and then sudo ufw allow 67:68/tcp. Only sudo ufw disable allowed internet connectivity from the wifi clients. I've edited the question to provide iptables configuration. – Sparhawk Oct 6 '13 at 12:28
  • Perhaps add some logging to iptables to see where the packets are going ? You don't have any DROP or REJECT rules that would affect dhcp requests from what I can see. Also make sure your dhcp server is listening on the right interface as well – Lawrence Oct 7 '13 at 2:11
  • @Lawrence I realised that my final attempt only half followed the third tutorial. I had previously had problems with the first (wifi drivers) and the third was imprecisely written, so I started from scratch again with the second. After this tutorial, sudo ufw allow 67:68/udp allows the Pi to work as a AP. Thanks for your help. (I'm going give "solved" to N10 for suggesting the firewall (and ports) first, but I'll +1 you for your help.) – Sparhawk Oct 7 '13 at 13:24
  • 1
    No problems. I should have thought about the firewall anyway :D – Lawrence Oct 7 '13 at 14:14
3

I had similar problems when I was running this setup (but from Kali, not Raspbian).

Ensure your DHCP service is actually running. Mine would error out to the logs.

Also make sure your firewall (if running) is allowing DHCP through.

Your DHCP config file would be helpful for further information.

  • 1
    Oh that's funny… Your strike-out text helped! Disabling ufw fixed it. Do you know what I should enable so I can leave ufw on? – Sparhawk Oct 5 '13 at 23:01
  • Using IPTables you can follow the directions on the following page here. Ultimately you need to allow ports 67 and 68. – N10 Oct 5 '13 at 23:13
  • I'm going to reply in the comments to my question, since there are two of you suggesting similar things now. – Sparhawk Oct 6 '13 at 12:29
  • 1
    sudo ufw allow 67:68/udp fixes it, assuming I've followed the second tutorial. – Sparhawk Oct 7 '13 at 13:25
1

No IP Address for mon.wlan0 is normal.
What DHCP server are you using ?
Can you paste the config for the DHCP server ?
Assuming you're using Raspbian - What's the contents of /etc/network/interfaces ?
Have you disabled ifplugd ? ifplugd causes issues with hostapd.

  • I tried both udhcpd and dnsmasq. I essentially followed the guides to the letter. However, I've just realised that (as per the other answer) if I disable ufw it fixes the problem. – Sparhawk Oct 5 '13 at 23:02
  • Sounds like your firewall is blocking DHCP requests then. UDP 67 and 68 need to be allowed in/out. – Lawrence Oct 6 '13 at 10:58
  • I'm going to reply in the comments to my question, since there are two of you suggesting similar things now. – Sparhawk Oct 6 '13 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.