2017-04-10 3 views
0

내가 cell_z1에 ssh 할 때. 그러면이 라우팅 테이블을 볼 수 있습니다.cell_z1에서 iptables NAT 구성의 용도는 무엇입니까?


    $ sudo iptables -t nat -L 

    Chain PREROUTING (policy ACCEPT) 
    target  prot opt source    destination 
    w--prerouting all -- anywhere    anywhere 

    Chain INPUT (policy ACCEPT) 
    target  prot opt source    destination 

    Chain OUTPUT (policy ACCEPT) 
    target  prot opt source    destination 
    w--prerouting all -- anywhere    anywhere 

    Chain POSTROUTING (policy ACCEPT) 
    target  prot opt source    destination 
    w--postrouting all -- anywhere    anywhere 

    Chain w--instance-coiaggg2s3f (1 references) 
    target  prot opt source    destination 
    DNAT  tcp -- anywhere    cell-z1-0.node.dc1.cf.internal tcp dpt:60036 /* ac4154dd-a2bd-41d8-46bb-c5dfa3c8bfb2 */ to:10.254.0.6:8080 
    DNAT  tcp -- anywhere    cell-z1-0.node.dc1.cf.internal tcp dpt:60037 /* ac4154dd-a2bd-41d8-46bb-c5dfa3c8bfb2 */ to:10.254.0.6:2222 

    Chain w--instance-coiaggg2s3l (1 references) 
    target  prot opt source    destination 
    DNAT  tcp -- anywhere    cell-z1-0.node.dc1.cf.internal tcp dpt:60040 /* 74ab1082-7eca-4a09-7364-b266a23a7fdf */ to:10.254.0.2:8080 
    DNAT  tcp -- anywhere    cell-z1-0.node.dc1.cf.internal tcp dpt:60041 /* 74ab1082-7eca-4a09-7364-b266a23a7fdf */ to:10.254.0.2:2222 

    Chain w--postrouting (1 references) 
    target  prot opt source    destination 
    MASQUERADE all -- 10.254.0.0/30  !10.254.0.0/30  /* executor-healthcheck-8946f5d6-063c-4bae-474d-0032f72b8fcb */ 
    MASQUERADE all -- 10.254.0.4/30  !10.254.0.4/30  /* ef658bba-214d-4eef-5228-410e8e8aeb69 */ 
    MASQUERADE all -- 10.254.0.8/30  !10.254.0.8/30  /* 3cb958eb-409a-4aa9-48f1-41bb6573ebc6 */ 
    MASQUERADE all -- 10.254.0.12/30  !10.254.0.12/30  /* 9600ee8c-9e63-4682-bed3-b14767ea46d3 */ 
    MASQUERADE all -- 10.254.0.16/30  !10.254.0.16/30  /* executor-healthcheck-eda5cee2-81be-4890-6d67-2a9f108d6dda */ 

    Chain w--prerouting (2 references) 
    target  prot opt source    destination 
    w--instance-coiaggg2s3f all -- anywhere    anywhere    /* ac4154dd-a2bd-41d8-46bb-c5dfa3c8bfb2 */ 
    w--instance-coiaggg2s3l all -- anywhere    anywhere    /* 74ab1082-7eca-4a09-7364-b266a23a7fdf */ 

질문 : 대상의 대상은 무엇입니까? cell_z1에서 컬링 할 때 301 오류가 반환됩니다. 그래서, 나는 그것이 제거되었다고 생각합니다.

  • 10.254.0.6:8080
  • 10.254.0.6:2222
  • 그러나, 그것은 라우터의 원인 10.254.0.2:2222

  • 10.254.0.2:8080
  • 502 오류를 반환 라우터 이미 터가 해당 응용 프로그램 포트를 60036, 60037, 60040, 60041에 매핑 할 때 일부 밀어 넣은 응용 프로그램

    내 환경 : 호스트 OS : 우분투 서버 16.10 버추얼는 :이 정보는 가와사키 (가디언의 네트워크 라이브러리)에서 오는 것을 발견했다 2017년 4월 11일

    5.0.32

    
        $ bosh -e bosh-lite releases 
        Using environment '192.168.50.4' as client 'admin' 
    
        Name    Version   Commit Hash 
        cf     254+dev.1*  80a8305a+ 
        cf-mysql   34.2.0+dev.1* b8dcbe32 
        cf-rabbitmq  222.15.0+dev.1* 377afa0a+ 
        cf-rabbitmq-test 0.1.7   98720fb8 
        cflinuxfs2-rootfs 1.60.0*   0b44b228+ 
        diego    1.11.0+dev.1* 4ee830c6 
        garden-runc  1.4.0*   60f9e9dd 
        routing   0.147.0   255f268f 
        ~     0.136.0   d29132da+ 
    

    업데이트되었습니다. 아래의 경로 표를 참조하십시오. 당신이 CF에 응용 프로그램을 배포 할 때 그러나 10.254.0.6 달리, 경로 테이블은이 중 하나에 컨테이너에서 실행, 10.254.0.2 (10.254.0.0/30)

    
        $ route 
        Kernel IP routing table 
        Destination  Gateway   Genmask   Flags Metric Ref Use Iface 
        default   10.244.16.1  0.0.0.0   UG 0  0 0 wcl8gbnff7q4-1 
        10.244.16.0  *    255.255.255.0 U  0  0 0 wcl8gbnff7q4-1 
        10.254.0.4  *    255.255.255.252 U  0  0 0 wbrdg-0afe0004 
    
  • 답변

    0

    가상 NIC와 경로가 없습니다 디에고 세포. 컨테이너에는 내부 포트가 주어지며,이 순간에는 항상 Diego와 함께 8080이되고 Cell은 GoRouters에 외부 포트를 게시합니다. 외부 포트는 셀의 iptables 규칙을 사용하여 내부 포트에 매핑됩니다. 나는 그것이 당신이보고 있거나 묻고있는 것이라고 믿습니다. 요약

    은, 트래픽이 컨테이너의 응용 프로그램에 브라우저에서이 같은 경로를 취

    Browser -> HTTP(S) -> Load Balancer -> HTTP(S) -> GoRouter -> (HTTP) -> External Port on Cell -> iptables -> Internal Port in Container -> Application 
    

    당신은 또한 포트 2222에 대해 궁금 할 것이다,이 유사하지만 포트는 cf ssh 트래픽에 사용됩니다 용기에 넣는다.

    평신도는 이 아닙니다.은 Diego Cells에서 iptables 규칙을 수동으로 제거하거나 조정해야합니다.