# Installation and main configuration

Install Fail2Ban on Debian-based systems by running

```bash
sudo apt -y install fail2ban
```

Create `/etc/fail2ban/jail.local`and edit it.

Add the following configuration or replace existing lines

```bash
[DEFAULT]
# the IP address range we want to ignore
ignoreip = 127.0.0.1/8 [LAN SEGMENT]
# who to send e-mail to
destemail = [your e-mail]
# who is the email from
sender = [your e-mail]
mta = mail
#Enable Email alerts
action = %(action_mwl)s
```

That's pretty much it, now you can create jails for all the applications you use.

**Checking for installed jails**

```bash
sudo fail2ban-client status
```

**Checking jail for banned IPs**

```bash
sudo fail2ban-client status jailname
```

**Unban client**

```bash
fail2ban-client set <jail> unbanip <IP>
```

<div class="page-content" id="bkmrk-"><div class="text-muted text-small"><div class="entity-meta"></div></div></div>