Introduction

The Wi-Fi Broadcast System is a Wi-Fi 802.11 hotspot with a difference. Connected users find that no matter where they surf all they get is the internal site. It’s fully self-contained and battery powered with no connection to the Internet involved. It basically makes a Wi-Fi radio station, ideal for providing information in areas with lots of Wi-Fi users.

It works by pretending to be a regular hotspot but when users connect their browsers are sent to an internal web server because the DNS server is configured to lie. No matter that site they try to lookup the name of, it always returns the laptop’s address. Memeteam.net, Google.com or anything else becomes 10.0.0.1, the home of our web server. Then the laptops web server is setup to redirect any request to its own content.

We also made a Cantenna to increase directional range.

This page is meant to give a general outline of the process, not a step by step guide. This isn’t the most dangerous territory but breaking the laptops network drivers, web server, etc wouldn’t be too hard. A fair bit of familiarity with Linux is a good thing if you want to do this.

Requirements

Parts and Software

Parts

  • Notebook - Desktop will work just as well
  • Wi-Fi adapter that supports master mode

Software

  • Ubuntu Linux, tested on

    • 7.04 Feisty Fawn Dell Remaster
    • 7.10 Server edition
  • Apache2 - Web server
  • Pure-FTPd - FTP server
  • DNSMasq - Provide DHCP and redirected DNS to users

Optional Parts for Cantenna

  • 48oz Gravy can
  • Cupboard handle
  • 3/4" rubbery grommet
  • Dremel tool with cutting discs

Setting up the Wifi Adapter

The key to building a Wi-Fi hotspot is the right Wi-Fi adapter, which is responsible for transmitting and receiving signals from users. For everything to be slick, the adapter and its drivers need to support something called ‘Master Mode’.

Setup your adapter for the hotspot

To make the setup easier log in as root

sudo passwd root

Run the following in a terminal (assuming your adapter its on ath0).

sudo iwconfig ath0 essid "my network" mode Master enc off

Replace "my network" with whatever you want your hotspot to be called. "Free Internet!" "Protest Information" etc.

Now setup the network details for your hotspot.

sudo ip addr add 10.0.0.1/24 brd + dev ath0;
sudo ip link set ath0 up

The above commands will need to be issued again after a reboot. To automatically load the setting for your adaptor the /etc/network/interfaces file needs editing

sudo nano /etc/network/interfaces

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

# The loopback network interface
auto lo
iface lo inet loopback

#Internet when connected 
auto eth0
iface eth0 inet dhcp

#Wireless Setup
auto ath0
iface ath0 inet static
     address 10.0.0.1
     network 10.0.0.0
     netmask 255.255.255.0
     broadcast 10.0.0.255
     wireless-mode master
     wireless-essid my network
     enc off

Setup DNSMasq

DNSMasq is a package that provides DHCP and DNS services. You need to provide DHCP to show up when users scan for open Wi-Fi connections, and DNS is used to redirect all web traffic to your systems internal server. Install DNSMasq using your favorite package manager or apt-get

sudo apt-get install dnsmasq

Note: "DNS Server" must not be installed otherwise you will get an error message when installing DNSMasq

Now setup DNSMasq to provide DHCP. Edit /etc/dnsmasq.conf

sudo nano -w /etc/dnsmasq.conf

Change

#interface= 

to

interface=ath0

Now DNSMasq will only deal with the adapter being used for the hotspot. Change

#dhcp-range= 

to

dhcp-range=10.0.0.10,10.0.0.110,6h

These are the IP addresses your hotspot will assign to users. Change

#address=/doubleclick.net/127.0.0.1 

to

address=/#/10.0.0.1

This redirects all web traffic to the hotspot’s own web server. Restart DNSMasq.

sudo /etc/init.d/dnsmasq restart

Scan for available Wi-Fi connections from another computer. Your hotspot should show up with the name you configured with iwconfig. Connect to your hotspot and try using the web. It should connect but the web should seriously not work because DNSMasq is redirecting all the traffic back to the hotspot and there isn’t a web server there yet.

Setup Apache2

Apache2 is a web server. It will send the web pages to anyone trying to surf from your hotspot. This only covers a very basic setup, to do more you’ll likely want to install MySQL and PHP too. But for now just install Apache2.

sudo apt-get install apache2

Stick a quick index.html file on the server for testing.

sudo echo Test > /var/www/index.html

Now we setup a custom 404 page so that Apache2 will serve you content no matter what URLs users try to go to. Edit /etc/apache2/apache2.conf

sudo nano -w /etc/apache2/apache2.conf

Change

#ErrorDocument 404 /missing.html 

to

ErrorDocument 404 /index.html

Now when anyone goes to a page that isn’t there, which will happen all the time because of the DNSMasq redirect, they’ll get index.html. Restart apache2.

sudo /etc/init.d/apache2 restart

Try surfing some more from the other computer. No matter what URL you try and go to, you should see "Test" or whatever is in the hotspot’s index.html file. Basically done, but the next step makes life easier.

Setup Pure-FTPd

Pure-FTPd is an FTP server, it will let you connect to the hotspot from another computer and upload web content. Install Pure-ftpd

sudo apt-get install pure-ftpd

Tell Pure-ftpd not to try and resolve clients. Otherwise it gets confused.

sudo echo "yes" > /etc/pure-ftpd/conf/DontResolve

Now we need to set things up so Pure-FTPd can access the servers web content easily.

Change the ownership of your web servers content directory to your regular user.

Note: change user:user to your ubuntu login name

sudo chown -R user:user /var/www; sudo chmod oug+r /var/www

Setup a symbolic link between the content directory and your user directory.

ln -s /var/www ~/www

Now try and connect to 10.0.0.1 via FTP from the other computer. User and password should be the same as your regular Ubuntu login. Everything in the ‘www’ directory is your web content.

Making Content

You must use full paths. The hotspot’s server should be able to host anything any other server would, but because of the sneakiness going on with DNSMasq, any links to images, other sites, etc in your HTML must contain the full URL, which will start with

http://10.0.0.1

if your followed the setup shown here.

<img src="images/someimage.jpg"> 

has to become

<img src="http://10.0.0.1/images/someimage.jpg">

to work.

Adding a Cantenna - Gravy

The Airlink101 AWLL-3026 looks perfect for sticking a cantenna waveguide onto. This is just a specially sized tin can that reflects Wi-Fi radio waves in useful ways. It should increase range and power in whatever direction the can is pointing. We used a 48oz can of gravy that has about a 4"/102mm inside diameter and is about 6.9"/175mm deep. Checking a cantenna calculator, this turns to be an almost perfect size. We need to cut a hole 1.72"/45mm from the back of the can and stick the USB adapter about 31mm in. Measure 45mm from the base and cut a square hole in the can using a dremel tool with a cutting disc. Now stick in a 3/4" rubber grommet from home depot, mark 31mm from the top of the AWLL-3026 and work it into the grommet. Drill a couple of holes for the cupboard handle. We had to shorten the included screws using the cutting disc.

Voila, cantenna. Luckily, things don’t need to be perfect to get decent results.

Author

meme team contact@memeteam.net

WifiDocs/WirelessBroadcastSystem (last edited 2011-05-16 15:52:19 by jengelh)