anotherjesse (owner)

Revisions

gist: 163754 Download_button fork
public
Public Clone URL: git://gist.github.com/163754.git
Embed All Files: show embed
iptables for a range of IPs #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
 
echo "Flushing iptables..."
iptables -F
 
echo "SSH Allowed"
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
 
echo "allow from localhost"
iptables -A INPUT -i lo -j ACCEPT
 
echo "allow from 192.168.1.1-100"
iptables -I INPUT 3 -i eth0 -m iprange --src-range 192.168.1.1-192.168.1.100 -j ACCEPT
 
echo "allow all pings"
iptables -I INPUT 5 -p icmp -j ACCEPT
 
# Set default policies for INPUT, FORWARD and OUTPUT chains
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
 
# Accept packets belonging to established and related connections
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT