I want to construct a wireless network of Pis for environmental monitoring.
One Pi will have a USB hard drive shared via Samba. It will act as a wireless access point (if that's the correct phrase) so that other Pis can connect and send regular report files.
The access point Pi may also connect to the internet (provide a gateway?) either by a second wireless dongle or wired network. But it needs to receive the files regardless of internet access.
My first attempt, a network bridge, only works when the wired connection is working.
Maybe what I need is an ad-hoc network? There is a tutorial http://hackaday.com/2012/11/14/mesh-net ... pi-boards/ that sounds promising but lots of the steps fail with the current Arch distribution and I cannot get babeld to work at all.
Please can someone advise me the best way to achieve this? Ideally without too many acronyms to confuse me!
Thanks
- Richard-TX
- Posts: 1549
- Joined: Tue May 28, 2013 3:24 pm
- Location: North Texas
Re: Wireless Networking Advice
Please post the contents of your /etc/network/interfaces file(s).
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip
Re: Wireless Networking Advice
I don't have an /etc/network directory!Richard-TX wrote:Please post the contents of your /etc/network/interfaces file(s).
I have been using netctl for wifi setup so I do have /etc/netctl/wireless-wpa-static to connect a Pi to my main router, but this interface is disabled in the mesh tutorial
jb
Re: Wireless Networking Advice
But, for what it's worth, /etc/netctl/wireless-wpa-static contains this:
Code: Select all
Description='Home wifi with static IP'
Interface=wlan0
Connection=wireless
Security=wpa
ESSID=MyRouterSSID
Key=579c790ce.......................................................23b3232ef2
IP=static
Address='192.168.1.23/24'
Gateway='192.168.1.1'
DNS=('192.168.1.1')
# Uncomment this if your ssid is hidden
#Hidden=yes
Re: Wireless Networking Advice
I am pretty naive about wireless and samba stuff, but I am wondering why the other Pi's can't just ssh in to your main Pi that is the host? If they did that, they could have command line access to internet through your main pi, and if you set it up as a vncserver, they could also vnc in as well to access GUI apps includiing main pi's browser that could go on internet. but I would guess that would be too memory intense for a bunch of users to be using a gui browser on one pi. Maybe a whacked out alternative, but this is what I think of. Have you looked at all the alternate netctl profile examples to see if one of those is more appropriate for what you want, with the bridge stuff?
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B
Re: Wireless Networking Advice
Thanks for the suggestion sdjf.
I`m also naive about networking...
My group of PIs have to connect together even if they are out of range of a wireless router, and it is the best way to construct this stand-alone network that I am currently trying to discover.
Once there is a wifi network available, they can indeed send files via SSH (using the scp command I think), I have tried that and got it working on my home network.
jb
I`m also naive about networking...
My group of PIs have to connect together even if they are out of range of a wireless router, and it is the best way to construct this stand-alone network that I am currently trying to discover.
Once there is a wifi network available, they can indeed send files via SSH (using the scp command I think), I have tried that and got it working on my home network.
jb
Re: Wireless Networking Advice
ps There are no users involved, and no GUI, it`s intended to be an unattended monitoring system. Internet connection will eventually provide a web page to see the stats.
Re: Wireless Networking Advice
jbudd, a coincidence and very good timing!
I have just completed the first phase of my next project - nothing like yours but involves a Pi with two wifi devices, one acting as an access point and the other connecting to the internet via my home router. I have this working with Arch and have scripted what needs to be done to a clean install (which also installs configures Samba).
I'll have to clean up the script a bit to remove irrelevancies for you (I take it you won't need a webserver) but will post the result this weekend. You will probably find it useful.
HTH
BBUK
I have just completed the first phase of my next project - nothing like yours but involves a Pi with two wifi devices, one acting as an access point and the other connecting to the internet via my home router. I have this working with Arch and have scripted what needs to be done to a clean install (which also installs configures Samba).
I'll have to clean up the script a bit to remove irrelevancies for you (I take it you won't need a webserver) but will post the result this weekend. You will probably find it useful.
HTH
BBUK
Re: Wireless Networking Advice
That would be outstandingI'll have to clean up the script a bit to remove irrelevancies for you (I take it you won't need a webserver) but will post the result this weekend.

Re: Wireless Networking Advice
Jbudd.
Script as promised.
https://www.mediafire.com/?ffz0n5mvlo1xf11
Bear in mind that I use these scripts more as an aide-memoir than anything else as to the steps needed to implement whatever I am playing with and also to save time typing the same commands over and over. As a result there quite a lot in here that is basic initial configuration that you might not need (expanding filesystem, gpu_mem, setting up wifi and hostnames etc).
It does some of this initial configuration via a first run through the script which will then automatically reboot the Pi. You then run the script again to do the interesting stuff. The second run through the script will need an internet connection (ethernet or wireless).
Inspiration from:
http://learn.adafruit.com/setting-up-a- ... t/overview
https://wiki.archlinux.org/index.php/So ... cess_Point
By way of explanation:
(a) the wlan0 device is connected to your usual router (in the way that wifi would ordinarily work). If you want to connect the Pi to your router via ethernet, I don't see any reason why this can not still be done but change references to wlan0 to eth0 in the iptables rules (in the systemd mesh.service created by the script), change all references to wlan1 to wlan0 and disable the netctl wlan0 service (possibly some other things).
(b) The wlan1 device will act as the access point for anything that wants to connect to it. Hostapd is used to make the wlan1 device behave as an access point. Note that the driver needed for my wifi device needed a patched version of hostapd which works with the RTL8192CU driver (see second link above for some details). Your device may be able to use the vanilla version of hostapd from AUR in which case change the driver=rtl871xdrv to driver=nl80211 (not tried)
(c) a dhcp service is started so that devices connected to the new access point will receive an IP address from the Pi. It looks like your mesh will use static IP addresses and, if so, I see no reason why you can not do away with that service (I have not tried this).
(d) I know the systemd service file is a bit (a lot) of a hack and I know there are better ways of achieving the same effect - in my defence, I am still in the experimental stage of what I'm doing and it is easier for now just to change things in one file.
(e) finally, the variables set at the very start of the script determine some things that you might like to change - wifi SSID and key for both your existing router/AP and the new Pi AP, hostname and location of the shared drive on this Pi that you want others to have access to.
You probably already have this, but if you want to connect to a cifs/samba shared drive/folder on another machine, I use the following recipe in fstab on the machine that needs to access the drive (you must have smbclient installed on the machine that needs access)
so here, the remote directory is on a computer called mediaserver, the remote directory /data/music is shared and is to be mounted locally in the local /music directory (which must exist). The drive is mounted rw, will be remounted if network drops and does not need a password. Change this to suit you.
Note that I have not designed this for very much security.
I hope this helps.
Have fun.
BBUK
Script as promised.
https://www.mediafire.com/?ffz0n5mvlo1xf11
Bear in mind that I use these scripts more as an aide-memoir than anything else as to the steps needed to implement whatever I am playing with and also to save time typing the same commands over and over. As a result there quite a lot in here that is basic initial configuration that you might not need (expanding filesystem, gpu_mem, setting up wifi and hostnames etc).
It does some of this initial configuration via a first run through the script which will then automatically reboot the Pi. You then run the script again to do the interesting stuff. The second run through the script will need an internet connection (ethernet or wireless).
Inspiration from:
http://learn.adafruit.com/setting-up-a- ... t/overview
https://wiki.archlinux.org/index.php/So ... cess_Point
By way of explanation:
(a) the wlan0 device is connected to your usual router (in the way that wifi would ordinarily work). If you want to connect the Pi to your router via ethernet, I don't see any reason why this can not still be done but change references to wlan0 to eth0 in the iptables rules (in the systemd mesh.service created by the script), change all references to wlan1 to wlan0 and disable the netctl wlan0 service (possibly some other things).
(b) The wlan1 device will act as the access point for anything that wants to connect to it. Hostapd is used to make the wlan1 device behave as an access point. Note that the driver needed for my wifi device needed a patched version of hostapd which works with the RTL8192CU driver (see second link above for some details). Your device may be able to use the vanilla version of hostapd from AUR in which case change the driver=rtl871xdrv to driver=nl80211 (not tried)
(c) a dhcp service is started so that devices connected to the new access point will receive an IP address from the Pi. It looks like your mesh will use static IP addresses and, if so, I see no reason why you can not do away with that service (I have not tried this).
(d) I know the systemd service file is a bit (a lot) of a hack and I know there are better ways of achieving the same effect - in my defence, I am still in the experimental stage of what I'm doing and it is easier for now just to change things in one file.
(e) finally, the variables set at the very start of the script determine some things that you might like to change - wifi SSID and key for both your existing router/AP and the new Pi AP, hostname and location of the shared drive on this Pi that you want others to have access to.
You probably already have this, but if you want to connect to a cifs/samba shared drive/folder on another machine, I use the following recipe in fstab on the machine that needs to access the drive (you must have smbclient installed on the machine that needs access)
Code: Select all
//mediaserver/data/music /music cifs auto,rw,x-systemd.automount,password= 0 0
Note that I have not designed this for very much security.
I hope this helps.
Have fun.
BBUK
Re: Wireless Networking Advice
Thanks BBUK, that's very helpful.
I have run the script more or less as supplied and everything completes fine. (Nice idea to use a shell script to automate and document the setup stages, much easier than my word processor and typing them in again approach!)
During development at least I am trying not to use a USB hub, so my setup consists of:
A USB flash drive as shared storage. (To be upgraded to a hard disk)
A choice of two wifi dongles: Edimax EW-7811UN and Dynamode RA5370 (= Ralink 5370).
One or both of these works with the standard hostapd package and nl80211 driver
A wired network connection to my router. (Possibly to be replaced by 2nd wifi or other mechanism)
So I am adjusting the script to suit and will report back on progress...
jb
I have run the script more or less as supplied and everything completes fine. (Nice idea to use a shell script to automate and document the setup stages, much easier than my word processor and typing them in again approach!)
During development at least I am trying not to use a USB hub, so my setup consists of:
A USB flash drive as shared storage. (To be upgraded to a hard disk)
A choice of two wifi dongles: Edimax EW-7811UN and Dynamode RA5370 (= Ralink 5370).
One or both of these works with the standard hostapd package and nl80211 driver
A wired network connection to my router. (Possibly to be replaced by 2nd wifi or other mechanism)
So I am adjusting the script to suit and will report back on progress...
jb
Re: Wireless Networking Advice
Update: The Edimax does not work for this application with standard hostapd, the Dynamode does.
- DougieLawson
- Posts: 42313
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: Wireless Networking Advice
hostapd works just fine with an Edimax if you follow these special instructions:
http://www.daveconroy.com/turn-your-ras ... s-chipset/
http://www.daveconroy.com/turn-your-ras ... s-chipset/
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.