doc/install/debian

Client installation on a Debian based PC

  • Install two network interface cards into your PC. One will be connected to your internal network or internet connection, and the other will be connected to a wireless router.
  • Install Debian minimal install.
  • log in as root
  • Run apt-get update and apt-get upgrade to ensure that your installation is up to date.
  • Ensure that the /etc/network/interfaces file is configured correctly and that both network interfaces are configured - for example:
iface eth0 inet static
             address 192.168.0.111
             netmask 255.255.255.0
             gateway 192.168.0.1
             dns-nameservers 195.238.2.21 195.238.2.22

iface eth1 inet dhcp

You should visit  http://www.linuxforum.com/debian/ch-gateway.en.html for a comprehensive network configuration tutorial.

  • You now need to bridge eth0 and eth1 so that your wireless clients can connect to the internet through your internet connection.

To accomplish this you will need to ensure that you have a proxy script in place using iptables (much like internet connection sharing if you come from a Windows background).

If you are using Debian then you're in luck. You will find a full tutorial for setting up IPTABLES for NAT Linux Proxy Server at  http://www.aboutdebian.com/proxy.htm. Just follow the rules there, test to ensure that you can connect to the internet via your wireless interface with the rules in place, and then and only then try your wifidog client installation. Don't forget to read the tutorial all the way through, and MAKE SURE THAT YOU CAN GET AN INTERNET CONNECTION THROUGH THE WIRELESS INTERFACE NOW!

Security Update!! By using the proxy script from Debian you are leaving your wifidog router PC open to SSH access by your wireless clients which probably isn't a good idea! If you want to prevent this, add this firewall rule to the proxy script:

# Chris's rule to stop port 22 traffic
iptables -A INPUT -p tcp -i $INTIF --dport 22 -j DROP
  • Navigate to /usr/src/ and grab a copy of wifidog wget URL-HERE You then need to decompress it gunzip WIFIDOG-FILE then untar tar -xvf yourcopyofwifidog.
  • Go to the place wifidog decompressed to and run:
./configure
make
make install

If you receive the following error

wifidog: error while loading shared libraries: libhttpd.so.0: 
cannot open shared object file: No such file or directory

please run the command:

ldconfig

If you get any other errors, please check to ensure that you are running the latest compiler.

  • Move wifidog.conf to /etc/ : mv wifidog.conf /etc/ and edit the options there (the file is commented so you know what to change.
  • Type wifidog -f -d 7 to run wifidog in the foreground with full debugging. If everything is working OK you should see lots of output and be able to get to your portal screen.

DHCP

If you want to have a little more power over your DHCP settings, you may want to consider running DHCP from your wifidog gateway box rather than your wireless access point. You can do this on Debian by installing DHCPD.

First of all to get DHCP server you need to run apt-get install dhcpd

When you have the DHCP server you need to set it up. First of all run the following command:

/etc/init.d/dhcp stop

This will stop the DHCP server so that you can change the configuration scripts. You will need to set the interface card that you wish the DHCP server to operate the service on, and give it a range of IP addresses and networking information to give to client PC's.

To change the interface you want the DHCP service to run on you need to edit /etc/init.d/dhcp and input your network interface here (the standard value may be OK):

# Defaults
INTERFACES="eth0"

Note that it may also be necessary to edit the /etc/default/dhcp file to ensure that it has the same value for INTERFACES as in /etc/init.d/dhcp.

To change the network information issued via your DHCP server you need to edit the /etc/dhcpd.conf file. I've included the one I use as an example for you. Read on for an explanation of the different components:

default-lease-time 10800;
max-lease-time 28800;

subnet 10.0.1.0 netmask 255.255.255.0 {
range 10.0.1.2 10.0.1.254;
option routers 10.0.1.1;
option domain-name-servers 150.237.47.200;
} 
  • default-lease-time = the default time that your client is issued an IP address for.
  • max-lease-time = the maximum time that your client is issued an IP address for.
  • subnet 10.0.1.0 = the subnet of the IP range you are issuing the client, in this case 10.0.1.0 is the subnet of 10.0.1.2/254 (take the last number off your range and change to 0)
  • netmask = the mask applied to your subnet range giving the available number of IP address. In this case 255.255.255.0 allows only the last section of the IP address to be changed.
  • range = the range of IP addresses you want clients to be able to get from dhcp.
  • option routers = the network interface card in your gateway that is running dhcp.
  • option domain-name-servers = your DNS server (perhaps supplied by your ISP?)

When you have fiddled with the options, and have everything up and running then you will want to restart the DHCP:

/etc/init.d/dhcp start

That is DHCP set up now. If you want to test it, either connect wirelessly via your bridged access point or connect a cross over cable to your gateway ethernet card and another PC to see what network details it gives you.


Auth Server

Installing the Auth Server on Debian Sarge - The rough and ready guide!

  • Grab the minimal install of Debian Sarge and install to your server. Ensure that you have 'testing' sources added to your apt configuration file.
  • Do an apt-get update and an apt-get upgrade to update your Debian installation and grab the latest sources to your apt cache.
  • Install Apache2 apt-get install apache2
  • Install PHP5 for Apache2 apt-get install libapache2-mod-php5 (check if  suhosin is installed, if so enable longer variable names)
  • Install PostgreSQL apt-get install postgresql-8.1
  • Install PostgreSQL support for PHP5 apt-get install php5-pgsql
  • If you wish to use PEAR, you can download the Debian package from the unstable branch by running apt-get install php-pear You will also need curl support for php which you can get by running apt-get install php5-curl
  • Download the latest copy of Wifidog Auth and untar it to your web directory.
  • Run install.php and follow the guide there to get your Auth server going. If you get problems with missing modules like pgsql, then try restarting Apache apache2 -k restart a couple of times to ensure that the changes have applied properly.
  • Edit config.php to suit your needs.

More coming soon.

Configuring the postgresql database for wifidog installation

You will need to create a user and a database for your wifidog installation. You need to make a note of the username and password of your user, and the name of your database. You will need these during the install process.

  • Creating a postgresql user

Switch to the postgres database user account su postgres then type the following to set up your new user and create the database, make sure that you press enter after each line. Be careful when typing the code ensuring you don't miss the semicolons!

$ psql
-> CREATE USER wifidog
-> WITH PASSWORD 'yourpassword';

-> CREATE DATABASE wifidog
-> WITH OWNER wifidog;

You should now be the proud owner of a wifidog database! To exit the pgsql command tool type '\q'. To change back to the root user just type "exit" at the prompt.

Installing WifiDog Auth

download the wifidog-auth SVN tree, using the directions in the "Download" button on the right.

take the contents of the wifidog directory, and drop them in the default web directory of your apache configuration. for my system, this was "/var/www/"

open a web browser, and browse to  http://YOUR_WIFIDOGAUTH_IP/install.php