[질문]iptables 설정시 문제가 있습니다.

이병남의 이미지

안녕하세요.
바쁘시더라도 한수 부탁드립니다.

"iptables -P INPUT -j DROP"명령을 하면 아래와 같은 메세지가 출력 됩니다.
===============================================

[root@localhost rc.d]# iptables -P INPUT -j DROP
iptables v1.2.7a: -P requires a chain and a policy
Try `iptables -h' or 'iptables --help' for more information.
[root@localhost rc.d]#

===============================================

INPUT 체인의 기본정책을 모든 것 DROP 할려는데 되지 않는것 같습니다.
초보라서 잘 이해가 되지 않습니다.
한수 다시 부탁드립니다.

감사 합니다.

emptysky의 이미지

iptables -A INPUT -j DROP

『 아픔은.. 아픔을 달래줄 약이 무엇인지 알면서도 쓰지 못할 때 비로소 그 아픔의 깊이를 알수가 있음이다. 』
『 for return...』

yoocj9의 이미지

iptables -P INPUT DROP

이 맞을거 같네요.

익명 사용자의 이미지

고수님들 덕분에 해결 했습니다.
감사 합니다.
추워지는 날씨에 건강들 조심 하세요.
다시 한번 감사드립니다.

익명 사용자의 이미지

질문이 넘 많아 죄송 합니다.

답글 주신대로 했습니다.

"iptables -P INPUT DROP" 으로 모든 포트를 막았습니다.

그런데 아래와 같이 열려 있는 포트는 딸랑 2개 밖에 없는데,

인터넷도 잘되고, 소리바다도 잘 되고, 당나귀도 잘 되는 이유는 뭔가요?

기본적으로 모든 포트를 막으면 안 되야 되는것 아닌지 싶어...?

netstat -na 로 포트를 확인 하면 아래와 같이 Foreign Address 포트가 열려 있는데

이유를 알 수가 없습니다.

===============================================

C:\>netstat -na

Active Connections

Proto Local Address Foreign Address State
TCP 0.0.0.0:25 0.0.0.0:0 LISTENING
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:443 0.0.0.0:0 LISTENING
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP 0.0.0.0:1027 0.0.0.0:0 LISTENING
TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING
TCP 0.0.0.0:4662 0.0.0.0:0 LISTENING
TCP 0.0.0.0:7675 0.0.0.0:0 LISTENING
TCP 0.0.0.0:7677 0.0.0.0:0 LISTENING
TCP 0.0.0.0:22322 0.0.0.0:0 LISTENING
TCP 127.0.0.1:1028 0.0.0.0:0 LISTENING
TCP 127.0.0.1:1034 0.0.0.0:0 LISTENING
TCP 127.0.0.1:43958 0.0.0.0:0 LISTENING
TCP 192.168.0.2:139 0.0.0.0:0 LISTENING

TCP 192.168.0.2:1125 192.168.0.1:23 ESTABLISHED
TCP 192.168.0.2:1426 211.236.182.98:4661 ESTABLISHED
TCP 192.168.0.2:1428 195.245.244.243:4661 ESTABLISHED
TCP 192.168.0.2:1435 221.143.49.20:80 ESTABLISHED
TCP 192.168.0.2:1436 221.143.49.20:80 ESTABLISHED
TCP 192.168.0.2:1438 221.143.49.87:80 ESTABLISHED
TCP 192.168.0.2:1450 221.143.49.87:80 ESTABLISHED
UDP 0.0.0.0:445 *:*
UDP 0.0.0.0:500 *:*
UDP 0.0.0.0:1025 *:*
UDP 0.0.0.0:1026 *:*
UDP 0.0.0.0:1415 *:*
UDP 0.0.0.0:3456 *:*
UDP 0.0.0.0:4500 *:*
UDP 0.0.0.0:4672 *:*
UDP 0.0.0.0:7674 *:*
UDP 0.0.0.0:8888 *:*
UDP 0.0.0.0:22321 *:*
UDP 127.0.0.1:123 *:*
UDP 127.0.0.1:1038 *:*
UDP 127.0.0.1:1151 *:*
UDP 127.0.0.1:1416 *:*
UDP 127.0.0.1:1431 *:*
UDP 127.0.0.1:1900 *:*
UDP 192.168.0.2:123 *:*
UDP 192.168.0.2:137 *:*
UDP 192.168.0.2:138 *:*
UDP 192.168.0.2:1900 *:*

C:\>

===============================================

"iptables -P INPUT DROP" 하기전 두개의 포트는 열어 놓고 "iptables -P INPUT DROP"

명령어를 주고난 후의 iptable 입니다.

[root@localhost root]# iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:telnet
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@localhost root]#

kall의 이미지

leewin wrote:
"iptables -P INPUT DROP" 으로 모든 포트를 막았습니다.
그런데 아래와 같이 열려 있는 포트는 딸랑 2개 밖에 없는데,
인터넷도 잘되고, 소리바다도 잘 되고, 당나귀도 잘 되는 이유는 뭔가요?

Masquerading을 사용하신다면 관련 정책은 INPUT이 아니라 FORWARD를 통해서 제어해야 합니다.

leewin wrote:
netstat -na 로 포트를 확인 하면 아래와 같이 Foreign Address 포트가 열려 있는데 이유를 알 수가 없습니다.
===============================================
C:\>netstat -na
Active Connections
Proto Local Address Foreign Address State
TCP 0.0.0.0:25 0.0.0.0:0 LISTENING
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
....중략....
C:\>

패킷이 나가거나 말거나 데몬이 떠있으면 LISTENING하게 됩니다.
LISTEN하지 않게 하려면 관련 프로그램을 내리는 수 밖에 없습니다.

----
자신을 이길 수 있는자는
무슨짓이든 할수있다..
즉..무서운 넘이란 말이지 ^-_-^
나? 아직 멀었지 ㅠㅠ

댓글 달기

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