HOW TO: Whitelist An IP Address In IPTables
Posted by Asilah A. on 21 June 2022 10:38 AM

Most Linux distributions will use IPTables as the default firewall. Here are the commands to whitelist an IP address on your Linux server, both incoming and outgoing.


Example: How to whitelist IP address


Step 1: Log into the server via SSH.

Step 2: Allow incoming connections from

# iptables -A INPUT -s -j ACCEPT

Step 3: Allow outgoing connections to

# iptables -A OUTPUT -d -j ACCEPT


Additional Options:

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 -p tcp --dport 80 -i eth0 -j ACCEPT

This will allow connections from source only on port 80, only on any IP address associated with eth0, only using TCP protocol.


# iptables -A OUTPUT -d -p tcp --dport 443 -o eth0 -j ACCEPT

This will allow outgoing connections to destination IP using protocol TCP, only on destination port 443, only from the interface eth0.


If you face any difficulties on the setup, please feel free to contact our support team by submitting a ticket on or emailing out support team at

(0 vote(s))
Not helpful

Comments (0)
Copyright © 1998 - 2021 Shinjiru International Inc. All Rights Reserved.