Below are steps to follow on Linux host to update iptables if you want to block/reject all traffic to that Linux host except from one particular IP address.
1. Run below command to accept all connections locally within the Linux host.
2. Run below command to allow traffic from a particular IP address. Replace IP address in below command with the IP address from which you want to receive traffic.
3. Run below command to block all the traffic coming which does not meet criteria in above iptable rules.
All Linux Operating Systems
1. Run below command to accept all connections locally within the Linux host.
iptables -I INPUT -s 127.0.0.1 -j ACCEPT
2. Run below command to allow traffic from a particular IP address. Replace IP address in below command with the IP address from which you want to receive traffic.
iptables -I INPUT -s ip-address -j ACCEPT
3. Run below command to block all the traffic coming which does not meet criteria in above iptable rules.
iptables -P INPUT DROP
Products to which Article Applies
All Linux Operating SystemsAdditional References
https://linux.die.net/man/8/iptables
tarun boyella
No comments:
Post a Comment