# IP restrictions of a user

A user can be tied to the addresses they may come from. The card **IP Restrictions**, on the [Restrictions](Users-Restrictions.md) tab of a user, is a list of rules that are tried from the top; the first one that fits the address of a login decides.

A new user has one rule: **Allow: 0.0.0.0-255.255.255.255**, which is any address.

## A rule

**Add** opens **IP Restriction**:

| Field | What it is |
|---|---|
| **Type** | **Allow** or **Deny** |
| **Starting IP**, **Stopping IP** | the range of addresses the rule is for. The same address twice is one address. |
| **Reason** | a note for yourself |

A new rule can be put **Before selection** or **After selection**, and rules can be moved: the order is the meaning.

## Letting a user in from one place only

1. Add **Allow** for the office: `203.0.113.10` to `203.0.113.10`.
2. Make sure it stands above the rule for everything.
3. Change the rule for everything, `0.0.0.0` to `255.255.255.255`, from **Allow** to **Deny**.

The login from the office fits the first rule and gets in. Every other address falls through to the last rule and is refused.

## Keeping one place out

Add a **Deny** for that range above the **Allow** for everything.

## Many rules at once

**Paste IP List** takes a list, one rule per line:

```
203.0.113.10 - 203.0.113.10 - head office
198.51.100.0 - 198.51.100.255 - branch
```

That is the starting address, the stopping address, and the reason if you want one. Choose whether they are Allow or Deny, and where in the list they go.

## Things to know

- The rules of a user come on top of the server's own: an address that the server bans or refuses for everybody never gets as far as the user's list. See [Banning](Prefs-Banning.md) and the IP restrictions of the server in [Restrictions](Prefs-Restrictions.md).
- Behind a load balancer or a proxy the server may see the balancer's address for everybody. Then these rules cannot tell users apart, until the listener is told to take the real address from the proxy.
- The list is inherited as a whole, like every card: a user with rules of their own no longer follows the list of `default`.
- A login from an address that is not allowed fails like a wrong password; the session's log names the rule.
