Easy way to reject all incoming packets except from certain IPs?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Preston Crawford wrote:
> Is there an easy way to reject all incoming packets except those that
> come from certain IPs? I can't find any way via iptables or via the GUI

See this great iptables example:

http://oceanpark.com/notes/firewall_example.html

In your case it'll be a whole lot simpler, all you'll need are the
initial drop rules for all traffic, then a rule or two to allow XYZ ip in.

-te

pseudo:

iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -F INPUT
iptables -F OUTPUT
iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
# your IPs below
iptables -A INPUT -i eth0 -s x.y.z.s/32 -j ACCEPT


-- 
Troy Engel | Systems Engineer
Fluid, Inc | http://www.fluid.com

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux