iptables is the default firewall for most Linux distributions.
Multiple reasons can lead to an IP getting blacklisted in iptables, so in order to remove this specific IP from the blacklist you need to use the following commands form SSH.
For starters you need to connect to your server using your favorite SSH client, something like putty.
Next, we will allow incoming connections from 192.168.1.1
iptables -A INPUT -s 192.168.0.1 -j ACCEPT
If you also need to allow outgoing connections to 192.168.1.1 you can use the following command.
iptables -A OUTPUT -d 192.168.0.1 -j ACCEPT
- You can specify the destination port using the –dportoption.
- You can specify the protocol using the -p option
- You can specify the interface using the -i option for input, and the -o option for output
iptables -A INPUT -s 192.168.0.1 -p tcp –dport 80 -i eth0 -j ACCEPT
This will allow connections from source 192.168.0.1 only on port 80, only on any IP address associated with eth0, only using TCP protocol.
iptables -A OUTPUT -d 192.168.0.1 -p tcp –dport 443 -o eth0 -j ACCEPT
This will allow outgoing connections to destination IP 192.168.0.1 using protocol TCP, only on destination port 443, only from the interface eth0.