ODROID WiFi Access Point: Share Files Via Samba

Wi-Fi Access point featured image

This article will show you how to setup an ODROID with a WiFi access point so that an ODROID’s hard drive can be accessed and modified from another computer. This is primarily aimed at allowing access to images, videos, and log files on the ODROID. The procedure makes use of hostapd, Samba, and DHCP.

To accomplish this, you will need:

All the instructions below can be implemented by connecting a keyboard, mouse, and screen to the ODROID or using ssh (via PuTTY).

Software

Become super user:

$ sudo -s
Install hostapd, samba, and all the other required packages:
$ apt-get install hostapd samba samba-common python-glade2 system-config-samba isc-dhcp-server
After first ensuring the WiFi dongle is plugged into the ODROID, find the name of your WiFi dongle by typing “ifconfig”. Normally this will be “wlan0” or “wlan2”.

Wifi Access Point - Figure 1 - Running the ifconfig command

Check that the WiFi dongle supports “AP” mode:

$ iw list
A large list of information will be displayed. You are looking for a section called “Supported interface modes:” followed by “* AP”. If you cannot find this, these instructions will not work and you should try another dongle.
Supported interface modes:
* IBSS
* Managed
* AP
Use your favorite editor, such as nano or vi, to edit the /etc/network/interfaces file and add an entry for your WiFi dongle. Note that you should replace “wlan2” if your dongle has a different name:
$ auto wlan2
$ iface wlan2 inet static
$ address 192.168.100.1
$ netmask 255.255.255.0
Edit the /etc/hostapd/hostapd.conf file and ensure it looks like below
$ vi /etc/hostapd/hostapd.conf

interface=wlan2 <-- change "wlan2" to name of WiFi dongle found above
driver=nl80211
ssid=MyDrone
hw_mode=g
channel=11
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=MyDrone12 <-- password for clients to access the WiFi access point
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
Try starting the hostapd application:
$ hostapd /etc/hostapd/hostapd.conf
If this fails, try replacing the /usr/sbin/hostapd and hostapd_cli files with the version found in the downloads area.

You will also need to install the libnl-dev package:

$ apt-get install libnl-dev
To make the hostapd service run whenever the ODROID is started, edit the /etc/init.d/hostapd file and ensure that the line below appears:
$ DAEMON_CONF=/etc/hostapd/hostapd.conf

Setting up Samba

Create the directories that you wish to share:

$ mkdir -p /mydrone
$ mkdir -p /mydrone/images
Edit the samba config file. If it is not present, create a new file:
$ vi /etc/samba/smb.conf

[global]
workgroup = MyDroneGroup
server string = Drone Server
netbios name = mydrone
security = user
map to guest = bad user
dns proxy = no
#===== Share Definitions =====
[images]
path = /mydrone/images
browsable = yes
writable = yes
guest ok = yes
read only = no
This configuration will create an “images” share with no restriction on clients adding or deleting files.

Setting up DHCP

Edit the /etc/dhcp/dhcpd.conf file and ensure it has all of the lines listed below:

$ vi /etc/dhcp/dhcpd.conf

# option definitions common to all supported networks...
option domain-name "mydrone.local";
option domain-name-servers dns.mydrone.local
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 192.168.100.0 netmask 255.255.255.0 {
  range 192.168.100.100 192.168.100.200;  <-- clients will get IP addresses in this range
}
Add all possible client IP addresses to the /etc/hosts file:
$ vi /etc/hosts

127.0.0.1 localhost
192.168.100.1 odroid-pc odroid
192.168.100.100 client100
192.168.100.101 client101
192.168.100.102 client102
....
192.168.100.200 client200
Adding all the client IP address can be accomplished more quickly with the following command:
$ (for i in $(seq 100 200); do echo 192.168.100.$i client$i; done) >> /etc/hosts
Restart the ODROID, and with any luck, an access point will be created, and you will be able to connect as shown in the next section.

Connecting from a Windows PC

To connect from a Windows 8.1 machine, click on the network icon near the clock, and then click on “MyDrone” and “Connect”. After 30 seconds or so it should display a message that reads “The connection is limited” because the ODROID likely does not have access to the Internet. This is okay.

Figure 2 - Connecting to the MyDrone network

Open a File Explorer and type \\mydrone into the address bar and the contents of the ODROID images directory should appear.

Figure 3 - Browsing the contents of the ODROID images directory

For comments, questions and suggestions, please visit the original article at http://ardupilot.org/dev/docs/odroid-wifi-access-point-for-sharing-files-via-samba.html.

Be the first to comment

Leave a Reply