Trace: » installation_of_the_wifidog_captive_portal

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

You don't have an account yet? Just get one: Register

Forgotten your password? Get a new one: Send new password

Outline

The WiFiDog gateway is a pretty clever piece of software. This tutorial shows you how to recycle an old PC into a WiFiDog router. Although you could also use a wireless card on the PC to provide access, this tutorial uses an Access Point as an example as this configuration is much more straight forward.

Hardware installation and configuration

Although designed for embedded devices like linksys routers, Wifidog will run on more or less any PC hardware no matter how slow it is. You may want to consider how resilient the hardware is however as it will be expected to run for long periods of time without any user intervention.

Typical basic PC requirements:

  • CDROM Drive
  • 486 or later processor
  • 32 MB RAM
  • 1 GB hard disk
  • 2 x 10/100 Ethernet cards

Added requirements

  • 1 Wireless access point with the DHCP server turned off

You will need to go into the BIOS settings of the computer you are using and select CDROM as the primary boot device, and HDD as the secondary. Whilst you are there ensure Wake on LAN is set up, and that the computer will boot without a keyboard and mouse attached (some may not ask this), and finally make sure the PC is set to boot up after a power failure. Occasionally you may have to make sure that the LAN device is enabled on the bios, but usually this is not the case.

Although I used Debian as the operating system of the Wifidog Linux router, and the tutorial describes installation from the Debian minimal net install CD, Ubuntu will do just as well (and is my preferred operating system since I first wrote this how to).

Beginning the Process

  • Insert the Debian minimal install CD
  • Turn Computer On

Locale Settings

  • When you are greeted with the opening screen type linux26
  • Choose Language - English
  • Choose Country or Region - United Kingdom
  • Select Keyboard Layout - British

Network Configuration

  • Configure the Network - eth0 (this should be the card facing the internet)
  • Configure the Network - Continue
  • Configure the Network - Configure Network Manually
  • Configure the Network - Insert the IP Address of the PC router you are setting up
  • Configure the Network - Insert the Netmask
  • Configure the Network - Insert the Gateway address
  • Configure the Network - Insert the DNS Server address
  • Hostname - This is the name of the node you are creating eg MyHostNode
  • Configure the Network - Just press Enter, there is no domain

Partitioning the Disks

  • Partition Disks - Erase entire disk
  • Partition Disks - All Files in One Partition
  • Partition Disks - Finish Partitioning and write changes to disk
  • Partition Disks - Write Changes to Disks? - Yes
  • Install the GRUB boot loader on a hard drive - Yes
  • Finish the Installation - Continue
  • The PC reboots - Press Enter

Time Zone Configuration

  • Time zone configuration - Yes
  • Time zone configuration - OK

User Accounts

  • Configuring password - You need to enter the password for root
  • Configuring password - Create a secondary user account

APT Configuration

  • Apt configuration - select http
  • Apt configuration - select UK
  • Apt configuration - Choose a mirror
  • Apt configuration - Proxy config - At the moment we don’t have a proxy so you can leave this blank.
  • At this point you should see a screen showing testing apt sources
  • When asked to select which packages you wish to install, simply press enter

Final Configuration

  • Configuration of Exim - No configuration at this time click Yes
  • Select your default account as the postmaster.
  • When install has finished; remove CD from the drive and allow PC to reboot
  • To login, simply type your password at the prompt reading nameofpc login:
  • Type apt-get install update followed by apt-get install upgrade to allow the operating system to be upgraded

The base operating system is now installed and running. You should reboot the system by typing reboot to ensure that it comes back up again smoothly.

Extended Setup of Networking

When the operating system was installed, it automatically took you through the setup of the main network connection to the internet. Now the other network card which will be allowing clients to connect to the PC via the wireless access point needs to be set up, and the two network cards bridged together to let wireless clients access the internet.

  • Open the /etc/network/interfaces file
  • Edit the options in the interfaces file using this as a guide
  • Restart networking - /etc/init.d/networking restart
  • Type ifconfig to see if the network cards are now both listed

Now that you have eth0 (connected to the internet) and eth1 (this will face the wireless AP) so you need to get one to talk to the other. This is so that traffic from the wireless AP can pass to the internet (so the wireless users can get internet access). This is accomplished by creating a proxy script, which I’m sure you’ll be glad to know has all ready been written for you by Debian, and meddled with by me!

  • Grab the proxy setup script here
  • Copy it to /etc/init.d
  • Make sure it’s named proxy.sh
  • Make it executable chmod a+x proxy.sh
  • Edit it to your liking - Go to SECTION B and change the EXTIP= section to match the internet main IP of the Linux PC you are building.
  • Save the file
  • Make a symoblic link to rc2.d to ensure the proxy rules start automatically when the PC starts. ln -s /etc/init.d/proxy /etc/rc2.d/S95proxy

Installation of DHCP

So that the wireless users are issued with and IP address and DNS server settings when they connect, the Linux box will need a DHCP server running on the wireless facing network interface eth1. This is a program which needs downloading from the central software repository and setting up:

  • Get a DHCP server - apt-get install dhcpd
  • The DHCPD server will probably fail to start - that’s OK
  • Type /etc/init.d/dhcp stop to stop DHCP while you configure it
  • Grab the dhcpd.conf file from here and put it in the /etc/ folder
  • Yes you do want to overwrite the existing file
  • Edit the values in dhcpd.conf to ensure they match the IP info you want to give clients.
  • 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="eth1"

You should now have the wireless facing card set up to issue IP addresses and DNS information to connecting clients.

At this stage you should test that the Linux PC is working properly. Give it a reboot by typing reboot, then when it has come up, ensure that it issues an IP address, and bridges the network cards allowing a user to connect to the internet. To do this, simply patch another computer into the wireless facing port on your linux PC with a cross-over cable and try to get a web page on the internet.

Assuming all is working so far we are now moving into the final stages of setting up the Linux router PC.

Installation of Wifidog

Wifidog is the ‘nuts and bolts’ of the captive portal. It is the component which captures the wireless user’s webpage, and redirects them to a log on screen. This is the last piece of software which requires installing to create the Linux PC router.

  • Navigate to the /usr/src folder
  • Grab the wifidog-1.x.x.tar.gz file Sourceforge and put it in/usr/src
  • Type gunzip wifidog-1.1.2.tar.gz to decompress
  • Then tar –xvf wifidog-1.1.2.tar to untar
  • Now cd wifidog-1.x.x to move to the folder that has the Wifidog files in it

Doing this has now uncompressed the Wifidog files into a separate folder located in the /usr/src section of your Linux PC. Now we need to install the Wifidog components to make it work.

  • Type ./configure
  • Type make
  • Type make install

You will see some text running up your screen as you perform each step; this is the PC compiling the program. Now we need to add the configuration file so it works properly.

Naming the Node

  • Take the wifidog.conf file from the wifidog.conf and copy the file to the /etc/ folder
  • Change the gateway name in the file to the name of the gateway.
  • Edit the auth server part to point at the correct auth server.
# Parameter: GatewayID
# Default: default
# Optional but essential for monitoring purposes
#
# Set this to the template ID on the auth server
# this is used to give a customized login page to the clients
# If none is supplied, the default login page will be used.
#

GatewayID testnode

Finally we need to make sure that Wifidog runs automatically when the PC starts, so we need to add one more file from the wireless files folder.

  • Take the file called wifidog and move it to the /etc/init.d/ folder
  • type ln -s /usr/local/bin/wifidog /etc/rc2.d/S96wifidog to tell the system to start Wifidog automatically

Now for the moment of truth. Connect your wireless access point to your remaining network card (remember to turn DHCP off on the AP - your linux box is doing that for you now) You should be able to reboot the Linux PC and see the captive portal page when you connect wirelessly. If not, go over the files you have edited and ensure that you didn’t make any capitalisation/spelling mistakes or leave any commas out!

Good Luck.