How to Use the Ban-IP Command – Wiki Guide
This Minecraft tutorial explains how to use the /ban-ip command with screenshots and step-by-step instructions.
Let’s explore how to use this game command.
Background
The /ban-ip command is an advanced server command that is only used if you are running a Minecraft server. If you are operating a Minecraft server that other players connect to, the /ban-ip command can help manage which players are not allowed to connect the server.
To use the /ban-ip command, you must be an operator of the Minecraft server. The /ban-ip command is used to add an IP address to the server’s blacklist (or ban list). This will ban all players from that IP address from connecting to the Minecraft server. Use the /pardon-ip command to allow the players to connect to the server again.
TIP: To ban an IP address on a Minecraft server, you can either provide a valid IP address or the name of a player that is currently online whose IP you wish to ban.
When the /ban-ip command is issued, any player from that IP address will immediately be disconnected from the server. If a player from that IP address tries to reconnect to the server after the IP address is banned, the player will not be allowed to connect to the Minecraft server.
Requirements
To run server commands such as the /ban-ip command, you have to first create a multiplayer server in Minecraft and be the operator of that server.
Ban-IP Command
Ban-IP Command in Minecraft Java Edition (PC/Mac)
In Minecraft Java Edition (PC/Mac), the syntax to ban an IP address from a Minecraft server is:
/ban-ip <address|name> [reason ...]
Definitions
- address is a valid IP address that you want to ban and add to the blacklist (or ban list).
- name is the name of the player that is currently connected to the server whose IP address you want to ban and add to the blacklist (or ban list).
- reason is optional. It is the reason that the IP address has been banned. The reason will be displayed to the player if they try to connect to the server from the banned IP address. The reason will also be displayed in the server logs.
Examples
Example in Java Edition (PC/Mac)
Here are some examples of how to ban an IP address on a Minecraft server.
To ban an IP address with no reason provided:
/ban-ip 172.16.5.128
To ban an IP address with a reason:
/ban-ip 172.16.5.128 Too good at Minecraft
To ban the IP address of a player named TheNotWanted that is currently online (with no reason provided):
/ban-ip TheNotWanted
To ban the IP address of a player named TheNotWanted that is currently online with a reason:
/ban-ip TheNotWanted Too good at Minecraft
How to Enter the Command
1. Open Server Console
To run a server command, the instructions vary depending on your version of Minecraft:
- For Java Edition (PC/Mac), open a server console. Use Command Prompt in Windows or Terminal on a Mac.
2. Type the Command
We will cover examples of how to use the /ban-ip command to add an IP address to the server’s blacklist using an IP address as well as the name of a player that is online.
Ban an IP using the IP Address
The easiest way to ban an IP address is by specifying the IP address in the /ban-ip command.
For example, you could ban an IP address with the following command:
/ban-ip 172.16.5.128
To enter the /ban-ip command in Minecraft, you must enter it as a server command (see below):
You should see the message “Banned IP address 172.16.5.128 belonging to TheNotWanted” appear in the server console.
Once the command has been entered, the IP address 172.16.5.128 will be added to the server’s blacklist and banned from the server. Any players (ie: TheNotWanted) that are connected to the server with that IP address will be immediately disconnected from the server with the following message:
In this example, the player named TheNotWanted will see the message “Connection Lost. You have been IP banned.” in the game window.
Ban an IP Address using an Online Player
If you know the name of the player that is currently online whose IP address you wish to ban, you can enter the player name in the command instead.
For example, you could ban an IP address using the player name with the following command:
/ban-ip TheNotWanted
In this example, we have entered the player name TheNotWanted. Since the IP address for TheNotWanted is 172.16.5.128, this IP address will be banned and added to the blacklist (or ban list). For this command to work, the player MUST be online when you issue the /ban-ip command using a player name.
To enter the /ban-ip command in Minecraft, you must enter it as a server command (see below):
You should see the message “Banned IP address 172.16.5.128 belonging to TheNotWanted” appear in the server console.
Now any players that are connected to the server with that IP address of 172.16.5.128 will be immediately disconnected from the server with the following message:
In this example, the player named TheNotWanted will see the message “Connection Lost. You have been IP banned.” in the game window.
To remove the IP address from the blacklist (or ban list), the server operator must use the /pardon-ip command.
Congratulations, you just learned how to use the /ban-ip command in Minecraft!
Other Server Commands
Here are some other server commands you can use in Minecraft:
How to Use the Ban Command
How to Use the Banlist Command
How to Use the Deop Command
How to Use the List Command
How to Use the Op Command
How to Use the Pardon Command
How to Use the Pardon-IP Command
How to Use the Stop Command
How to enable Command Blocks on a Server