|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.
Prepare a portal login script (lf_ifup_post)
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.
The script should be in directory /home/lanforge/.
LANforge will pass these arguments to the script
-i - station device
--ip4 - station ip address
--ip6 - station ipv6 address
--dns - station DNS address
--mgt - pipe name for reporting results to LANforge
Custom parameters to the script can be provided.
The script can have another name.
LANforge expects these return values:
FAIL:reason, this provides feedback on failure occurrance.
Create WiFi stations
In the Ports tab, select wiphy1 and click Create
In the Create VLANS window, craft ten wifi stations:
Select WiFi STA
For MAC address, choose xx:xx:xx:*:*:xx
Enter Quantity 100
Specify 0 for STA ID
The example SSID for this cookbook is jedtest
Select the Down option. This postpones the stations making a DHCP request until they are explicity admin up.
...and then click Apply
You will see ten station created:
Batch Modify Stations in order to update lf_ifup_post parameters
Highlight stations and click Batch Modify
In the Batch Modify screen, click the + button and expand to Group 2.
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/
Click the Apply button to apply the changes. Do not close the window yet.
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.
Testing a station. We will toggle it up and down and look at the logs to find problems.
Highlight one of your stations in the Ports tab.
Set the Report Time to 1s and click Apply
In the Batch Modify window, click the Up button. This is the same as settting Up/Down to UP and clicking Apply
Watch the Wireless Messages and LANforge Messages windows for error messages. The Ports tab will update the station status.
Use the Batch Modify window to Force DHCP Renewal
click Clear DHCP
Use the Batch Modify window to Re-Login to Portal
Click Portal Re-Login
If you wanted to change other parameters:
Click Down Logout
Set Up/Down to Down
Change another station parameters and then click Apply
Use the Batch Modify window to Change station MAC addresses
Set MAC Addr to xx:xx:xx:*:*:* randomize the mac address