질문&답변
클라우드/리눅스에 관한 질문과 답변을 주고 받는 곳입니다.
리눅스 분류

iptables가 실행이 안됩니다.

작성자 정보

  • 임정보 작성
  • 작성일

컨텐츠 정보

본문

iptables를 최신으로 업글하려고 기존에 깔려있던 RPM버전을 지우고 1.3.5 소스로 깔았는데 서비스를 실행하려고 하면 이렇게 뜹니다.

# service iptables start
iptables: unrecognized service

 

 

# iptables -A INPUT -p tcp --dport  21 -j ACCEPT
iptables v1.3.5: Unknown arg `--dport'
Try `iptables -h' or 'iptables --help' for more information.

 

설치는 이런식으로 했습니다.

/usr/src/iptables 에서

#make KERNEL_DIR=/usr/src/linux
#make BINDIR=/usr/bin LIBDIR=/usr/lib MANDIR=/usr/man install
#make install-devel
 
# iptables -V
iptables v1.3.5 //버전확인은 됐습니다.
 
답변 부탁드립니다.

관련자료

댓글 4

장병훈님의 댓글

  • 장병훈
  • 작성일
iptables 데몬을 다시 시작 해보세요.
스크립트 인스톨할때 의존성(dependency)에러 라던가 설치 과정중에 에러 메세지가 보이지 않는다면 정상적으로 인스톨 하신것 같습니다.

리눅스에서 유의 하셔야 할점은 스크립트가 자동으로 올라오는 경우가 qmail 데몬하고 cron or rc.local / rc.init 에 등록 된 거라던가 .profile정도에 list up 되지 않는 이상 /proc에 자동으로 올라오는 경우는 거의 없다고 생각하시면 됩니다.

1. "service iptables restart" 명령이나 "/etc/rc.d/init.d/iptables restart" 하시면 됩니다.
2. 콘솔(명령어 입력하는창)에서 "setup" 이라는 명령을 내리신 다음에 하단에서 2번째 쯤에 보시면 system service or 서비스 or 시스템 서비스 라고 써있는 메뉴를 볼수 있으실겁니다.
3. list up 되는 서비스들 중에 iptables 라디오 박스(체크 박스)에 체크가 되어있으신지 확인 해보시기 바랍니다.
되어있지 않으시면 체크해주시고 "/etc/rc.d/init.d/xinetd restart" 명령을 이용하여 슈퍼데몬을 재시작 해 주시기 바랍니다.
** 라디오 박스는 마우스 좌클릭 or 스페이스바로 토클이 가능합니다. **

*참고 사항*
service는 /etc/rc.d/init.d/를 alias(참조) 합니다. 다시말해 "service 명령"을 입력하면 /etc/rc.d/init.d/ 디렉토리 아래에서 파일을 찾아서 실행 시켜 줍니다.

영어 남발하는것을 싫어 하지만 정확한 의미 전달을 위해 일부 영어 부분을 혼용해서 표기했습니다.
내용 부분중에 " " 더블퀘스쳔(쌍따옴표 안에 있는 부분은 콘솔 명령어 입니다.)

임정보님의 댓글

  • 임정보
  • 작성일
답글 감사합니다.

리스타트도 안됩니다.
# service iptables restart
iptables: unrecognized service

기존에 깔려있는걸 rpm -e --nodeps iptables 이렇게 지워서 /etc/rc.d/init.d/ 안에 iptables는 없네요.
# whereis iptables
iptables: /usr/src/iptables/iptables.c /usr/src/iptables/iptables.d /usr/src/iptables/iptables.o /usr/src/iptables/iptables /usr/src/iptables/iptables.8 /usr/bin/iptables /usr/lib/iptables /usr/man/man8/iptables.8

제가 설치를 잘못한 걸까요?

장병훈님의 댓글

  • 장병훈
  • 작성일
iptables-1.3.15은 1.3.14 버전과 달리 요구 하는 리눅스 커널 버전이 올라 간것 같습니다. 현재 사용하는 리눅스의 커널 버전을 알고 싶습니다.
This version requires kernel >= 2.4.0    최소 요구 사항
This version recommends kernel >= 2.4.18  최적화 사항
이라고 나오네요. 혹시 커널 버전이 낮은것이 아닌지 알고 싶습니다.

장병훈님의 댓글

  • 장병훈
  • 작성일
설치 방법 iptables 1.3.5
참조 문서 : http://www.linuxfromscratch.org/blfs/view/svn/postlfs/iptables.html
설치 스크립트는

cd /usr/src/iptables 가셔서

make KERNEL_DIR=/usr/src/linux <x86머신이 아닐경우 사용
make PREFIX=/usr LIBDIR=/lib BINDIR=/sbin
make PREFIX=/usr LIBDIR=/lib BINDIR=/sbin install

위 3가지 명령을 각각 실행한후
/lib/iptables 디렉토리와
iptables, iptables-restore, iptables-save and ip6tables의 프로그램 파일
libip6t_*.so and libipt_*.so 들이 보이시면 성공 한것 입니다.
아래는 iptables 1.3.5버전의 데몬 스크립트 입니다.


아래 주소는 부트스크립트 모음 파일 입니다.
http://www.linuxfromscratch.org/blfs/downloads/svn/blfs-bootscripts-20060910.tar.bz2
http://www.linuxfromscratch.org/blfs/view/svn/introduction/bootscripts.html

iptables 데몬으로 돌리기위한 스크립트 /etc/rc.d/init.d 디렉토리에 iptables란 이름으로
파일로 존재햐야 합니다.
---------------------------------------------------------------------------------
#!/bin/sh
# Begin $rc_base/init.d/iptables

. /etc/sysconfig/rc
. $rc_functions

case "$1" in
start)
if [ -x /etc/rc.d/rc.iptables ]; then
boot_mesg "Starting iptables..."
loadproc /etc/rc.d/rc.iptables
fi
;;

lock)
boot_mesg "Locking system iptables firewall..."
/sbin/iptables --policy INPUT DROP
/sbin/iptables --policy OUTPUT DROP
/sbin/iptables --policy FORWARD DROP
/sbin/iptables --flush
/sbin/iptables -t nat --flush
/sbin/iptables -t mangle --flush
/sbin/iptables --delete-chain
/sbin/iptables -t nat --delete-chain
/sbin/iptables -t mangle --delete-chain
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A OUTPUT -o lo -j ACCEPT
boot_mesg_flush
;;

clear)
boot_mesg "Clearing system iptables iptables..."
/sbin/iptables --policy INPUT ACCEPT
/sbin/iptables --policy OUTPUT ACCEPT
/sbin/iptables --policy FORWARD ACCEPT
/sbin/iptables --flush
/sbin/iptables -t nat --flush
/sbin/iptables -t mangle --flush
/sbin/iptables --delete-chain
/sbin/iptables -t nat --delete-chain
/sbin/iptables -t mangle --delete-chain
boot_mesg_flush
;;

status)
/sbin/iptables --numeric --list
/sbin/iptables -t nat --numeric --list
/sbin/iptables -t mangle --numeric --list
;;

*)
echo "Usage: $0 {start|clear|lock|status}"
exit 1
;;
esac

# End $rc_base/init.d/iptables
--------------------------------------------------------------------

공지사항


뉴스광장


  • 현재 회원수 :  60,033 명
  • 현재 강좌수 :  35,783 개
  • 현재 접속자 :  138 명