¹öÃò¾ó¹Ú½º¿¡¼´Â ½ÇÇàÀÌ ÀߵǴµ¥ vmware¿¡¼´Â 13¹øÂ° ÁÙ¿¡¼ ¿À·ù³ª³×¿ä ;; ¹¹°¡ ¹®Á©±î¿ä
¾Æ·¡´Â ½ºÅ©¸³Æ® ³»¿ëÀÔ´Ï´Ù.
-------------------------------------------------------------------------------------------------------------------------------
#! /bin/bash
while [ : ]
do
echo "============================================================"
echo -n -e "Æ÷Æ®Æ÷¿öµù ±â´É¼±ÅÃ\n"
echo -n -e "============================================================\n"
echo -n -e "1)¿¼öÀÖ´ÂÆ÷Æ®¸ñ·Ï \n2)¿øÇϴ¼ºñ½º Æ÷Æ®Æ÷¿öµù \n3)¼öµ¿À¸·Î Æ÷Æ®Æ÷¿öµù \n4)Æ÷Æ®Æ÷¿öµù »óÅ \n5)Áö¿ì·Á´ÂÆ÷Æ® \n6)NAT¼³Á¤ \n7)Àç½ÃÀÛ \n8)ÀúÀå \n0)Á¾·á\n"
echo -n -e "============================================================\n"
read select
case $select in <---À̺κР¿À·ù³³´Ï´Ù.
1)
echo"============================================================"
echo"Æ÷Æ®Æ÷¿öµù°¡´ÉÇÑ ¸ñ·Ï È®ÀÎ"
echo -e "
1)DNS 53
\n2)SMTP 25
\n3)POP3 109
\n4)SSH 22
\n5)FTP 21,20
\n6)DHCP 67,68
\n7)HTTP 80
\n8)HTTPS 443
\n9)IMAP 143
\n10)SNMP(UDP) 161 162
\nSSL À§ÀÇ (º¸¾ÈµÈ)
\n11)FTP 990
\n12)IMAP4 993
\n13)POP3 995
\n14)MYSQL 3306"
;;
2)
echo -e "
1)DNS 53
\n2)SMTP 25
\n3)POP3 109
\n4)SSH 22
\n5)FTP 21,20
\n6)DHCP 67,68
\n7)HTTP 80
\n8)HTTPS 443
\n9)IMAP 143
\n10)SNMP(UDP) 161 162
\nSSL À§ÀÇ (º¸¾ÈµÈ)
\n11)FTP 990
\n12)IMAP4 993
\n13)POP3 995
\n14)MYSQL 3306
\n 0) µÚ·Î°¡±â"
echo -n " Æ÷Æ®Æ÷¿öµùÇÒ ¼ºñ½º¼±Åà : "
read n
case $n in
1) iptables -t filter -A INPUT -p udp --dport 53 -j ACCEPT
;;
2)iptables -t filter -A INPUT -p tcp --dport 25 -j ACCEPT
;;
3)iptables -t filter -A INPUT -p tcp --dport 109 -j ACCEPT
;;
4)iptables -t filter -A INPUT -p tcp --dport 22 -j ACCEPT
;;
5)iptables -t filter -A INPUT -p udp --dport 21,20 -j ACCEPT
;;
6)iptables -t filter -A INPUT -p tcp --dport 67,68 -j ACCEPT
;;
7)iptables -t filter -A INPUT -p tcp --dport 80 -j ACCEPT
;;
8)iptables -t filter -A INPUT -p tcp --dport 433 -j ACCEPT
;;
9)iptables -t filter -A INPUT -p tcp --dport 143 -j ACCEPT
;;
10)iptables -t filter -A INPUT -p udp --dport 161,162 -j ACEEPT
;;
11)iptables -t filter -A INPUT -p udp --dport 990 -j ACCEPT
;;
12)iptables -t filter -A INPUT -p udp --dport 993 -j ACCEPT
;;
13)iptables -t filter -A INPUT -p udp --dport 995 -j ACCEPT
;;
14)iptables -t filter -A INPUT -p udp --dport 3306 -j ACCEPT
;;
0)echo "À§·Î°¡±â"
;;
*)echo "À߸øµÈ°ªÀÔ·ÂÇϼ̾î¿ä"
exit;; esac
;;
3)
echo "¼öµ¿ÀÔ·ÂÀÔ´Ï´Ù."
echo -n "udp,tcp ¼±Åà ÀÔ·Â : "
read a
echo -n "Æ÷Æ®ÀÔ·Â: "
read b
iptables -t filter -A INPUT -p $a --dport $b -j ACCEPT
;;
4)
echo -n -e "iptables »óÅÂ\n"
iptables -t filter -L
;;
5)
echo "¾Æ·¡¿¡¼ ¹øÈ£¼±ÅÃÇϼ¼¿ä"
iptables -t filter -L --line-num
echo -n -e "Áö¿ï ¹øÈ£ ¼±ÅÃÇϼ¼¿ä : "
read c
iptables -t filter -D INPUT $c
;;
6)
echo -n -e "nat ¼³Á¤(ÀÔ·Â2°³,nat¼³Á¤ÇÒip´ë¿ª/24,¿ÜºÎ·Î¿¬°áµÈAP)\n"
read e
read f
iptables -t nat -A POSTROUTING -s $e -o $f -j MASQUERADE
;;
7)
echo -n -e "Àç½ÃÀÛÇÕ´Ï´Ù~~~\n"
service iptables restart
;;
8)
echo -n -e "ÀúÀåÇÕ´Ï´Ù. "
iptabes-save > iptables
mv /etc/sysconfig/iptables /etc/sysconfig/iptables.bak
cp /root/iptables /etc/sysconfig/iptables
;;
0)
echo -n -e "Á¾·áÇÕ´Ï´Ù.\n"
exit;;
esac
done