Skip to content

Commit 9e39162

Browse files
committed
add iptables usage.
1 parent 6ed0a9a commit 9e39162

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

bashrc/setup_iptables.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
# allow the network 10.111.11.0/24 and not allow other network connect port 9200
4+
iptables -I INPUT -p tcp --dport 9200 -j DROP
5+
iptables -I INPUT -s 10.111.11.0/24 -p tcp --dport 9200 -j ACCEPT
6+
7+
iptables -I INPUT -p udp --dport 9200 -j DROP
8+
iptables -I INPUT -s 10.111.11.0/24 -p udp --dport 9200 -j ACCEPT
9+
10+
# allow the network 10.111.11.0/24 and not allow other network connect port 9300
11+
iptables -I INPUT -p tcp --dport 9300 -j DROP
12+
iptables -I INPUT -s 10.111.11.0/24 -p tcp --dport 9300 -j ACCEPT
13+
14+
iptables -I INPUT -p udp --dport 9300 -j DROP
15+
iptables -I INPUT -s 10.111.11.0/24 -p udp --dport 9300 -j ACCEPT
16+
17+
service iptables save && /etc/init.d/iptables restart && iptables -L -n

0 commit comments

Comments
 (0)