Table of Contents

PirateBox combined with normal AP

In some situation it might be better to have dedicated devices doing the tasks to be done. One example is the usage of a RaspberryPI b-model, which don't have a wifi-card included and some are complicated to get run. The scripts are designed to be as flexible as possible, so you can easily get of using a wifi card simply stick to ethernet, if you need it.

The following HowTo describes a setup, where you combine a normal AccessPoint -may be a spare one- with the PirateBox scripts. The configuration describes the setup for the network-range 192.168.1.x At least, the AccessPoint(AP) should have the option to run in “DHCP-client mode”, a better solution would be, that the AP can disable it's own DHCP server -if existing.

Technically preface

The PirateBox in the original configuration does the following functionalities:

The first three tasks are ususally done by a home router or an access point, depending of its configuration. Because dnsmasq is doing the dns resolution and the IP serving, this is the most important part and may not divided.

AccessPoint configuration

AccessPoints do:

What we need is only being an AP and bridge the wifi network down into wired LAN. So your task- which I can't describe, because it is different on every device- Set you AP to the IP 192.168.1.2 and disable it's DHCP server. If you can't disable it, try to set it into client mode 2)

Connect your AP now via wired to your PirateBox device - ie. the RaspberryPi

PirateBox configuration

All the configuration you need to do is located in /opt/piratebox/conf/piratebox.conf.

Change the following lines

 #Do network config 
 DO_IFCONFIG="yes"
 
 ...
 
 #Start services...
 #   act like a apn  / <yes|no>
 #    please have a look @ hostapd.conf ; you may need to change some options, regarding wifi-card 
 USE_APN="yes"
 #   act like dns&dhcp (dnsmasq) 
 USE_DNSMASQ="yes"
 
 ...
 
 #----------------- Configuration for DNSMASQ & IF-Setup  -------------------#
 # Name of the wlan interface
 INTERFACE="wlan0"
 # On which interface DNSMASQ should listen. -i is the parameter for dnsmasq
 # Make it empty to disable
 DNSMASQ_INTERFACE="wlan0"
 
 #Brdige add interfacce (setr yes to enable bridging)
 DO_BRIDGE="no" 
 BRIDGE="br-lan"
 
 #Network
 NET=192.168.77
 
 #IP-SHORT (is stringed together)
 #  Which IP is your Box??  i.e. 1 => 192.168.77.1
 IP_SHORT=1

Turn it into

 #Do network config 
 DO_IFCONFIG="yes"
 
 ...
 
 #Start services...
 #   act like a apn  / <yes|no>
 #    please have a look @ hostapd.conf ; you may need to change some options, regarding wifi-card 
 USE_APN="no"
 #   act like dns&dhcp (dnsmasq) 
 USE_DNSMASQ="yes"
 
 ...
 
 #----------------- Configuration for DNSMASQ & IF-Setup  -------------------#
 # Name of the wlan interface
 INTERFACE="eth0"
 # On which interface DNSMASQ should listen. -i is the parameter for dnsmasq
 # Make it empty to disable
 DNSMASQ_INTERFACE="eth0"
 
 #Brdige add interfacce (setr yes to enable bridging)
 DO_BRIDGE="no" 
 BRIDGE="br-lan"
 
 #Network
 NET=192.168.1
 
 #IP-SHORT (is stringed together)
 #  Which IP is your Box??  i.e. 1 => 192.168.77.1
 IP_SHORT=1

Keep in mind, that your *nix3) system my have an extra network manager, which might interfere with your. We come to this later.

After you did the changes, start your piratebox as normal. During startup the IP of the ethernet-port gets changed to 192.168.1.1 . After the box is online, it starts to serve dhcp-requests vie ethernet port, and serve across the AP these DHCP requests.

Detailed description of the set options

DO_IFCONFIG

Set an IP address to the device we bring up during the startup

USE_APN

Run AP against that Interface

USE_DNSMASQ

Start DHCP+DNS service

INTERFACE

On which interface should the scripts set the IP. That Interface is the IP of the wifi card

DNSMASQ_INTERFACE

On which interface should DNSMASQ work on. If you are on a bridged device like on OpenWRT, you should choose br-lan.

NET

Which is the IP-Range PirateBox is operating.

IP_SHORT

Which single IP address (last digit) it the one of PirateBox?

Troubleshooting

Oh, I can't disable the DHCP stuff on my AP/Router

No problem. First of all, PirateBox4) detects other running DHCP tries not to interfere, but it still serves nameresolution, which we need for catching all requests. Set in your AP at DHCP configuration (maybe you need to set it in the LAN configuration) the DNS-Server 192.168.1.1 then all DNS requests should be directed to your box.

The Piratebox looses it's IP after a while

Then your network manager interferes with the PirateBox' IP configuration, see NetworkManager.

The PirateBox seems not to be reachable right after PirateBox comes up

Maybe it is the NetworkMannager, on this point you have to get an idea how you can't reach it. Try to answer you the following questions:

  1. How am I connected?
    1. Wired wise?
    2. Wireless?
  2. Which IP address receives my client device? Is it in the same range then the PirateBox?
  3. Get I access to the AP?
  4. Does the name resolution work? (ping piratebox.lan , ping 192.168.1.1 )
  5. What details do my Interface have? Is it all pointing to 192.168.1.1 and having a 192.168.1.x address?

With those question come down to PirateBox Forums

NetworkManager

You can try to disable the network-manager via the init.d process, or you can change the configuration of that manager for itself like here. But you can configure the networkmanager to setup a static IP address(Debian)

1)
Serve IP-Addresses
2)
And even this won't work, set in the DHCP settings, that the DNS address is 192.168.1.1
3)
short for Linux
4)
0.6