fedora10에서 UDP 포트 오픈

bakdorazi의 이미지

페도라10에 net-snm5.5 버젼을 깔았는데요.
selinux, 방화벽 다 내리고 iptable에 PORT OPEN 해주고 했는데 IPTABLE설정에서 문제가 생기네요...

[root@sychoi sychoi]# iptables -A INPUT -p udp --dprot 161 -j ACCEPT
[root@sychoi sychoi]# iptables -A INPUT -p tcp --dprot 161 -j ACCEPT

라고 명령을 내리면 아무 문제 없습니다.

그러나
[root@sychoi sychoi]# vi /etc/sysconfig/iptables

# Generated by iptables-save v1.4.1.1 on Tue Dec 15 19:27:10 2009
*filter
:INPUT ACCEPT [113726:161552348]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [25885:1199685]
-A INPUT -s 192.168.26.0/24 -p udp -m udp --dport 22 -j ACCEPT
-A INPUT -s 192.168.26.0/24 -p tcp -m tcp --dport 22 -j ACCEPT
COMMIT
# Completed on Tue Dec 15 19:27:10 2009

위와 같이 제가 열어준 161 포트가 보이지 않습니다.

그래서 아래와 같이 명령을 내렸더니 에러가 나는군요

아래는 에러 메시지 입니다.

[root@sychoi sychoi]# /etc/sysconfig/iptables -A INPUT -p udp --dport 161 -J ACCEPT
/etc/sysconfig/iptables: line 2: *filter: command not found
/etc/sysconfig/iptables: line 3: :INPUT: command not found
/etc/sysconfig/iptables: line 4: :FORWARD: command not found
/etc/sysconfig/iptables: line 5: :OUTPUT: command not found
/etc/sysconfig/iptables: line 6: -A: command not found
/etc/sysconfig/iptables: line 7: -A: command not found
/etc/sysconfig/iptables: line 8: COMMIT: command not found

또한 iptable에 udp오픈을 직접 적어주기 위해 아래의 코드를 삽입하면

[root@sychoi sychoi]# /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 161 -j ACCEPT

아래와 같은 에러가 뜹니다.

[root@sychoi snmp]# vi /etc/sysconfig/iptables
[root@sychoi snmp]# /etc/init.d/iptables restart
iptables: 방화벽 규칙을 지웁니다: [ OK ]
iptables: chain을 ACCEPT 규칙으로 설정 중: filter [ OK ]
iptables: 모듈을 언로드하는 중: [ OK ]
iptables: 방화벽 규칙 적용 중: iptables-restore v1.4.1.1: Couldn't load match `stat':/lib/xtables/libipt_stat.so: cannot open shared object file: No such file or directory

Error occurred at line: 9
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
[실패]

snmp뿐만이 아니라 ftp도 깔고 다른 설정은 다해줬는데 포트 오픈이 안돼서 사용을 못하고 있습니다
뭐가 문제 일까요. 고수님들 답변을 기다립니다.

monovision의 이미지

/etc/sysconfig/iptables 파일의 룰이 정상적이지 않으면 iptables 관련 스크립트(/etc/init.d/iptables 등) 에서 에러를 뿜어냅니다.
( cli 에서는 iptables -A INPUT -j ACCEPT 등의 커맨드가 먹지만 iptables-restore 로 복원시 사용하는 config 파일에서는 모든 체인등이 정상적으로 올라가 있어야 합니다. ~~)

iptables-save > iptables 로 현재의 설정을 저장하고 해당 파일을 vi 등으로 수정 후 iptables-restore < iptables 로 정상적으로 올라오는지 TEST 해봅니다.
그리고 완성된 config 를 /etc/sysconfig/iptables 로 복사해주시면 됩니다.

CLI 에서 iptables 룰을 변경하였다고 하여 /etc/sysconfig/iptables 파일이 수정이 되는 것은 아닙니다.

취기가 좀 올라와서 횡설수설하는데....

CLI 에서 원하시는 룰들을 모두 설정 후 iptables-save 커맨드로 config 백업 후 실제 적용시에는 iptables-restore 를 이요하면 되고....
부팅시에 적용을 하기 위해서는 /etc/sysconfig/iptables 에 config 를 복사하시거나 rc.local 등에 스크립트를 작성해 주시면 됩니다.

/etc/init.d/iptables 스크립트도 한 번 분석해 보시면 재미있으실 겁니다. ^^

그럼 전 이만 잠이나...;;;

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.