IPTables는 리눅스에 기본적으로 들어가 있는 방화벽이다.
커널의 네트워크 관련 옵션에서 NetFilter로 모듈들이 있어야 제대로 동작을 하는데,
현재 거의 대부분의 리눅스 또는 우분투에서 지원되고 있다.
그러면 아래와 같이 간단한 몇 가지 명령을 주어 방화벽 설정을 할 수 있다.
sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -j DROP
sudo iptables -I INPUT 1 -i lo -j ACCEPT
sudo iptables -I INPUT 5 -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
sudo iptables -L -v
sudo sh -c "iptables-save > /etc/iptables.rules"
vi /etc/network/interfaces
위의 내용에 아래의 두줄을 추가
pre-up iptables-restore < /etc/iptables.rules
post-down iptables-save -c > /etc/iptables.rules
그러면 매번 부팅할 때 적용된다.
출처
http://mcchae.egloos.com/5202741
'OS > Linux' 카테고리의 다른 글
Ubuntu 서버 세팅 A to Z (0) | 2013.08.31 |
---|---|
CentOS에서 Apache 재시작 (1) | 2012.03.19 |
서버 시간 자동설정 (0) | 2012.03.19 |
JDK 설치 1.6 CentOS5 (0) | 2012.03.19 |