Candela Technologies Logo
Network Testing and Emulation Solutions

WiFi Captive Portal Login

Goal: Create many user sessions to a WiFi captive portal gateway.

Airports, arenas and coffee shops often offer open WiFi service that is gated with a web sign-on form. This is called a captive portal. LANforge can run a custom login script on a virtual station to emulate sign-in on the captive portal web page. The following example will create one hundred stations and have them authenticate through a captive WiFi portal.
 
  1. Prepare a portal login script (lf_ifup_post)
  2. The lf_ifup_post script will be called after DHCP assignment for a station occurs. It can also be called before DHCP release. This script is called from the LANforge resource hosting the virtual station.
    1. The script should be in directory /home/lanforge/.
    2. LANforge will pass these arguments to the script
      1. -i - station device
      2. --ip4 - station ip address
      3. --ip6 - station ipv6 address
      4. --dns - station DNS address
      5. --mgt - pipe name for reporting results to LANforge
    3. Custom parameters to the script can be provided.
    4. The script can have another name.
    5. LANforge expects these return values:
      1. OK
      2. FAIL
      3. FAIL:reason, this provides feedback on failure occurrance.
  3. Create WiFi stations
    1. In the Ports tab, select wiphy1 and click Create screenshot
    2. In the Create VLANS window, craft ten wifi stations: screenshot
      1. Select WiFi STA
      2. For MAC address, choose xx:xx:xx:*:*:xx
      3. Select DHCP-IPv4
      4. Enter Quantity 100
      5. Specify 0 for STA ID
      6. The example SSID for this cookbook is jedtest
      7. Select the Down option. This postpones the stations making a DHCP request until they are explicity admin up.
      8. ...and then click Apply
    3. You will see ten station created: screenshot
  4. Batch Modify Stations in order to update lf_ifup_post parameters
    1. Highlight stations and click Batch Modify screenshot
    2. In the Batch Modify screen, click the + button and expand to Group 2. screenshot
    3. Edit the IF POST field. Enter the file name and any extra arguments that the script will want for this port. Example: lf_ifup_post --user bob --pass secret --url http://slashdot.org/ screenshot
    4. Click the Apply button to apply the changes. Do not close the window yet.
    5. To check the value of each port's IF/UP Post you can use the Ports tab. In the port Configure Settings window, in the More Advanced Tab you can find the IF/UP script value. screenshot
  5. Testing a station. We will toggle it up and down and look at the logs to find problems.
    1. Highlight one of your stations in the Ports tab.
    2. Set the Report Time to 1s and click Apply
    3. In the Batch Modify window, click the Up button. This is the same as settting Up/Down to UP and clicking Apply
    4. Watch the Wireless Messages and LANforge Messages windows for error messages. The Ports tab will update the station status.
  6. Use the Batch Modify window to Force DHCP Renewal
    1. Click Down screenshot
    2. click Clear DHCP screenshot
    3. click Up screenshot
  7. Use the Batch Modify window to Re-Login to Portal
    1. Click Portal Re-Login
    2. If you wanted to change other parameters:
    3. Click Down Logout
    4. Set Up/Down to Down
    5. Change another station parameters and then click Apply
    6. Click Up
  8. Use the Batch Modify window to Change station MAC addresses screenshot
    1. Click Down
    2. Set MAC Addr to xx:xx:xx:*:*:* randomize the mac address
    3. Click Apply
    4. Click Up

Candela  Technologies, 2417 Main Street, Suite 201, Ferndale, WA 98248, USA
www.candelatech.com | sales@candelatech.com | +1.360.380.1618
Facebook | LinkedIn | Blog