TNS connection forward












0















There are 3 machines as follows:



Machine A - Remote Exadata DB machine
Machine B - Remote machine from which only I can connect to port 1521 of Machine A
Machine C - Local Machine (To run SQL Developer and can't connect machineA directly)
Machine D - Bastion Server through which I connect to Machine B



Machine C can access service running in Machine B only using SSH tunnelling.



Is there any way I can access the Exadata DB from Machine A using SQL Developer running in Machine C?



I am trying this way:



ssh MachineD -L 15219:MachineB:15220 -L 15220:MachineA:1521 


which is not working.










share|improve this question
















bumped to the homepage by Community 13 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • how do you connect ti the exadata at the moment. Using sqlplus from machine B? If so, how do you connect to machine B?

    – miracle173
    Jan 31 '18 at 8:31











  • @miracle173 yes , using sqlplus from machineB, From MachineC I use this: ssh MachineD -W MachineB:22 to login

    – kumarprd
    Feb 1 '18 at 11:00











  • did my solution work?

    – miracle173
    Feb 7 '18 at 3:23











  • @miracle173, thank you for the detailed solution. Actually I am seeing some firewall issue, where connection is getting refused while accessing the port after creating the tunnel.

    – kumarprd
    Feb 12 '18 at 15:29
















0















There are 3 machines as follows:



Machine A - Remote Exadata DB machine
Machine B - Remote machine from which only I can connect to port 1521 of Machine A
Machine C - Local Machine (To run SQL Developer and can't connect machineA directly)
Machine D - Bastion Server through which I connect to Machine B



Machine C can access service running in Machine B only using SSH tunnelling.



Is there any way I can access the Exadata DB from Machine A using SQL Developer running in Machine C?



I am trying this way:



ssh MachineD -L 15219:MachineB:15220 -L 15220:MachineA:1521 


which is not working.










share|improve this question
















bumped to the homepage by Community 13 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • how do you connect ti the exadata at the moment. Using sqlplus from machine B? If so, how do you connect to machine B?

    – miracle173
    Jan 31 '18 at 8:31











  • @miracle173 yes , using sqlplus from machineB, From MachineC I use this: ssh MachineD -W MachineB:22 to login

    – kumarprd
    Feb 1 '18 at 11:00











  • did my solution work?

    – miracle173
    Feb 7 '18 at 3:23











  • @miracle173, thank you for the detailed solution. Actually I am seeing some firewall issue, where connection is getting refused while accessing the port after creating the tunnel.

    – kumarprd
    Feb 12 '18 at 15:29














0












0








0


2






There are 3 machines as follows:



Machine A - Remote Exadata DB machine
Machine B - Remote machine from which only I can connect to port 1521 of Machine A
Machine C - Local Machine (To run SQL Developer and can't connect machineA directly)
Machine D - Bastion Server through which I connect to Machine B



Machine C can access service running in Machine B only using SSH tunnelling.



Is there any way I can access the Exadata DB from Machine A using SQL Developer running in Machine C?



I am trying this way:



ssh MachineD -L 15219:MachineB:15220 -L 15220:MachineA:1521 


which is not working.










share|improve this question
















There are 3 machines as follows:



Machine A - Remote Exadata DB machine
Machine B - Remote machine from which only I can connect to port 1521 of Machine A
Machine C - Local Machine (To run SQL Developer and can't connect machineA directly)
Machine D - Bastion Server through which I connect to Machine B



Machine C can access service running in Machine B only using SSH tunnelling.



Is there any way I can access the Exadata DB from Machine A using SQL Developer running in Machine C?



I am trying this way:



ssh MachineD -L 15219:MachineB:15220 -L 15220:MachineA:1521 


which is not working.







linux oracle-12c remote sysdba ssh






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 31 '18 at 8:34









miracle173

6,5271837




6,5271837










asked Jan 30 '18 at 12:11









kumarprdkumarprd

1045




1045





bumped to the homepage by Community 13 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 13 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • how do you connect ti the exadata at the moment. Using sqlplus from machine B? If so, how do you connect to machine B?

    – miracle173
    Jan 31 '18 at 8:31











  • @miracle173 yes , using sqlplus from machineB, From MachineC I use this: ssh MachineD -W MachineB:22 to login

    – kumarprd
    Feb 1 '18 at 11:00











  • did my solution work?

    – miracle173
    Feb 7 '18 at 3:23











  • @miracle173, thank you for the detailed solution. Actually I am seeing some firewall issue, where connection is getting refused while accessing the port after creating the tunnel.

    – kumarprd
    Feb 12 '18 at 15:29



















  • how do you connect ti the exadata at the moment. Using sqlplus from machine B? If so, how do you connect to machine B?

    – miracle173
    Jan 31 '18 at 8:31











  • @miracle173 yes , using sqlplus from machineB, From MachineC I use this: ssh MachineD -W MachineB:22 to login

    – kumarprd
    Feb 1 '18 at 11:00











  • did my solution work?

    – miracle173
    Feb 7 '18 at 3:23











  • @miracle173, thank you for the detailed solution. Actually I am seeing some firewall issue, where connection is getting refused while accessing the port after creating the tunnel.

    – kumarprd
    Feb 12 '18 at 15:29

















how do you connect ti the exadata at the moment. Using sqlplus from machine B? If so, how do you connect to machine B?

– miracle173
Jan 31 '18 at 8:31





how do you connect ti the exadata at the moment. Using sqlplus from machine B? If so, how do you connect to machine B?

– miracle173
Jan 31 '18 at 8:31













@miracle173 yes , using sqlplus from machineB, From MachineC I use this: ssh MachineD -W MachineB:22 to login

– kumarprd
Feb 1 '18 at 11:00





@miracle173 yes , using sqlplus from machineB, From MachineC I use this: ssh MachineD -W MachineB:22 to login

– kumarprd
Feb 1 '18 at 11:00













did my solution work?

– miracle173
Feb 7 '18 at 3:23





did my solution work?

– miracle173
Feb 7 '18 at 3:23













@miracle173, thank you for the detailed solution. Actually I am seeing some firewall issue, where connection is getting refused while accessing the port after creating the tunnel.

– kumarprd
Feb 12 '18 at 15:29





@miracle173, thank you for the detailed solution. Actually I am seeing some firewall issue, where connection is getting refused while accessing the port after creating the tunnel.

– kumarprd
Feb 12 '18 at 15:29










2 Answers
2






active

oldest

votes


















0














You said it yourself: SSH tunneling.



On machine C:



ssh -L 12345:machineA:1521 machineB


Then use localhost:12345 in SQL Developer.



With the above, you log in to Machine B from Machine C using SSH, and create a tunnel to the listener port of Machine A through Machine B.






share|improve this answer
























  • To create a tunnel from MachineC to MachineB I have to use a bastion server. e.g. ssh <bastion> -L 12345:MachineB:<serviceport> , then . how to use MachineA here ?

    – kumarprd
    Jan 30 '18 at 15:42











  • @kumarprd If you have another question then post a new question

    – miracle173
    Jan 30 '18 at 18:33











  • @miracle173 this reply is related to the same question, if you have read it. I just mentioned the step, that I use to create the tunnel, as the step in the answer is not helping.

    – kumarprd
    Jan 30 '18 at 19:23











  • @kumarprd even if it is related it is a different one. So why not follow the policy of this site and post another question?

    – miracle173
    Jan 30 '18 at 20:54











  • @miracle173 its not different at all. Try to understand the question and reply.

    – kumarprd
    Jan 31 '18 at 5:00



















0














You tried



ssh MachineD -L 15219:MachineB:15220 -L 15220:MachineA:1521 


this did not work but you think in the right direction, you want to join two tunnels.



login to MachineD and make a tunnel from your MachineB port 15219 to MachineB port 15220



ssh -L 15219:MachineD:15220 MachineD


So If you now send something to MachineC port 15219 then your ssh session (from MachineC to MachineD) sends it to MachineD port 15220



if you do a



tnsping  '(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = MachineC)(PORT = 15219))(CONNECT_DATA = (SERVICE_NAME = ORCL)))'


you will get an error message



TNS-12541: TNS:no listener


or something similar, if you try to connect with SQL Developer.



Because if you now send something to MachineC port 15219 then your ssh session (from MachineC to MachineD) sends it to MachineD port 15220. And on MachineD port 15220 there is actually nobody listening.



Now in your ssh session on MachineD execute the following command



ssh -L 15220:MachineA:1521 MachineB


Now you have opened an ssh session from MachineC to MachineB and data sent to MachineD port 15220 is read by this second ssh session and sent to MachineA port 1521. So you have two ssh sessions and the second one extends the first one.



But instead of opening one ssh session and in this ssh session opneing the other one you can do this in one command



ssh -L 15219:MachineD:15220 MachineD ssh -L 15220:MachineA:1521 MachineB


by juxtaposing both commands. If after an ssh command follows another comman this command is executed after login.
To avoid an error message like



Pseudo-terminal will not be allocated because stdin is not a terminal.


you can use the -T option for the second `ssh`` command.



ssh -L 15219:MachineD:15220 MachineD ssh -T -L 15220:MachineA:1521 MachineB


If you get some



bind: Address already in use
channel_setup_fwd_listener: cannot listen to port: 15220


messages then change the adresses.



e.g. use 15221 instead of 15220. Of course you must replace it on both posisitions:



 ssh -L 15219:MachineD:15221 MachineD ssh -T -L 15221:MachineA:1521 MachineB


I hope this works. It is possible to configure the ssh daemons such that local forwarding is not allowed.



You cann concatenate an arbitrary number of tunnels .



I cannot test the -W option because I get



SSH-2.0-OpenSSH_5.3

Protocol mismatch.





share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "182"
    };
    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%2fdba.stackexchange.com%2fquestions%2f196589%2ftns-connection-forward%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    You said it yourself: SSH tunneling.



    On machine C:



    ssh -L 12345:machineA:1521 machineB


    Then use localhost:12345 in SQL Developer.



    With the above, you log in to Machine B from Machine C using SSH, and create a tunnel to the listener port of Machine A through Machine B.






    share|improve this answer
























    • To create a tunnel from MachineC to MachineB I have to use a bastion server. e.g. ssh <bastion> -L 12345:MachineB:<serviceport> , then . how to use MachineA here ?

      – kumarprd
      Jan 30 '18 at 15:42











    • @kumarprd If you have another question then post a new question

      – miracle173
      Jan 30 '18 at 18:33











    • @miracle173 this reply is related to the same question, if you have read it. I just mentioned the step, that I use to create the tunnel, as the step in the answer is not helping.

      – kumarprd
      Jan 30 '18 at 19:23











    • @kumarprd even if it is related it is a different one. So why not follow the policy of this site and post another question?

      – miracle173
      Jan 30 '18 at 20:54











    • @miracle173 its not different at all. Try to understand the question and reply.

      – kumarprd
      Jan 31 '18 at 5:00
















    0














    You said it yourself: SSH tunneling.



    On machine C:



    ssh -L 12345:machineA:1521 machineB


    Then use localhost:12345 in SQL Developer.



    With the above, you log in to Machine B from Machine C using SSH, and create a tunnel to the listener port of Machine A through Machine B.






    share|improve this answer
























    • To create a tunnel from MachineC to MachineB I have to use a bastion server. e.g. ssh <bastion> -L 12345:MachineB:<serviceport> , then . how to use MachineA here ?

      – kumarprd
      Jan 30 '18 at 15:42











    • @kumarprd If you have another question then post a new question

      – miracle173
      Jan 30 '18 at 18:33











    • @miracle173 this reply is related to the same question, if you have read it. I just mentioned the step, that I use to create the tunnel, as the step in the answer is not helping.

      – kumarprd
      Jan 30 '18 at 19:23











    • @kumarprd even if it is related it is a different one. So why not follow the policy of this site and post another question?

      – miracle173
      Jan 30 '18 at 20:54











    • @miracle173 its not different at all. Try to understand the question and reply.

      – kumarprd
      Jan 31 '18 at 5:00














    0












    0








    0







    You said it yourself: SSH tunneling.



    On machine C:



    ssh -L 12345:machineA:1521 machineB


    Then use localhost:12345 in SQL Developer.



    With the above, you log in to Machine B from Machine C using SSH, and create a tunnel to the listener port of Machine A through Machine B.






    share|improve this answer













    You said it yourself: SSH tunneling.



    On machine C:



    ssh -L 12345:machineA:1521 machineB


    Then use localhost:12345 in SQL Developer.



    With the above, you log in to Machine B from Machine C using SSH, and create a tunnel to the listener port of Machine A through Machine B.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jan 30 '18 at 12:51









    Balazs PappBalazs Papp

    26.2k2931




    26.2k2931













    • To create a tunnel from MachineC to MachineB I have to use a bastion server. e.g. ssh <bastion> -L 12345:MachineB:<serviceport> , then . how to use MachineA here ?

      – kumarprd
      Jan 30 '18 at 15:42











    • @kumarprd If you have another question then post a new question

      – miracle173
      Jan 30 '18 at 18:33











    • @miracle173 this reply is related to the same question, if you have read it. I just mentioned the step, that I use to create the tunnel, as the step in the answer is not helping.

      – kumarprd
      Jan 30 '18 at 19:23











    • @kumarprd even if it is related it is a different one. So why not follow the policy of this site and post another question?

      – miracle173
      Jan 30 '18 at 20:54











    • @miracle173 its not different at all. Try to understand the question and reply.

      – kumarprd
      Jan 31 '18 at 5:00



















    • To create a tunnel from MachineC to MachineB I have to use a bastion server. e.g. ssh <bastion> -L 12345:MachineB:<serviceport> , then . how to use MachineA here ?

      – kumarprd
      Jan 30 '18 at 15:42











    • @kumarprd If you have another question then post a new question

      – miracle173
      Jan 30 '18 at 18:33











    • @miracle173 this reply is related to the same question, if you have read it. I just mentioned the step, that I use to create the tunnel, as the step in the answer is not helping.

      – kumarprd
      Jan 30 '18 at 19:23











    • @kumarprd even if it is related it is a different one. So why not follow the policy of this site and post another question?

      – miracle173
      Jan 30 '18 at 20:54











    • @miracle173 its not different at all. Try to understand the question and reply.

      – kumarprd
      Jan 31 '18 at 5:00

















    To create a tunnel from MachineC to MachineB I have to use a bastion server. e.g. ssh <bastion> -L 12345:MachineB:<serviceport> , then . how to use MachineA here ?

    – kumarprd
    Jan 30 '18 at 15:42





    To create a tunnel from MachineC to MachineB I have to use a bastion server. e.g. ssh <bastion> -L 12345:MachineB:<serviceport> , then . how to use MachineA here ?

    – kumarprd
    Jan 30 '18 at 15:42













    @kumarprd If you have another question then post a new question

    – miracle173
    Jan 30 '18 at 18:33





    @kumarprd If you have another question then post a new question

    – miracle173
    Jan 30 '18 at 18:33













    @miracle173 this reply is related to the same question, if you have read it. I just mentioned the step, that I use to create the tunnel, as the step in the answer is not helping.

    – kumarprd
    Jan 30 '18 at 19:23





    @miracle173 this reply is related to the same question, if you have read it. I just mentioned the step, that I use to create the tunnel, as the step in the answer is not helping.

    – kumarprd
    Jan 30 '18 at 19:23













    @kumarprd even if it is related it is a different one. So why not follow the policy of this site and post another question?

    – miracle173
    Jan 30 '18 at 20:54





    @kumarprd even if it is related it is a different one. So why not follow the policy of this site and post another question?

    – miracle173
    Jan 30 '18 at 20:54













    @miracle173 its not different at all. Try to understand the question and reply.

    – kumarprd
    Jan 31 '18 at 5:00





    @miracle173 its not different at all. Try to understand the question and reply.

    – kumarprd
    Jan 31 '18 at 5:00













    0














    You tried



    ssh MachineD -L 15219:MachineB:15220 -L 15220:MachineA:1521 


    this did not work but you think in the right direction, you want to join two tunnels.



    login to MachineD and make a tunnel from your MachineB port 15219 to MachineB port 15220



    ssh -L 15219:MachineD:15220 MachineD


    So If you now send something to MachineC port 15219 then your ssh session (from MachineC to MachineD) sends it to MachineD port 15220



    if you do a



    tnsping  '(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = MachineC)(PORT = 15219))(CONNECT_DATA = (SERVICE_NAME = ORCL)))'


    you will get an error message



    TNS-12541: TNS:no listener


    or something similar, if you try to connect with SQL Developer.



    Because if you now send something to MachineC port 15219 then your ssh session (from MachineC to MachineD) sends it to MachineD port 15220. And on MachineD port 15220 there is actually nobody listening.



    Now in your ssh session on MachineD execute the following command



    ssh -L 15220:MachineA:1521 MachineB


    Now you have opened an ssh session from MachineC to MachineB and data sent to MachineD port 15220 is read by this second ssh session and sent to MachineA port 1521. So you have two ssh sessions and the second one extends the first one.



    But instead of opening one ssh session and in this ssh session opneing the other one you can do this in one command



    ssh -L 15219:MachineD:15220 MachineD ssh -L 15220:MachineA:1521 MachineB


    by juxtaposing both commands. If after an ssh command follows another comman this command is executed after login.
    To avoid an error message like



    Pseudo-terminal will not be allocated because stdin is not a terminal.


    you can use the -T option for the second `ssh`` command.



    ssh -L 15219:MachineD:15220 MachineD ssh -T -L 15220:MachineA:1521 MachineB


    If you get some



    bind: Address already in use
    channel_setup_fwd_listener: cannot listen to port: 15220


    messages then change the adresses.



    e.g. use 15221 instead of 15220. Of course you must replace it on both posisitions:



     ssh -L 15219:MachineD:15221 MachineD ssh -T -L 15221:MachineA:1521 MachineB


    I hope this works. It is possible to configure the ssh daemons such that local forwarding is not allowed.



    You cann concatenate an arbitrary number of tunnels .



    I cannot test the -W option because I get



    SSH-2.0-OpenSSH_5.3

    Protocol mismatch.





    share|improve this answer






























      0














      You tried



      ssh MachineD -L 15219:MachineB:15220 -L 15220:MachineA:1521 


      this did not work but you think in the right direction, you want to join two tunnels.



      login to MachineD and make a tunnel from your MachineB port 15219 to MachineB port 15220



      ssh -L 15219:MachineD:15220 MachineD


      So If you now send something to MachineC port 15219 then your ssh session (from MachineC to MachineD) sends it to MachineD port 15220



      if you do a



      tnsping  '(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = MachineC)(PORT = 15219))(CONNECT_DATA = (SERVICE_NAME = ORCL)))'


      you will get an error message



      TNS-12541: TNS:no listener


      or something similar, if you try to connect with SQL Developer.



      Because if you now send something to MachineC port 15219 then your ssh session (from MachineC to MachineD) sends it to MachineD port 15220. And on MachineD port 15220 there is actually nobody listening.



      Now in your ssh session on MachineD execute the following command



      ssh -L 15220:MachineA:1521 MachineB


      Now you have opened an ssh session from MachineC to MachineB and data sent to MachineD port 15220 is read by this second ssh session and sent to MachineA port 1521. So you have two ssh sessions and the second one extends the first one.



      But instead of opening one ssh session and in this ssh session opneing the other one you can do this in one command



      ssh -L 15219:MachineD:15220 MachineD ssh -L 15220:MachineA:1521 MachineB


      by juxtaposing both commands. If after an ssh command follows another comman this command is executed after login.
      To avoid an error message like



      Pseudo-terminal will not be allocated because stdin is not a terminal.


      you can use the -T option for the second `ssh`` command.



      ssh -L 15219:MachineD:15220 MachineD ssh -T -L 15220:MachineA:1521 MachineB


      If you get some



      bind: Address already in use
      channel_setup_fwd_listener: cannot listen to port: 15220


      messages then change the adresses.



      e.g. use 15221 instead of 15220. Of course you must replace it on both posisitions:



       ssh -L 15219:MachineD:15221 MachineD ssh -T -L 15221:MachineA:1521 MachineB


      I hope this works. It is possible to configure the ssh daemons such that local forwarding is not allowed.



      You cann concatenate an arbitrary number of tunnels .



      I cannot test the -W option because I get



      SSH-2.0-OpenSSH_5.3

      Protocol mismatch.





      share|improve this answer




























        0












        0








        0







        You tried



        ssh MachineD -L 15219:MachineB:15220 -L 15220:MachineA:1521 


        this did not work but you think in the right direction, you want to join two tunnels.



        login to MachineD and make a tunnel from your MachineB port 15219 to MachineB port 15220



        ssh -L 15219:MachineD:15220 MachineD


        So If you now send something to MachineC port 15219 then your ssh session (from MachineC to MachineD) sends it to MachineD port 15220



        if you do a



        tnsping  '(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = MachineC)(PORT = 15219))(CONNECT_DATA = (SERVICE_NAME = ORCL)))'


        you will get an error message



        TNS-12541: TNS:no listener


        or something similar, if you try to connect with SQL Developer.



        Because if you now send something to MachineC port 15219 then your ssh session (from MachineC to MachineD) sends it to MachineD port 15220. And on MachineD port 15220 there is actually nobody listening.



        Now in your ssh session on MachineD execute the following command



        ssh -L 15220:MachineA:1521 MachineB


        Now you have opened an ssh session from MachineC to MachineB and data sent to MachineD port 15220 is read by this second ssh session and sent to MachineA port 1521. So you have two ssh sessions and the second one extends the first one.



        But instead of opening one ssh session and in this ssh session opneing the other one you can do this in one command



        ssh -L 15219:MachineD:15220 MachineD ssh -L 15220:MachineA:1521 MachineB


        by juxtaposing both commands. If after an ssh command follows another comman this command is executed after login.
        To avoid an error message like



        Pseudo-terminal will not be allocated because stdin is not a terminal.


        you can use the -T option for the second `ssh`` command.



        ssh -L 15219:MachineD:15220 MachineD ssh -T -L 15220:MachineA:1521 MachineB


        If you get some



        bind: Address already in use
        channel_setup_fwd_listener: cannot listen to port: 15220


        messages then change the adresses.



        e.g. use 15221 instead of 15220. Of course you must replace it on both posisitions:



         ssh -L 15219:MachineD:15221 MachineD ssh -T -L 15221:MachineA:1521 MachineB


        I hope this works. It is possible to configure the ssh daemons such that local forwarding is not allowed.



        You cann concatenate an arbitrary number of tunnels .



        I cannot test the -W option because I get



        SSH-2.0-OpenSSH_5.3

        Protocol mismatch.





        share|improve this answer















        You tried



        ssh MachineD -L 15219:MachineB:15220 -L 15220:MachineA:1521 


        this did not work but you think in the right direction, you want to join two tunnels.



        login to MachineD and make a tunnel from your MachineB port 15219 to MachineB port 15220



        ssh -L 15219:MachineD:15220 MachineD


        So If you now send something to MachineC port 15219 then your ssh session (from MachineC to MachineD) sends it to MachineD port 15220



        if you do a



        tnsping  '(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = MachineC)(PORT = 15219))(CONNECT_DATA = (SERVICE_NAME = ORCL)))'


        you will get an error message



        TNS-12541: TNS:no listener


        or something similar, if you try to connect with SQL Developer.



        Because if you now send something to MachineC port 15219 then your ssh session (from MachineC to MachineD) sends it to MachineD port 15220. And on MachineD port 15220 there is actually nobody listening.



        Now in your ssh session on MachineD execute the following command



        ssh -L 15220:MachineA:1521 MachineB


        Now you have opened an ssh session from MachineC to MachineB and data sent to MachineD port 15220 is read by this second ssh session and sent to MachineA port 1521. So you have two ssh sessions and the second one extends the first one.



        But instead of opening one ssh session and in this ssh session opneing the other one you can do this in one command



        ssh -L 15219:MachineD:15220 MachineD ssh -L 15220:MachineA:1521 MachineB


        by juxtaposing both commands. If after an ssh command follows another comman this command is executed after login.
        To avoid an error message like



        Pseudo-terminal will not be allocated because stdin is not a terminal.


        you can use the -T option for the second `ssh`` command.



        ssh -L 15219:MachineD:15220 MachineD ssh -T -L 15220:MachineA:1521 MachineB


        If you get some



        bind: Address already in use
        channel_setup_fwd_listener: cannot listen to port: 15220


        messages then change the adresses.



        e.g. use 15221 instead of 15220. Of course you must replace it on both posisitions:



         ssh -L 15219:MachineD:15221 MachineD ssh -T -L 15221:MachineA:1521 MachineB


        I hope this works. It is possible to configure the ssh daemons such that local forwarding is not allowed.



        You cann concatenate an arbitrary number of tunnels .



        I cannot test the -W option because I get



        SSH-2.0-OpenSSH_5.3

        Protocol mismatch.






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 2 '18 at 6:06

























        answered Feb 1 '18 at 18:02









        miracle173miracle173

        6,5271837




        6,5271837






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Database Administrators 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%2fdba.stackexchange.com%2fquestions%2f196589%2ftns-connection-forward%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

            Liste der Baudenkmale in Friedland (Mecklenburg)

            Single-Malt-Whisky

            Czorneboh