iptables Help
Hi!
I was wondering if someone could help me with iptables. I have a server and I need to block all IPs except for: the blocks: 128.96.*.* and 67.215.52.1 This is what I have so far: (at least I think what is correct) iptables -A INPUT -s ! 128.96.0.0/16 -j DROP iptables -A INPUT -s 67.215.52.1 -j ACCEPT There are no other rules in the chain. Any help would be appreciated. |
Welcome to LQ! :)
Quote:
I would suggest this approach instead: Code:
iptables -A INPUT -s 128.96.0.0/16 -j ACCEPT Code:
iptables -A INPUT -s 128.96.0.0/16 -j ACCEPT |
Oh, I sees!
Thanks! =] Just on a side note, for my information. Say is it possible to only allow port 25 be accessed from 128.96.*.* and 67.215.52.1, while all the other port could be accessed by everyone? Cheers |
Quote:
Code:
iptables -A INPUT -p TCP --dport ! 25 -s 128.96.0.0/16 -j DROP My next examples assume the policy is set to ACCEPT. Another way might me: Code:
iptables -A INPUT -p TCP --dport 25 -s 128.96.0.0/16 -j ACCEPT Code:
iptables -A INPUT -s 128.96.0.0/16 -j ACCEPT |
All times are GMT -5. The time now is 02:50 PM. |