Bookmark

Create a Guest VLAN, Limit Bandwidth, and Configure Captive Portal on OPNsense

Outdated

A Guest VLAN allows one LAN port to carry separate networks, which is useful on routers with limited ports. It can provide free guest Wi-Fi, limit guest speed, use a separate DHCP server, or show a captive-portal page before Internet access.

The Wi-Fi access point and its firmware must support Guest VLAN configuration, such as OpenWrt, PandoraBox, or DD-WRT.

 Captive Portal demo
OPNsense Captive Portal

Add a VLAN

  • Open Interfaces > Other Types > VLAN and click Add.
FieldValueNotes
Parent interfacere0 (LAN)Select the port carrying the VLAN. A router needs at least two ports.
VLAN Tag10Use the VLAN ID selected for Guest.
VLAN priority0 (default)Leave the default unless a specific QoS policy requires another value.
DescriptionGuest NET

Click Save.

Assign the VLAN interface

  • Open Interfaces > Assignments.
  • Under New interface, select vlan 10 on re0 (Guest NET).
  • Set the description to GUESTNET and edit the new interface.
  • Enable it and configure:
FieldValueNotes
Block Private networksUnchecked
Block Bogon networksUnchecked
IPv4 Configuration TypeStatic IPv4
IPv6 Configuration TypeNone
MAC / MTU / MSSEmpty
Speed and DuplexDefault
Static IPv4 Address192.168.x.1/24Choose a subnet different from the main LAN.
IPv4 Upstream GatewayAuto-detect

Click Save.

Configure DHCP for Guest

  • Open Services > DHCPv4 > GUESTNET.
FieldValue
EnableChecked
Range192.168.100.2192.168.100.254
DNS Server192.168.100.1
Gateway192.168.100.1

Configure the Guest firewall

Open Firewall > Rules > GUESTNET.

Allow DNS

FieldValue
ActionPASS
InterfaceGUESTNET
ProtocolTCP/UDP
SourceGUESTNET net
DestinationGUESTNET Address
Destination portDNS/DNS
CategoryGuestNet Basic Rules
DescriptionAllow DNS

Save the rule.

Allow captive-portal login

FieldValue
ActionPASS
InterfaceGUESTNET
ProtocolTCP
SourceGUESTNET net
DestinationGUESTNET Address
Destination port8000/10000
CategoryGuestNet Basic Rules
DescriptionAllow Captive Portal Login

Save the rule.

Block Guest access to the main LAN

Create a block rule with:

FieldValue
ActionBlock
InterfaceGUESTNET
Protocolany
SourceGUESTNET net
DestinationLAN Net
DescriptionBlock Local Networks

Create another block rule with destination Guest Address and description Block Firewall Access.

Allow Guest Internet access

FieldValue
ActionPass
InterfaceGUESTNET
Protocolany
SourceGUESTNET net
Destinationany
Destination portany
DescriptionAllow Guest Network

Save all rules and click Apply Changes.

 GuestNET firewall rules
GuestNET firewall rules

Configure the captive portal

The captive-portal configuration is covered in the separate Captive Portal guide .


0 Bình luận

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