Forwarding traffic from a host to a host's container

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have two hosts in a network 192.168.0.0/24:



  • Host A 192.168.0.15

  • Host B 192.168.0.13

And there is a remote ssh tunnel from B to A:



ssh -R 192.168.0.13:8080:192.168.0.15:8002 192.168.0.13 -N


and that tunnel works.



Host A runs a container nginx that runs nginx on a port 80. I would like to forward a traffic from 192.168.0.15:8002 to that nginx server. How to do it?



So,



if someone send a GET request with curl 192.168.0.13:8080 he will get response from nginx run on 192.168.0.15 in a container. The flow should be:



192.168.0.14 (for example) ---GET--> 192.168.0.13:8080
192.168.0.13 --(SSH TUNNEL)--> 192.168.0.15:8002
192.168.0.15:8002 -----------> 172.17.0.2:80 (nginx container)
172.17.0.2 ------------> 192.168.0.15
192.168.0.15 ------------> 192.168.0.13
192.168.0.13 ------------> 192.168.0.14


P.S.
I have to use iptables- I cannot change an existing tunnel.









share

























    up vote
    0
    down vote

    favorite












    I have two hosts in a network 192.168.0.0/24:



    • Host A 192.168.0.15

    • Host B 192.168.0.13

    And there is a remote ssh tunnel from B to A:



    ssh -R 192.168.0.13:8080:192.168.0.15:8002 192.168.0.13 -N


    and that tunnel works.



    Host A runs a container nginx that runs nginx on a port 80. I would like to forward a traffic from 192.168.0.15:8002 to that nginx server. How to do it?



    So,



    if someone send a GET request with curl 192.168.0.13:8080 he will get response from nginx run on 192.168.0.15 in a container. The flow should be:



    192.168.0.14 (for example) ---GET--> 192.168.0.13:8080
    192.168.0.13 --(SSH TUNNEL)--> 192.168.0.15:8002
    192.168.0.15:8002 -----------> 172.17.0.2:80 (nginx container)
    172.17.0.2 ------------> 192.168.0.15
    192.168.0.15 ------------> 192.168.0.13
    192.168.0.13 ------------> 192.168.0.14


    P.S.
    I have to use iptables- I cannot change an existing tunnel.









    share























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have two hosts in a network 192.168.0.0/24:



      • Host A 192.168.0.15

      • Host B 192.168.0.13

      And there is a remote ssh tunnel from B to A:



      ssh -R 192.168.0.13:8080:192.168.0.15:8002 192.168.0.13 -N


      and that tunnel works.



      Host A runs a container nginx that runs nginx on a port 80. I would like to forward a traffic from 192.168.0.15:8002 to that nginx server. How to do it?



      So,



      if someone send a GET request with curl 192.168.0.13:8080 he will get response from nginx run on 192.168.0.15 in a container. The flow should be:



      192.168.0.14 (for example) ---GET--> 192.168.0.13:8080
      192.168.0.13 --(SSH TUNNEL)--> 192.168.0.15:8002
      192.168.0.15:8002 -----------> 172.17.0.2:80 (nginx container)
      172.17.0.2 ------------> 192.168.0.15
      192.168.0.15 ------------> 192.168.0.13
      192.168.0.13 ------------> 192.168.0.14


      P.S.
      I have to use iptables- I cannot change an existing tunnel.









      share













      I have two hosts in a network 192.168.0.0/24:



      • Host A 192.168.0.15

      • Host B 192.168.0.13

      And there is a remote ssh tunnel from B to A:



      ssh -R 192.168.0.13:8080:192.168.0.15:8002 192.168.0.13 -N


      and that tunnel works.



      Host A runs a container nginx that runs nginx on a port 80. I would like to forward a traffic from 192.168.0.15:8002 to that nginx server. How to do it?



      So,



      if someone send a GET request with curl 192.168.0.13:8080 he will get response from nginx run on 192.168.0.15 in a container. The flow should be:



      192.168.0.14 (for example) ---GET--> 192.168.0.13:8080
      192.168.0.13 --(SSH TUNNEL)--> 192.168.0.15:8002
      192.168.0.15:8002 -----------> 172.17.0.2:80 (nginx container)
      172.17.0.2 ------------> 192.168.0.15
      192.168.0.15 ------------> 192.168.0.13
      192.168.0.13 ------------> 192.168.0.14


      P.S.
      I have to use iptables- I cannot change an existing tunnel.







      networking iptables docker





      share












      share










      share



      share










      asked 7 mins ago









      Gilgamesz

      1063




      1063

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475297%2fforwarding-traffic-from-a-host-to-a-hosts-container%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475297%2fforwarding-traffic-from-a-host-to-a-hosts-container%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay