iptables 설치 후 네트워크 프린터가 안되요

orionkhw의 이미지

안녕하세요. 겨우 이틀 삽질해도 안되길래 이렇게 고수님들께 또 살려달라고 발버둥칩니다.
다름이 아니라 다른 컴(win 2000)에 HP프린터가 연결되어 있습니다.
리눅스 9.0이라서 프린터 설정에 큰 무리없이 연결이 되었습니다.

그런데!
iptables을 사용하려고... 고수님들의 말을 들어보니 ssh, ftp, telnet등 자기가 꼭 쓸 거 말고는 막으라시길래 막았습니다.

그러자!
잘되던 프린터가 안되는 것이었습니다.

분명 프린터를 위한 포트도 막힌 게 틀림없다는 생각에 별 포트 다 열어봤습니다.

#!/bin/sh
#init chains : all ports opened
/sbin/iptables -F

#At first, initial condition
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -P FORWARD DROP

#allow localhost traffic
/sbin/iptables -A INPUT -i lo -j ACCEPT

#establish lan network
/sbin/iptables -A INPUT -i eth0 -p tcp ! --syn -j ACCEPT

#answer DNS request
/sbin/iptables -A INPUT -i eth0 -p tcp --source-port 53 -j ACCEPT
/sbin/iptables -A INPUT -i eth0 -p udp --source-port 53 -j ACCEPT

#refuse certification-connection(or your server will be timeout)
/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 113 -j REJECT

#accept echo or excessed icmp packets
/sbin/iptables -A INPUT -p icmp --icmp-type 0 -j ACCEPT
/sbin/iptables -A INPUT -p icmp --icmp-type 3 -j ACCEPT
/sbin/iptables -A INPUT -p icmp --icmp-type 11 -j ACCEPT

# allow PRINT port (spool:515, internet printing 631, smb tool:901, ipx:213)
# netbios-ns:137, netbios-dgm:138, netbios-ssn:139 for SWAT(901port)
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 137 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 137 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 138 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 138 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 139 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 139 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 901 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 515 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 515 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 631 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 631 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 213 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 213 -j ACCEPT

#allow X terminal
/sbin/iptables -A INPUT -p TCP -s other_com --dport 6000 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s other_com --dport 6000 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s other_com --dport 7100 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s other_com --dport 7100 -j ACCEPT

#allow telnet port
/sbin/iptables -A INPUT -p TCP -s other_com --dport 23 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s other_com --dport 23 -j ACCEPT

# allow SSH only special server
/sbin/iptables -A INPUT -p TCP -s other_com --dport 22 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s other_com --dport 22 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s other_com --dport 22 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s other_com --dport 22 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s other_com --dport 22 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s other_com --dport 22 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s other_com --dport 22 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s other_com --dport 22 -j ACCEPT

# allow WWW port
/sbin/iptables -A INPUT -p TCP --dport 80 -j ACCEPT
/sbin/iptables -A INPUT -p UDP --dport 80 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --syn --dport ! 80 -j DROP

이렇게 엄청나게 해봤는데... ㅠ.ㅠ
프린트가 안되용. 헬프 미~

참고로 ip적으면 해킹당할까봐 안썼어영. 벌써 세번째 당해서 꼭 이거 해야되영~ :(

무혼인형의 이미지

orionkhw wrote:
다름이 아니라 다른 컴(win 2000)에 HP프린터가 연결되어 있습니다.
리눅스 9.0이라서 프린터 설정에 큰 무리없이 연결이 되었습니다.

말씀하신 내용 만으로 정확한 네트워크 상황이 이해는 안가지만, 제 추측으로는 ...

1. 프린터가 Win2k사용하는 PC에 연결되어 있다.(공유됨)
2. iptables를 사용한 이후로 레드햇9.0을 사용하고 있는 PC에서 프린터를 사용 할 수 없다.

인 것 같습니다.

orionkhw wrote:

# allow PRINT port (spool:515, internet printing 631, smb tool:901, ipx:213)
# netbios-ns:137, netbios-dgm:138, netbios-ssn:139 for SWAT(901port)
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 137 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 137 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 138 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 138 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 139 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 139 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 901 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 515 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 515 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 631 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 631 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 213 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 213 -j ACCEPT

그렇다면 이 경우에... -s win2000ip 가 아니라 -d win2000ip 가 되어야 하지 않을까 생각되네요 :?
orionkhw의 이미지

읽어주셔서 감사합니다.
상황을 다시 설명드리면 iptables을 실행하기 전에는 리눅스에서 윈2000으로의 프린트가 되었습니다. 그런데 iptables을 위와 같은 식으로 한 후 실행하면 프린트가 되지 않습니다. ^^ 어쩌죠.

리눅스!

무한포옹의 이미지

orionkhw wrote:


# allow PRINT port (spool:515, internet printing 631, smb tool:901, ipx:213)
# netbios-ns:137, netbios-dgm:138, netbios-ssn:139 for SWAT(901port)
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 137 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 137 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 138 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 138 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 139 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 139 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 901 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 515 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 515 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 631 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 631 -j ACCEPT
/sbin/iptables -A INPUT -p TCP -s win2000ip --dport 213 -j ACCEPT
/sbin/iptables -A INPUT -p UDP -s win2000ip --dport 213 -j ACCEPT

에서 --dport 를 --sport 로 바꾸세요 그럼 될 겁니다.

--dport 는 레드햇 9.2 박스의 각 포트로 '향'하는 겁니다.
--sport 로 w2k의 각 포트에서 '출발'한 패킷을 가리키는 걸로 바꿔야 하죠.

-------------------------------
== warning 대부분 틀린 얘기입니다 warning ===

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.