Calculate whitelist subnet [fail2ban]

NethServer Version: 7.5 (oct 18)
Module: fail2ban

Reaching out, for my knowledge with calcultaing IP stuff is ‘zilch’.

I am looking for what to fill out to whitelist my mobile provider’s subnet. Every time I use hotspot on my cell phone I get assigned a different IP, so I want the whole providers net being whitelisted.



The IP has just been banned by Fail2Ban after
3 attempts against openvpn.

Here is more information about :

% This is the RIPE Database query service.
% The objects are in RPSL format.
% The RIPE Database is subject to Terms and Conditions.
% See

% Note: this output has been filtered.
% To receive output for a database update, use the “-B” flag.

% Information related to ‘ -’

% Abuse contact for ‘ -’ is ‘’

inetnum: -
netname: TMONL-NET
descr: Pool for mobile users
country: NL
admin-c: AT13974-RIPE
tech-c: AT13974-RIPE
mnt-by: mnt-tmonl
created: 2005-08-16T08:29:46Z
last-modified: 2018-06-28T13:03:31Z
source: RIPE

role: Access & transport
address: Waldorpstraat 60
admin-c: RB21461-RIPE
tech-c: RD7864-RIPE
nic-hdl: AT13974-RIPE
mnt-by: MNT-TMONL
created: 2017-03-28T08:40:14Z
last-modified: 2017-03-31T13:36:43Z
source: RIPE # Filtered

% Information related to ‘’

descr: T-mobile Netherlands
origin: AS31615
mnt-by: MNT-TMONL
created: 2011-08-10T13:11:33Z
last-modified: 2011-08-10T13:21:11Z
source: RIPE

% This query was served by the RIPE Database Query Service version 1.92.6 (HEREFORD)



I found this site:

hmm, I tried in the fail2ban config but get:

“” is not an IP

Is it me, is it fail2ban or is it Nethserver?

Only IPs are accepted in web UI.

You may edit /etc/fail2ban/jail.conf and edit the ignoreip option to ignoreip = and do a signal-event nethserver-fail2ban-update

A better solution would be to create a custom template because jail.conf may be templated in future, but let’s check, if it works for you first.

Jail.conf could change with a fail2ban upgrade and jail.local wins with its priority so the change must go to jail.local.

Markus is right a custom template is the way…maybe also you could also look the template because I put a lot of eastern eggs

Not on this case… Probably I woried about a network that could cover the whole ipv4 subnet :smile:

1 Like

The custom template to create is for this one

1 Like

I created the custom template, expanded and restarted (thanks @stephdl)

It did not work for me for my mobile provider keeps changing IP’s on me and I lack the skills on subnets. Entering a specific IP in the fail2ban config web UI works.

1 Like

This is a network allowing IP between to

You could try /16 but you allow about 65000 IP :frowning: - - is

But its too much ip…it is like a big hole in the firewall

Please don’t get me wrong, but I don’t get why you want to whitelist more then 2000 IP’s only because you failed with login to your own VPN. I’m using mobile devices with changing IPs on openvpn and there is no problem.
Maybe to increase the number of allowed attemps to 5 or 6 would be the better idea. If there is a real attack, 5 attemps are done in some parts of a second, not really a big loose of security, but you have still 2 or 3 more to try your credentials. :slight_smile:

just my 2 ct


Yep I know laylow since a long time, a skilled sysadmin, and I would be curious why you want to go in that direction :-?

do you think we miss a feature in fail2ban ?

@flatspin @stephdl @mrmarkuz,

thanks for the thoughts and suggestions. The fail2ban log was only to get the whois report on the subnet, not a real attempt.

I guess what I miss is the possibility to enter subnets or range of subnets in the fail2ban GUI, and the possibility to ignore IP’s and subnets for specific services.

In my case I was testing stuff on Nethserver including making forced mistakes, and wanted to exclude my mobile providers subnets to prevent fail2ban to lock me out. Since this Nethserver is a Contabo VPS I was forced to open a VNC session and unban the offending IP.

But again, not my specialty, sort of a blind spot to me :wink:



I forgot it, but when you want to allow a whole subnet in fail2ban, go to the trusted network menu and add your network as fully trusted, a lot of other applications use it already


Works, many thanks.