vim vts_fire_init <---피일을 새로열고 실행할명령어 작성 기록
-----------------------vts_fire 피일내용---------------------
case "$1" in
start)
iptables -A INPUT -p tcp --dport 3306 -s 61.78.1.0/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 3306 -s 121.160.1.0/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 3306 -s 121.160.2.0/24 -j ACCEPT
iptables -A INPUT -i eth2 -p tcp --dport 3306 -j REJECT
iptables -A INPUT -p tcp --dport 443 -s 61.78.1.0/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -s 121.160.1.0/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -s 121.160.2.0/24 -j ACCEPT
iptables -A INPUT -i eth2 -p tcp --dport 443 -j REJECT
iptables -A INPUT -p tcp --dport 22 -s 61.78.1.0/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -s 121.160.1.0/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -s 121.160.2.0/24 -j ACCEPT
iptables -A INPUT -i eth2 -p tcp --dport 22 -j REJECT
;;
stop)
iptables -F
;;
*)
echo "usage {start|stop}"
exit 1
;;
esac
exit 0
-------------------------end---------------------------------------------------
mv vts_fire_init /etc/init.d/ <---파일 이동 또는 카피
cd /etc/init.d
chmod 755 vts_fire_init <-------권한허가
update-rc.d vts_fire_init defaults <--- 부팅시에, 종료시에 실행되게한다
vim /etc/rc0.d/S20vts_fire_init <-------확인
vim /etc/rc0.d/K20vts_fire_init <------확인
service vts_fire_init start <---명령어로 시험
vts_fire_init start <---명령어로시험
vts_fire_init stop <---테스트
./vts_fire_init stop <---테스트
./vts_fire_init start <---테스트
iptables -L <-----확인
재부팅 확인
-------------------------------------------------------------------------------