#1

 # -----------------------------------

#  Hotspot Auto Configuration Script

# -----------------------------------


# Change these values as needed

:local hsInterface "wlan1"

:local hsNetwork "192.168.55.0/24"

:local hsGateway "192.168.55.1"

:local hsPoolStart "192.168.55.2"

:local hsPoolEnd "192.168.55.254"

:local hotspotName "MyHotspot"

:local hotspotUser "adminhotspot"

:local hotspotPass "123456"


# 1. Assign IP to the Hotspot interface

/ip address add address="$hsGateway/24" interface="$hsInterface" comment="Hotspot Network"


# 2. Create IP pool

/ip pool add name="hs-pool" ranges="$hsPoolStart-$hsPoolEnd"


# 3. Add DHCP server

/ip dhcp-server

add name="hs-dhcp" interface="$hsInterface" address-pool="hs-pool" lease-time=1h disabled=no


/ip dhcp-server network

add address="$hsNetwork" gateway="$hsGateway" dns-server="$hsGateway"


# 4. Run Hotspot setup

/ip hotspot profile

add name="hs-prof" hotspot-address="$hsGateway" dns-name="$hotspotName.local" html-directory="hotspot"


# 5. Create Hotspot server

/ip hotspot

add name="hotspot1" interface="$hsInterface" profile="hs-prof" address-pool="hs-pool" disabled=no


# 6. Add a user for login

/ip hotspot user

add name="$hotspotUser" password="$hotspotPass" profile="default"


# 7. Optional: Set Login Page Advertisement / Redirect

#/ip hotspot walled-garden

#add dst-host=www.example.com


:log info "Hotspot installation completed!"


--Forum Rules --BBcodes


image quote pre code