How to Whitelist/Allow an IP address on Linux server

How to Whitelist/Allow an IP address on CentOS, Redhat, Fedora Linux Server

 
Steps to Allow incoming and outgoing connection in IPtables Firewall is given below.
 

How to Whitelist/Allow Incoming connection from an IP address

 
Step 1 : Login into your Linux server via SSH as ‘root’ user

Step 2: Run the command “iptables -A INPUT -s IPADDRESS -j ACCEPT” to whitelist/Allow the IP address

Step 3: Save the Iptables rule by running the command “service iptables save”

You must replace “IPADDRESS” in the Step 2 with the IP address you wish to whitelist.
 

How to Whitelist/Allow Outgoing connection to an IP address

 
Step 1: Login to the Linux server via SSH as ‘root’ user

Step 2: Run the command “iptables -A OUTPUT -d IPADDRESS -j ACCEPT” to whitelist Outgoing connections

Step 3: Run the command “service iptables save” to save the IPtables rules.