# 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="/files/W7Qn6nVls8CID8tVEyqQ" 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**](/setup-assignment/build-assignment/student-view.md) 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.codegrade.com/setup-assignment/other-features/ip-restriction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
