Availability plugin for Moodle making it possible to restrict access to activities and sections by IP address.
The minimum supported Moodle version is 5.0 (build 2025041400). There are no additional dependencies.
You install availability_ip just like any other Moodle plugin.
Starting with Moodle 5.1, it belongs in the public/availability/condition/ip directory.
(For Moodle 5.0 it goes into availability/condition/ip.)
For example, using git from the root directory of your Moodle 5.1+ installation:
git clone \
https://github.com/innocampus/moodle-availability_ip.git \
public/availability/condition/ipFor other options and general plugin installation instructions, see the official Moodle documentation.
The condition type is enabled like any other kind of access restriction in Moodle under Site administration > Plugins > Availability restrictions > Manage restrictions.
All availability_ip specific settings are available at admin/settings.php?section=availabilitysettingip or by navigating to Site administration > Plugins > Availability restrictions > Restriction by IP.
Admins can predefine certain IP addresses or ranges that teachers can choose from when setting up availability conditions for activities and sections.
This is done through the availability_ip | ip_option_presets setting.
Each line in the text field represents one IP address/range option.
Entries must be in the format IPs unique_shortname Displayname, where IPs is either a full IP address (such as 192.168.10.1) which matches a single host; or CIDR notation (such as 231.54.211.0/20); or a range of IP addresses (such as 231.3.56.10-20) where the range applies to the last part of the address.
Multiple IPs can be set by separating them with commas.
unique_shortname may only consist of lower-case letters (a-z) and underscores (_).
Teachers and other users with the necessary permissions will find the condition type under the name IP. As always in Moodle, it can be added via the Add restriction button in the Restrict access section of the activity/section settings.
In addition to relying on the IP address/range options that admins pre-defined (see above), teachers can also enter custom IP addresses/ranges by selecting the Custom IP addresses checkbox.
If a student tries to view an activity/section restricted by this condition, access will be granted only if the associated client's IP address/range matches at least one of the options that were selected.
Of course, the IP condition can also be inverted and/or combined with more conditions as always.
© 2025 Daniel Fainberg, TU Berlin
availability_ip for Moodle is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
availability_ip for Moodle is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with availability_ip for Moodle. If not, see https://www.gnu.org/licenses/.
Code, tests, and documentation written by and for humans. 🚫🤖

