You are testing SSH from your usual address, several attempts fail, and then the connection refuses any further attempts. On a Debian or Ubuntu server, Fail2ban may have banned your IP in the sshd jail, or in a broader jail like recidive.
Keep your current SSH session open and review the jail before removing the ban. This procedure allows you to identify the blockage, unban a single address, and ensure that the next access goes through successfully.
Identify the jail that blocks the address
A refused SSH connection does not prove that Fail2ban is at fault. A firewall, a wrong key, or a stopped SSH service can produce the same symptom. Start with the list of active jails, then check the one that protects SSH.
sudo fail2ban-client status
sudo fail2ban-client status sshd
sudo fail2ban-client get sshd banned
The first command displays the known jails by the server. The second gives the status of sshd, with the number of banned IPs. The third returns the list held by this jail. If your address does not appear, do not yet run the unbanip command.
Also, note the name of the jail and your public address. From a remote connection, it may not necessarily be the one displayed by ip addr on your machine, especially if behind a box, a VPN, or a corporate network.
Read the log before removing the ban
The log helps to distinguish a ban triggered by authentication errors from a configuration issue. On a systemd server, retrieve the latest entries from the service without modifying the active rules.
sudo journalctl -u fail2ban -b --no-pager | tail -n 80
sudo journalctl -u fail2ban -b --no-pager | grep -E 'Ban|Unban|sshd'
A line containing Ban, your IP, and sshd confirms the jail to address. If the log mentions recidive, check this jail before making any changes. It may have picked up the failures observed in several jails, even after a ban limited to sshd.
This reading avoids a frequent wrong response: clearing an entire jail or stopping Fail2ban to restore a connection. You would then also remove the protection applied to other addresses.
Unban a single IP then check its status
Replace the example with the actually blocked address. The get command also accepts a specific IP: it returns 1 when the jail considers it banned and 0 after the removal.
IP='203.0.113.24'
sudo fail2ban-client get sshd banned "$IP"
sudo fail2ban-client set sshd unbanip "$IP"
sudo fail2ban-client get sshd banned "$IP"
Next, open a second SSH session from this address. Keep the first session active until this test. If the connection remains refused while the last check returns 0, the problem is no longer from this ban in sshd.
Check recidive and the firewall if the IP remains blocked
A jail named recidive can retain the ban after a series of incidents. It should only be queried if it appears in fail2ban-client status or in the log.
sudo fail2ban-client status recidive
sudo fail2ban-client get recidive banned "$IP"
sudo fail2ban-client set recidive unbanip "$IP"
If no jail retains the address, check the SSH service, its listening port, and the UFW or nftables rules. The guide Fail2ban already published on LinuxEnCaja covers the activation of jails; this procedure remains focused on diagnosing a banned IP.
The manual page fail2ban-client documents the commands get ... banned and set ... unbanip. On an exposed server, always keep a console or a second session open before modifying a mechanism that protects SSH.