Bookmark

How to Configure a Captive Portal on OPNsense

Outdated

See the OPNsense configuration series .

 Captive Portal use cases
  • Hotel, guesthouse, or cafe Wi-Fi with voucher or username management.
  • Wi-Fi marketing pages that introduce a product after connection.
  • Other guest-access workflows.
 Main features
  • Login-page templates with URL redirects, pop-ups, and custom splash pages.
  • Multiple zones, each with its own interface, template, port, or shared settings.
  • Authentication through HTTPS, LDAP/Active Directory, RADIUS, local users, vouchers, or no authentication.
  • Bandwidth management.
  • See the OPNsense Captive Portal documentation for more features.

This guide configures a captive portal for GUESTNET. If GUESTNET has not been created, see the VLAN and guest-network guide . A separate physical port can be used instead of a VLAN when the router has enough ports.

Configure the captive portal

  • Open ServicesCaptive PortalAdministration.
  • Click + to add a zone. Each interface needs its own zone; this example uses GuestNET VLAN 10.
FieldValueNotes
EnableChecked
InterfaceGUESTNET
Authenticate usingNothing Selected
Idle timeout (minutes)00 disables the timeout.
Hard timeout (minutes)00 disables the timeout.
Concurrent user loginsUnchecked
SSL certificatenoneUse a certificate after configuring a domain.
HostnameEmptyLeave empty without a domain.
Allowed AddressesEmpty
Custom templateNoneUse the default template.
DescriptionGuestNET
  • To add a template, open the Template tab, download the default template, customize it, zip it, and upload it. A sample template is available from this GitHub project .
  • Preview the portal at http://<OPNsense-IP>:8000.
The firewall must allow access to the captive-portal login page. See the rules in the VLAN and guest-network guide .

Limit guest bandwidth

This example limits Guest download to 8 Mbps and upload to 1 Mbps.

The limit is shared between Guest clients. With seven clients, each may receive roughly 8/7 = 1.1 Mbps under equal demand. A common starting point is one-third to one-half of the Internet plan. See the OPNsense traffic-shaper documentation for per-client limits.
  • Open FirewallShaperPipes and add a download pipe:
FieldValue
EnableChecked
Bandwidth8 Mbit/s
MaskDestination
Descriptionpipe_8Mbps_down

Click Save Changes. Create an upload pipe with 1 Mbit/s and description pipe_1Mbps_up.

  • Open FirewallShaperRules and add a download rule:
FieldValue
InterfaceWAN
Interface 2GuestNET
Directionin
Targetpipe_8Mbps_down
DescriptionLimit Guest Download to 8 Mbps

Create a second rule with direction out, target pipe_1Mbps_up, and description Limit Guest Upload to 1 Mbps.

Click Save Changes and Apply.

For voucher, ticket, or username authentication, see the OPNsense guest-network guide .

0 Bình luận

Góp Ý / Bình Luận / Đánh giá