Scripts
- Enable and Disable P2P connections
- Send Backup email
- Limiting a user to a given amount of traffic (using firewall)
- Limiting a user to a given amount of traffic II (using queues)
- Generate bogons firewall chain based on routing-marks
- Generate routes for stress testing BGP functionality
- Set global and local variables
- Dynamic DNS Update Script for ChangeIP.com
- Reset Hotspot user count
- Use SSH to execute commands (DSA key login)
- Audible signal test
See also
I have a hotspot setup, and at night I want to give an upgrade of the bandwidth to my customers to make proper use of the bandwidth freed up when I close my cybercafe.
The concept is to create first a script that will change the existing hotspot users profiles to new bandwidth settings, here it is (note that the profiles are set to allow bursting in the rate-limit field):
- log info "Begin bandwidth daily upgrade..."
- Change 16kbps up/32kbps down to 24kbps up/48 kbps down for the night
/ip hotspot user profile set "16/32 Customers" rate-limit="24k/48k 100000000k/100000000k 18k/36k 8"
- log info "End: daily bandwidth upgrade complete!"
In the above script you must change the name ("16/32 Customers" in the example) of the profile to suit you. You can also change other variables in the profile with the set function.
Use the same script again in the morning with the daytime settings to change the profile back to daytime bandwidth allowances.
Once this is done (you can add the same one to change profiles with a different name) we need to force active hotspot sessions off so that they can reconnect and pick up the new profile settings. This is not very elegant (maybe somebody out there can comment) as http logged in users will have to re-authenticate via web page, but MAC authenticated customers will re-auth transparently.
Now we have to force out the active sessions:
- Disconnect all active hotspot sessions on server hotspot1
ip hotspot active remove [/ip hotspot active find server=hotspot1]
- delay 5
- log info "Completed disconnect active hotspot sessions"
This script takes the output of the second command (the one in square brackets) and applies it as the input to the first command.
It works like this. It searches for the sessions that are connected to hotspot server called hotspot1 and then feeds that list of sessions to the first command which then removes the sessions.
You will need to change the hotspot server name to suit you.
Then you can add this script to the schedular so that it runs at night to upgrade bandwidth and in the morning to downgrade it again.
Hope you find it usefull.