Wifi acces point on Beaglebone with DHCP

With the OS of Debian new opportunities have come. The Angstrom distribution did not meet our requirements because conman and ROS was not supported well yet, while Ubuntu didn’t have PWM, so that’s how Debian came into picture. The idea of connecting to the BeagleBone directly is better then connecting through some middle layer (like a router). To be this simple we need to config an acces point on the BeagleBone.
Step Zero: ifconfig
You need to config the network interfaces. Here you can see my case:

root@beaglebone:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback

# The primary network interface
auto eth1
iface eth1 inet dhcp

# WiFi
auto wlan1
iface wlan1 inet static
#       hostapd /etc/hostapd/hostapd.conf

To restart the network use command:

/etc/init.d/networking restart

Step One: Hostapd
I used this package for setting the wifi accespoint. Install the package:

apt-get install hostapd

Next you have to edit the /etc/default/hostapd .

vi /etc/default/hostapd

set the


Save and close. Create the file:

touch /etc/hostapd/hostapd.conf

Then edit the file like that:

vi /etc/hostapd/hostapd.conf

Add these lines:

### Wireless network name ###
### Set your bridge name ###






# # Static WPA2 key configuration
# #1=wpa1, 2=wpa2, 3=both


## Key management algorithms ##
## Set cipher suites (encryption algorithms) ##
## TKIP = Temporal Key Integrity Protocol
## CCMP = AES in Counter mode with CBC-MAC
## Shared Key Authentication ##
## Accept all MAC address ###
#enables/disables broadcasting the ssid
# Needed for Windows clients

To debug that you have wrote everything good use:

hostapd /etc/hostapd/hostapd.conf

Note: if you receive some errors like this, delete those empty lines

Configuration file: /etc/hostapd/hostapd.conf
Line 3: invalid line ' '
Line 24: invalid line ' '
Line 30: invalid line ' '
Line 34: invalid line ' '
4 errors found in configuration file '/etc/hostapd/hostapd.conf'

Now you have to restart it to get it work.

/etc/init.d/hostapd restart

At this point you may see the Beaglebone along the connectable wifi network. You can connect to it, but you have to set your IP to be in the same network. Or you can use DHCP that will be explained below.


Step Two: DHCP server
This is optional, you can connect to the Beaglebone, but you won’t get an Ip. Either you config staticly your ip to be in same network as your Beaglebone or you can use dhcp. Install it by:

apt-get update
apt-get install isc-dhcp-server

Edit the config file:

vi /etc/dhcp/dhcpd.conf

I only added this to it:

subnet netmask {

And didn’t touch the other parts of the file. You can see many hints inside the dhcpd.conf how to config it better. Then restart:

/etc/init.d/isc-dhcp-server restart

If everything went good, now you can connect to the Beaglebone via wifi. The beaglebone’s IP will be .



Step Two alternative: Dnsmasq

As STrRedWolf mentioned in his comment, you can use an alternative dhcp and dns server for small networks the Dnsmasq.

apt-get update
apt-get install dnsmasq

Edit the config file:

vi /etc/dnsmasq.conf

I added that two lines:


Restart the dnsmasq

/etc/init.d/dnsmasq restart

In that way the beaglebone’s IP will be .
For debugging you can see that the service is running:

service --status-all

[ + ]  dnsmasq



12 thoughts on “Wifi acces point on Beaglebone with DHCP

  1. Why not use dnsmasq instead of the full DHCP server? Not only do you get an easier DHCP server to configure, you also get a DNS server as well.

    1. dnsmask will not give you a DHCP server if you are not connected to the network. There are applications for the Beaglebone Black as a router that include controlling remote devices through a tablet while not necessarily connected to the Internet. A standalone DHCP server is not that heavy and will always work.

  2. Hi,
    I have been trying to do just that with the Angstrom distro with no success. I have not gotten a single Wifi dongle to work with it (tried 3).
    Could you share the Debian version you used (and where I could get it from) and the type of WiFi dongle you used?
    Also, did you have to install any drivers for the Wifi dongle that did not come with the distro?
    Thanks in advance!

  3. Hi there,

    I would like to set up my beaglebone black, so that it starts up as an access point. I would then use my phone, to connect to the access point. I would have a simple web page that allows the user to configure the beaglebone black to connect to home router. After a reboot the BBB is connected the home network.

    I guess what I am looking for is two discrete configurations. My current configuration allows me to connect to my home router.

    1. Hi Andrew,

      Yes, they are two separate configuration. As far as I know, you can only use one WIFI port for one purpose at the time, it is either AP or you set that it connects to another AP. What I explained in this post is how to connect to BBB and use it as an AP. For the other configuration(to make the BBB connect to the router) you could check this if you haven’t already:

      Your project sounds fun, when you are finished with it please send me a link to it! 🙂

  4. Both isc-dhcp-server and dnsmasq failed to start for me. (dnsmasq worked the first time but didn’t work later). Turns out udhcpd was already bound to port 67 so that it can hand out addresses on interface usb0.

    Furthermore, udhcpd has a bug where it ignores the interface option and binds to all addresses. So I don’t think it’s actually possible to have udhcpd serve for both USB and WLAN.

    But if I change the /opt/scripts/boot/autoconfigure_usb0.sh to make the /etc/udhcpd.conf file like this, it works on the wifi side:

    # Managed by /opt/scripts/boot/autoconfigure_usb0.sh – Do not modify unless you know what you are doing!
    interface wlan2
    max_leases 9
    option subnet

    I think a better answer is to remove udhcpd and use one of the other two dhcp servers for both usb and wifi interfaces.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s