@ipban and @ipblock – Ban or Block an IP or IPs in Network Range – Free Code!

Hi, come again with custom atcommands. If you are wondering for some easy commands to ban an IP temporarily or permanently, here we go.

These custom commands use map-server to ban or block an IP to login-server via char-server, not using script command query_sql to insert new banned/blocked IP to ipbanlist table nor by using direct sql_handle from map-server modification to access ipbanlist table in your MySQL’s server.

By using server interconnection, you don’t need to worry if your servers (map-server, char-server, and login-server) are in separated database. An example, you have 2 (char-)servers with 1 login-server, like or not your database for login-server’s tables must be separated. This way, you should make 2 custom scripts in each map-server to make sure your script does modification in correct database table, and if your databases have different login credentials you will get other problem because your script can’t access it.

For easy understanding, these atcommands work like @ban, @unban, @block, and @unblock also like @accountinfo/@accinfo. Those atcommands need to access real database/table that being used for login-server.

The command usages are:

@ipban <time> <ip_address>
@ipunban <ip_address>
@ipblock <ip_address>
@ipunblock <ip_address>

For simple usage, these atcommands @ipban and @ipblock just make it “exact” IP to be banned or blocked, just for safe reason. Imagine, if netmask is added in those commands and you allow GMs to use those command that your GMs don’t know about Netmasking? @ipban +1m 8!! Your players with IP until can not play your lovely Ragnarok Online server for 1 month! But, you can decide the default netmask used for @ipban and @ipblock in login_athena.conf, default value is 32 that makes 1 input IP for 1 IP banned/blocked.

So, netmask usage only allowed in login-server console command. Console command? Yes, I added some console commands in login-server side. The prefix is ipban:

ipban:list -> To listings all banned/blocked IP with its netmask/range and duration.
ipban:ban <ip_address> <duration in minutes> <netmask> -> Add new banned IP/Network
ipban:ban <ip_address> <netmask> -> Add new blocked IP/Network
ipban:remove <ip/network_address> -> To remove (unban/unblock) an IP/Network
ipban:clear – > Removes all banned/blocked IP/Network

Blocked IP/Network means the IP/Network is banned permanently. When user try to connect, it shows an error “Rejected From Server (3)” and also shows message on login-server console. Also for temporary ban there’s message shown on the console, but when user try to login to your Ragnarok Server, it will says “You prohibited to login until THE-DATE-OF-BAN-RELEASED“.

I tried not to break previous implementation of dynamic IP ban of password failure. I added it to the ban list, since it does the same.

In this source modification, you also need to execute some queries for your ragnarok database(s). One for expanding ipbanlist table and the other one in log database to log ipban usage.


@ipban and @ipblock – Ban or Block an IP or IP in Network Range – Free Code!

Download “@ipban, @ipunban, @ipblock, @ipunblock” .patch file for eAthena

Download “@ipban, @ipunban, @ipblock, @ipunblock” .diff file for rAthena

Download “@ipban, @ipunban, @ipblock, @ipunblock” .patch file for 3CeAM

Download “@ipban, @ipunban, @ipblock, @ipunblock” .patch file for Hercules

*Above are Mediafire links*

Tell your friends

Leave a Reply