nat 설정 질문입니다

superscalar의 이미지

지금 기계들 구조가
기계 A의 eth1에 WAN, eth0에 내부네트워크가 물려있습니다.
외부에서 A의 3333포트로 접속하면 내부 기계 192.168.1.200의 80포트로 연결하고자 합니다.
즉 외부에서 192.168.1.200에서 서비스하는 웹페이지를 볼 수 있게 하고자 합니다.

여러 글들을 찾아 공부해보고 설정을 해도 잘 되지 않아
내부 기계 사이에서 우선 nat 테스트를 해보고 있습니다.

내부의 다른 기계에서 A의 eth0의 내부 IP인 182.158.1.10의 3333포트로 접속하면
192.168.1.100의 3333포트로 포워딩하고자 합니다.

iptables 설정을

EXTERN_INT="eth1"
INTERN_INT="eth0"
IPTABLES="/sbin/iptables"

$IPTABLES -F
$IPTABLES -A INPUT -p ALL -i $EXTERN_INT -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -o $EXTERN_INT -j ACCEPT
$IPTABLES -A INPUT -p ALL -i $INTERN_INT -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -o $INTERN_INT -j ACCEPT

$IPTABLES -t nat -A PREROUTING -p tcp -i $INTERN_INT -d 192.168.1.5 --dport 3333 --sport 1024:65535 -j DNAT --to 192.168.1.100:3333

로 하고

iptables -t nat -L -v 명령 결과는 다음과 같습니다.

Chain OUTPUT (policy ACCEPT 1 packets, 140 bytes)
pkts bytes target prot opt in out source destination

Chain POSTROUTING (policy ACCEPT 1 packets, 140 bytes)
pkts bytes target prot opt in out source destination

Chain PREROUTING (policy ACCEPT 20 packets, 2856 bytes)
pkts bytes target prot opt in out source destination
0 0 DNAT tcp -- eth0 any anywhere 192.168.1.5 tcp spts:1024:65535 dpt:3333 to:192.168.1.100:3333

그래서 100번 기계에서 포트를 열어놓고 내부의 다른 기계에서 192.168.1.5:3333으로 접속하면
접속이 되지 않고 connection timed out이 발생합니다.

문제의 원인이 무엇일까요?

감사합니다.

superscalar의 이미지

기계 A와 100번 기계에서 /sbin/iptables -L로 보니깐
테스트 소켓프로그램 실행할 때마다
두 기계 모두 해당 체인에서 패킷카운트가 올라갑니다.

superscalar의 이미지

생각해보니 내부 네트워크에서는 nat의 의미가 없겠군요
클라이언트 측에서는 기대하지 않은 호스트로부터 패킷을 받을테니까요 ㅠㅠ

visualplus의 이미지

네 그래서 보통 웹서버를 DMZ로 뺀 다음 게이트웨이 장비에서 DNAT, SNAT을 모두 처리합니다

bushi의 이미지

참고만 하세요 http://kldp.org/node/108047

개인적으론 http://kldp.org/node/103423 처럼 간단한 유저모드 데몬들을 더 선호합니다.

[bushi@rose ~]$ yum info rinetd
Loaded plugins: presto, refresh-packagekit
Available Packages
Name       : rinetd
Arch       : i686
Version    : 0.62
Release    : 9.fc12
Size       : 22 k
Repo       : fedora
Summary    : TCP redirection server
URL        : <a href="http://www.boutell.com/rinetd
License" rel="nofollow">http://www.boutell.com/rinetd
License</a>    : GPLv2+
Description: rinetd is a daemon which redirects TCP connections from one IP
           : address and port to another IP address and port. This daemon is
           : often used to access services behind a firewall.
 
[bushi@rose ~]$

OTL

댓글 달기

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