# IP Restriction

IP restrictions let you control which students can access an assignment based on their network location. By configuring IPv4 addresses or CIDR ranges, only students connecting from those addresses will be able to open and work on the assignment.

<figure><img src="https://2172486256-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKAQsDlg_P20iQy3JDs%2Fuploads%2Fncj8tfEI2EhPMziMlhDN%2FScreenshot%202025-09-04%20at%2016.50.21.png?alt=media&#x26;token=d111524b-85be-48a2-aad5-ac28aa34d42d" alt=""><figcaption><p>Configure IP restriction in assignment settings</p></figcaption></figure>

### How IP Restriction Works

* By default, all IP addresses are allowed to access an assignment.
* Once one or more restrictions are added, only the specified IPv4 addresses or ranges are permitted.
* At present, IPv6 addresses are not supported.

{% hint style="info" %}
Students connecting from an address outside the allowed range will be blocked from opening the assignment.
{% endhint %}

***

### Adding IP Restrictions

**Access the Settings**\
Navigate to *Assignment Settings* > *Access*.

**Add a Rule**

1. Under *IP Restriction*, enter either:
   * A single IPv4 address (e.g., `1.2.3.4`)
   * A CIDR range (e.g., `1.0.0.0/24`)
2. Save your changes by clicking *+ Add Rule* or hitting *CMD+Enter*.

{% hint style="success" %}
Use [**Student View**](https://help.codegrade.com/setup-assignment/build-assignment/student-view) to preview and confirm that only the allowed IP addresses can access the assignment.
{% endhint %}

***

#### Examples

* `1.2.3.4` → Only this single IP can access the assignment.
* `1.0.0.0/24` → Allows all IPs from `1.0.0.0` through `1.0.0.255`.
* `1.1.1.0/24` → Allows all IPs from `1.1.1.0` through `1.1.1.255`.

{% hint style="warning" %}
Misconfigured rules can prevent valid students from accessing, so always test with your own IP address before applying strict restrictions.
{% endhint %}
