How to Whitelist/Allow an IP address on CentOS, Redhat, Fedora 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

  1.   Login into your Linux server via SSH as ‘root’ user
  2. Run the command

iptables -A INPUT -s IPADDRESS -j ACCEPT

to whitelist/Allow the IP address

  1. Save the Iptables rule by running the command

service iptables save

  1. 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

  1.  Login to the Linux server via SSH as ‘root’ user
  2. Run the command

iptables -A OUTPUT -d IPADDRESS -j ACCEPT

to whitelist Outgoing connections

  1. Run the command

service iptables save

to save the IPtables rules.