View RSS Feed


irc 101: host masks & banning people.

Rating: 3 votes, 5.00 average.
It has recently come to my attention that people are unable to place proper bans and ignores so end up complaining to opers when people continue to dodge their woefully lacking bans. So i'm writing a quick referance guide on how to place proper bans.

First off, lets look at the irc hostmask. This is a string that identifies a user. the easiest way to see this string is the whois command. the first line of output will look something like this:

 Carnage  is * Carnage
This is not the full string, it only displays their ident and host, for ban masks you also need to add the nick to the mask; the finial mask will look something like this:

so, lets break that down a bit and look at what it means.

The first part of the mask before the ! character is the nick name. Placing a ban against the nick name is a bad idea as someone can just change their nick to soemthing else and rejoin your channel. Nickname banning can come in useful however; in #kingsofchaos nicks like shit fuck and a bunch of others are banned, this prevents people with vulgar or racist nicks from joining that channel.

The second part of the mask is between the ! and the @ this is called the ident its set based on the users settings in their irc client when they connect to the server. Once a user is connected only an ircop can change this value. Placeing a ban which includes the ident means that someone would have to disconnect from irc to dodge the ban.

The third part after the @ is the host. This can vary alot between different users however unless they are using a vhost (covered later) on it will always start with Cyanide-(string of letters and numbers) This value is an encrypted version of the clients ip address. This is an example of an unencypted version:

 Carnage is Carnage!
This version is only accessable to ircops, but i've included it to help explain what the values represent. It will also remain constant while the user is connected. Usually the only way to change this value is to disconnect from the internet and get a new ip address. Banning against this value is USUALLY enough to keep a user out of your channel, however isn't always effective against a determined user.

The finial part of the host mask is usually representitive of the clients isp the only way for a user to change this would be to change isp or use a proxy. So banning against the isp is the strongest ban you can place be aware however setting a ban against the isp might effect innocent users you want to be allowed in your channel.

Ok, so now i've explained how to understnad the masks, this is how you can use them. The easiest way is to work out the ban you want to place yourself. For bans * acts as a wildcard for any number of characters and ? acts as a wildcard for a single character. So here are some example masks and what they will ban.

carnage!*@* will ban the nick carnage from any host or ident
*!blackghost@* will ban the ident blackghost from any host and any nick
*!* will ban the host from your channel. no matter what nick or ident they use.
*!*@* will block all hosts ending in

The easiest way to ban a host mask is the mode command. This will work on any irc client and any irc server. The syntax for this command is simple:

/mode #channel +b mask

broken down this means change the mode on channel #channel setting a b (ban) mode against mask.

To remove a ban you would do the following:

/mode #channel -b mask

and to view the ban list you type:

/mode #channel +b

note that if you dont specify a mask it will instead list all the bans set on that channel.

Ok so thats how bans work, however it may still be possible for someone to join your channel. The cyanide-x irc server has two lesser known features which work in a similar way to bans however OVERRIDE them. These are called exempts and invites.

An exempt is basically the opposite to a ban, it tells the irc server that a user matching this mask is allowed to be on this channel. If you ban a user but they also match an exempt they will still be able to join the channel. The syntax for manipulating exempts is exactly the same as for bans however instead of a b you use an e for example

/mode #chan +e mask
/mode #chan -e mask
/mode #chan +e

to set, remove and list respectivly.

the finial mode is an Invite. These are slightly confusing, as there is also an /invite command which acts in a similar way. The /invite command effectivly adds a tempoary I mode to the channel to allow the /invited user to join. An I mode however is permanet and will remain untill someone removes it. A user matching an I mask will be able to join if banned like if they matched an exempt however will also be able to join if the channel is set to invite only (+i) manipulations of the invites list can be done as follows:

/mode #chan +I mask
/mode #chan -I mask
/mode #chan +I

to set, remove and list. Note that you must use a capital I.

I and e modes are not evil modes that allow people to dodge bans and can come in very useful for preventing users you want in your channels from geting accidentilly banned or allowing them into invite only rooms without having to be /invited however when setting a ban you must ensure that the user dosn't also match an exempt or invite or the ban will be pointless. For this reason its unadvisable to set an exempt against a nick or ident as a banned user could change to that nick in order to rejoin the channel.

This is a slightly seperate issue as it shouldn't be that common. Cyanide-x operates a #vhosts channel where users can go in and request their host name be changed to somthing cooler. For example mine is many of the other opers use

If a user is using a vhost you wont see their true host mask and a ban against it will only be effective untill a user changes their host or reconnects. Using vhosts in this manner to dodge channel bans is against the network rules and if this is happening, contact an oper to have them set a ban on your channel against the users real host or suspend the users vhost privilages.


for anyone using mirc there is an easier way than working out ban masks for yourself. The address identifyer will return the address of a user which you can then pass to the mode command.

the syntax for the ban using the address identifyer is:

//mode #chan +b $address(nick,number)

note, the two / at the front of the command. This tells mirc to evaluate the command instead of just sending it and will turn the address part into the acctual address of the user.

The number at the end can be one of the following:

0: *!user@host
1: *!*user@host
2: *!*@host
3: *!*user@*.host
4: *!*@*.host
5: nick!user@host
6: nick!*user@host
7: nick!*@host
8: nick!*user@*.host
9: nick!*@*.host

For bans, 2 is recomended in the first instance and 4 if they continue to dodge. 2 sets a ban against the full host including the cyanide-(numbers) bit the 4 will set a ban against their isp.

note, you can only use one number in the command. using 24 will not work.

Finially, if you have set a strong (isp ban) against a user and they continue to use proxies to dodge the ban, contact an oper to have them dealt with at a network level. With the exception of someone using a vhost to dodge, this is the only instance where oper intervention should be needed.

Submit "irc 101: host masks & banning people." to Digg Submit "irc 101: host masks & banning people." to Submit "irc 101: host masks & banning people." to StumbleUpon Submit "irc 101: host masks & banning people." to Google

Updated 11th April 2008 at 06:12 AM by Carnage

/dev , /tutorials


  1. NightFire91's Avatar
    <3 Carnage o_o

    That's amazing.

    I never knew about the /mode #channel +b to show all the bans. I normally double click the channel window, which usually shows up a topic window and a list of bans, however that syntax is easier.

    I guess you learn something new everyday! : )

    However... I feel that banning a user from a channel should always be seen as a last resort.
  2. Neomackenzie's Avatar
    Very useful post. Now, what I do not understand is why you are putting this on the blog and not just post a thread and stick it or include it in a FAQ if necessary.
  3. Carnage's Avatar
    At the time i wrote it, there wasn't a forum for IRC.