Redirect Curl Calls From Specific IP On LocalhostUnable to make outbound SNMP connections when IPTables is...

Is there a commercial liquid with refractive index greater than n=2?

What was the intention with the Commodore 128?

How to use the passive form to say "This flower was watered."

Why don't modern jet engines use forced exhaust mixing?

Starships without computers?

Sinc interpolation in spatial domain

Replacing old plug-in 220V range with new hardwire 3-wire electric cooktop: remove outlet or add a plug?

Can 'in-' mean both 'in' and 'no'?

How to detect a failed AES256 decryption programmatically?

How could Tony Stark wield the Infinity Nano Gauntlet - at all?

Adding things to bunches of things vs multiplication

What is bodily formation? Does it refer to the breath or the body?

Why is the name Bergson pronounced like Berksonne?

What kind of (probable) traffic accident might lead to the desctruction of only (!) the brain stem and cerebellum?

Playing a fast but quiet Alberti bass

My new Acer Aspire 7 doesn't have a Legacy Boot option, what can I do to get it?

Is there a utility / method to organize trad gear so that each piece is immediately accessible?

Output with the same length always

Is it alright to say good afternoon Sirs and Madams in a panel interview?

My father gets angry everytime I pass Salam, that means I should stop saying Salam when he's around?

Why don't politicians push for fossil fuel reduction by pointing out their scarcity?

Is there a way to make the "o" keypress of other-window <C-x><C-o> repeatable?

From France west coast to Portugal via ship?

Tabularx with hline and overrightarrow vertical spacing



Redirect Curl Calls From Specific IP On Localhost


Unable to make outbound SNMP connections when IPTables is enablediptables, what is truly open?CONFIG_NF_CONNTRACK is not setTesting iptables DNAT Rule Locally Using NetCatHow to implement iptables on lxc-container?Forwarding traffic back to localhost






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I've a node server that serves localhost:90, and we need to direct all curl calls from WITHIN the machine on 168.92.168.92 to localhost:90.



How can this be achieved? Would this be using iptables?



I tried OUTPUT and PREROUTING but the request fails to connect.



Chain PREROUTING (policy ACCEPT 3339 packets, 200K bytes)
num pkts bytes target prot opt in out source destination
1 0 0 DNAT tcp -- 168.92.168.92 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 to:127.0.0.1:90

Chain INPUT (policy ACCEPT 3339 packets, 200K bytes)
num pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 6220 packets, 652K bytes)
num pkts bytes target prot opt in out source destination
1 0 0 DOCKER all -- * * 0.0.0.0/0 !127.0.0.0/8 ADDRTYPE match dst-type LOCAL
2 0 0 DNAT tcp -- * * 168.92.168.92 0.0.0.0/0 tcp dpt:80 to:127.0.0.1:90


Output:



# curl -v http://168.92.168.92/hello
* About to connect() to 168.92.168.92 80 (#0)
* Trying 168.92.168.92... Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host
Curl directly to the server on localhost:90 works, but curl on 168.92.168.92 does not.


What am I missing?










share|improve this question































    1















    I've a node server that serves localhost:90, and we need to direct all curl calls from WITHIN the machine on 168.92.168.92 to localhost:90.



    How can this be achieved? Would this be using iptables?



    I tried OUTPUT and PREROUTING but the request fails to connect.



    Chain PREROUTING (policy ACCEPT 3339 packets, 200K bytes)
    num pkts bytes target prot opt in out source destination
    1 0 0 DNAT tcp -- 168.92.168.92 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 to:127.0.0.1:90

    Chain INPUT (policy ACCEPT 3339 packets, 200K bytes)
    num pkts bytes target prot opt in out source destination

    Chain OUTPUT (policy ACCEPT 6220 packets, 652K bytes)
    num pkts bytes target prot opt in out source destination
    1 0 0 DOCKER all -- * * 0.0.0.0/0 !127.0.0.0/8 ADDRTYPE match dst-type LOCAL
    2 0 0 DNAT tcp -- * * 168.92.168.92 0.0.0.0/0 tcp dpt:80 to:127.0.0.1:90


    Output:



    # curl -v http://168.92.168.92/hello
    * About to connect() to 168.92.168.92 80 (#0)
    * Trying 168.92.168.92... Connection refused
    * couldn't connect to host
    * Closing connection #0
    curl: (7) couldn't connect to host
    Curl directly to the server on localhost:90 works, but curl on 168.92.168.92 does not.


    What am I missing?










    share|improve this question



























      1












      1








      1








      I've a node server that serves localhost:90, and we need to direct all curl calls from WITHIN the machine on 168.92.168.92 to localhost:90.



      How can this be achieved? Would this be using iptables?



      I tried OUTPUT and PREROUTING but the request fails to connect.



      Chain PREROUTING (policy ACCEPT 3339 packets, 200K bytes)
      num pkts bytes target prot opt in out source destination
      1 0 0 DNAT tcp -- 168.92.168.92 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 to:127.0.0.1:90

      Chain INPUT (policy ACCEPT 3339 packets, 200K bytes)
      num pkts bytes target prot opt in out source destination

      Chain OUTPUT (policy ACCEPT 6220 packets, 652K bytes)
      num pkts bytes target prot opt in out source destination
      1 0 0 DOCKER all -- * * 0.0.0.0/0 !127.0.0.0/8 ADDRTYPE match dst-type LOCAL
      2 0 0 DNAT tcp -- * * 168.92.168.92 0.0.0.0/0 tcp dpt:80 to:127.0.0.1:90


      Output:



      # curl -v http://168.92.168.92/hello
      * About to connect() to 168.92.168.92 80 (#0)
      * Trying 168.92.168.92... Connection refused
      * couldn't connect to host
      * Closing connection #0
      curl: (7) couldn't connect to host
      Curl directly to the server on localhost:90 works, but curl on 168.92.168.92 does not.


      What am I missing?










      share|improve this question














      I've a node server that serves localhost:90, and we need to direct all curl calls from WITHIN the machine on 168.92.168.92 to localhost:90.



      How can this be achieved? Would this be using iptables?



      I tried OUTPUT and PREROUTING but the request fails to connect.



      Chain PREROUTING (policy ACCEPT 3339 packets, 200K bytes)
      num pkts bytes target prot opt in out source destination
      1 0 0 DNAT tcp -- 168.92.168.92 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 to:127.0.0.1:90

      Chain INPUT (policy ACCEPT 3339 packets, 200K bytes)
      num pkts bytes target prot opt in out source destination

      Chain OUTPUT (policy ACCEPT 6220 packets, 652K bytes)
      num pkts bytes target prot opt in out source destination
      1 0 0 DOCKER all -- * * 0.0.0.0/0 !127.0.0.0/8 ADDRTYPE match dst-type LOCAL
      2 0 0 DNAT tcp -- * * 168.92.168.92 0.0.0.0/0 tcp dpt:80 to:127.0.0.1:90


      Output:



      # curl -v http://168.92.168.92/hello
      * About to connect() to 168.92.168.92 80 (#0)
      * Trying 168.92.168.92... Connection refused
      * couldn't connect to host
      * Closing connection #0
      curl: (7) couldn't connect to host
      Curl directly to the server on localhost:90 works, but curl on 168.92.168.92 does not.


      What am I missing?







      iptables curl iptables-redirect






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 days ago









      Simply_MeSimply_Me

      1,5031 gold badge9 silver badges10 bronze badges




      1,5031 gold badge9 silver badges10 bronze badges

























          0






          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          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%2f535830%2fredirect-curl-calls-from-specific-ip-on-localhost%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f535830%2fredirect-curl-calls-from-specific-ip-on-localhost%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

          The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

          Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...