Thats new to me… I said:
wirte a fancy mikrotik-script, so i can impress the guys in the mikrtoik-forum!
AI said:
Sure, here’s a fancy script that demonstrates some advanced features of MikroTik RouterOS scripting:
It came up with this stuff
(dont know if it works)
# This script sets up a simple hotspot with user authentication
# and bandwidth limiting, and sends a welcome message to the user
# upon successful login.
# First, define some variables for the hotspot and user settings
:local hotspotName "My Fancy Hotspot"
:local hotspotAddress "192.168.88.1"
:local hotspotDns "8.8.8.8"
:local hotspotNetmask "255.255.255.0"
:local hotspotLeaseTime "1d"
:local hotspotUamSecret "mysecret"
:local hotspotUamServer "http://$hotspotAddress/hotspot"
:local hotspotMaxUsers "20"
:local userRateLimit "512k/512k"
# Next, create the hotspot interface and set the required settings
/interface wireless
set [ find default-name=wlan1 ] ssid=$hotspotName
set [ find default-name=wlan1 ] mode=ap-hotspot
/ip pool
add name=hotspot-pool ranges=$hotspotAddress/$hotspotNetmask
/ip hotspot profile
set [ find default=yes ] address-pool=hotspot-pool
set [ find default=yes ] dns-server=$hotspotDns
set [ find default=yes ] lease-time=$hotspotLeaseTime
set [ find default=yes ] login-by=http-chap
set [ find default=yes ] hotspot-address=$hotspotAddress
set [ find default=yes ] hotspot-service=http
set [ find default=yes ] hotspot-service=https
set [ find default=yes ] hotspot-service=ssh
set [ find default=yes ] hotspot-service=ftp
set [ find default=yes ] hotspot-service=dns
set [ find default=yes ] hotspot-service=smtp
set [ find default=yes ] hotspot-service=pop3
set [ find default=yes ] hotspot-service=imap
set [ find default=yes ] hotspot-service=radius
set [ find default=yes ] hotspot-service=winbox
set [ find default=yes ] hotspot-service=www
set [ find default=yes ] hotspot-service=api
/ip hotspot user profile
set [ find default=yes ] rate-limit=$userRateLimit
/ip hotspot
add address=$hotspotAddress name=$hotspotName profile=default
# Now, define the login and logout scripts that will be executed
# when a user authenticates to the hotspot.
# The login script sends a welcome message to the user and adds a
# bandwidth limit to their connection.
:local loginScript ""
:local logoutScript ""
:set loginScript [ /file get hotspot-login.rsc contents ]
:set logoutScript [ /file get hotspot-logout.rsc contents ]
/ip hotspot user profile
set [ find default=yes ] on-login=$loginScript
set [ find default=yes ] on-logout=$logoutScript
# Finally, set the hotspot to start automatically on boot and
# enable the hotspot service
/system script
add name=hotspot-start policy=ftp,reboot,
And a short AI-Mikrotik poem:
Mikrotik, oh Mikrotik,
A router that’s truly quick,
Connecting all our devices,
With lightning-fast speeds.Through rain or wind or snow,
You keep our connections flowing,
Your magic touch never fades,
In so many different ways.Mikrotik, oh Mikrotik,
A hero of the internet,
We thank you for your service,
Our gratitude won’t be inert.