iptables MASQUERADE

pwy1575의 이미지

안녕하세요

iptables nat 에 대해 문의드립니다.

아래와 같이 dcb0 인터페이스로 나가는 패킷에 대해 MASQUERADE 규칙을 적용하였습니다.
제가 이해 하기로는 dcb0를 통해 나가는 모든 패킷은 dcb0 interface가 가지는 IP로 src 가 바뀌어 나가는 걸로 알고 있습니다.

Chain POSTROUTING (policy ACCEPT 69 packets, 4782 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 MASQUERADE  all  --  *      dcb0    0.0.0.0/0            0.0.0.0/0           

하지만 src IP 가 변경 되지 않고 기존의 src IP로 나가는 증상을 볼 수 있었습니다.

*라우팅 테이블 및 iptables / ifconfig 첨부합니다.

# ifconfig
br0       Link encap:Ethernet  HWaddr 24:D1:3F:11:FC:A1  
          inet addr:192.168.50.57  Bcast:192.168.50.255  Mask:255.255.255.0
          inet6 addr: fe80::26d1:3fff:fe11:fca1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:424 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:128530 (125.5 KiB)  TX bytes:3328 (3.2 KiB)
 
dcb0      Link encap:Ethernet  HWaddr CA:FE:00:11:FC:A1  
          inet addr:9.9.1.15  Bcast:9.9.1.255  Mask:255.255.255.0
          inet6 addr: fe80::c8fe:ff:fe11:fca1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1438  Metric:1
          RX packets:23 errors:0 dropped:0 overruns:0 frame:0
          TX packets:237 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1606 (1.5 KiB)  TX bytes:109208 (106.6 KiB)

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.225.1   255.255.255.255 UGH   0      0        0 usb0
211.184.18.68   192.168.225.1   255.255.255.255 UGH   0      0        0 usb0
192.168.225.0   *               255.255.255.0   U     0      0        0 usb0
192.168.50.0    *               255.255.255.0   U     0      0        0 br0
9.9.1.0         *               255.255.255.0   U     0      0        0 dcb0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
default         192.168.225.1   0.0.0.0         UG    0      0        0 usb0
default         9.9.1.254       0.0.0.0         UG    1      0        0 dcb0

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all  --  dcb0   *       0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 8 
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           state INVALID 
    0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
  435  133K ACCEPT     all  --  br0    *       192.168.50.0/24      0.0.0.0/0           state NEW 
    0     0 ACCEPT     all  --  lo     *       127.0.0.1            0.0.0.0/0           state NEW 
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           
 
# iptables -t nat -L -nv   
Chain PREROUTING (policy ACCEPT 147 packets, 12492 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    9   435 DNAT       tcp  --  usb0   *       0.0.0.0/0            0.0.0.0/0           tcp dpt:6000 to:192.168.50.57:23 
 
Chain POSTROUTING (policy ACCEPT 121 packets, 8100 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 MASQUERADE  all  --  *      dcb0    0.0.0.0/0            0.0.0.0/0           
 
Chain OUTPUT (policy ACCEPT 21 packets, 1619 bytes)
 pkts bytes target     prot opt in     out     source               destination  

위 증상이 왜 발생하는지 짐작 가시는분 조언 부탁드리겠습니다.

감사합니다.

댓글 달기

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