I'm trying to setup an AP got stuck. I'm using an Odroid U3 and the WiFi adapter is the Module 3 from Hardkernel. I'm also using a Debian Jessie.

Not, I've got it to almost work: the Odroid has access to the internet and other devices (my phone and my tablet) can see the network, however when I try to connect to the network, I get the message: Unable to join the network "myNetwork".

My hosts file is as follow:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

auto lo br0
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual

# Bridge setup

# for dhcp address
#iface br0 inet dhcp
# bridge_ports eth0 wlan0

# for static ip
iface br0 inet static
bridge_ports eth0 wlan0
# adapt with your network settings
address 192.168.1.250
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.1.1
fns-search localdomain

my hostapd.conf file is:

    interface=wlan0
driver=nl80211
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
ssid=RaspAP
hw_mode=g
wpa=2
channel=8
wpa_passphrase=raspiwlan
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
rsn_pairwise=CCMP
beacon_int=100
auth_algs=3
wmm_enabled=1

and the result of ifconfig is:

    br0       Link encap:Ethernet  HWaddr 1e:fb:50:05:6b:da
          inet addr:192.168.1.250  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::1cfb:50ff:fe05:6bda/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:803 errors:0 dropped:0 overruns:0 frame:0
          TX packets:466 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:90238 (88.1 KiB)  TX bytes:48926 (47.7 KiB)

eth0      Link encap:Ethernet  HWaddr 1e:fb:50:05:6b:da
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1838 errors:0 dropped:0 overruns:0 frame:0
          TX packets:466 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:557975 (544.8 KiB)  TX bytes:54146 (52.8 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:390 errors:0 dropped:0 overruns:0 frame:0
          TX packets:390 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:25662 (25.0 KiB)  TX bytes:25662 (25.0 KiB)

mon.wlan0 Link encap:UNSPEC  HWaddr 00-A8-2B-00-05-4D-00-00-00-00-00-00-00-00-00-00
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:21913 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:6729206 (6.4 MiB)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 00:a8:2b:00:05:4d
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:17 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2828 (2.7 KiB)  TX bytes:2490 (2.4 KiB)

After some research, I've found an answer on SO (unfortunately lost the link) where suggests that the problem might be related to dynamic ip addresses for the devices connecting to the Odroid, but I'm not sure that's case. Any suggestions?

Many thanks


Solution 1:

Here are scripts for creating WiFi AP:

  • SetupWiFi.sh - Sets up WiFi network and shares eth0 with wlan0. Change "ssid" and "wpa_passphrase" for setting WiFi SSID (AP name) and password.
  • StartWifi.sh - Starts WiFi. (SetupWiFi.sh already starts it so you can skip it first time.)
  • StopWiFi.sh - Stops it.

SetupWiFi.sh:

#!/bin/bash
apt-get install -y hostapd dnsmasq wireless-tools iw wvdial

sed -i 's#^DAEMON_CONF=.*#DAEMON_CONF=/etc/hostapd/hostapd.conf#' /etc/init.d/hostapd

cat <<EOF > /etc/dnsmasq.conf
log-facility=/var/log/dnsmasq.log
#address=/#/10.0.0.1
#address=/google.com/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
dhcp-option=3,10.0.0.1
dhcp-option=6,10.0.0.1
#no-resolv
log-queries
EOF

service dnsmasq start

ifconfig wlan0 up
ifconfig wlan0 10.0.0.1/24

iptables -t nat -F
iptables -F
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
echo '1' > /proc/sys/net/ipv4/ip_forward

cat <<EOF > /etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211
channel=1

ssid=WiFiAP
wpa=2
wpa_passphrase=YOUR_PASSWORD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
# Change the broadcasted/multicasted keys after this many seconds.
wpa_group_rekey=600
# Change the master key after this many seconds. Master key is used as a basis
wpa_gmk_rekey=86400

EOF

service hostapd start

StartWiFi.sh:

#!/bin/bash
service hostapd start
service dnsmasq start

StopWiFi.sh:

#!/bin/bash
service hostapd stop
service dnsmasq stop

Notes:

  • Tested on Debian 7, but should work on newer version.
  • Make sure you are running superuser. (For newbies) make these files executable by using chmod +x 'SetupWiFi.sh'

Hope it helps.