Connect to ssh on machine behind NAT with forwarded port











up vote
0
down vote

favorite












I am struggling with connection to my Raspberry Pi behind NAT in my home from outside.
What I did until now:




  1. I set in my router DDNS to have access for outside because my ISP giving me dynamic IP (let say it is: external.no-ip.org)

  2. I set in my router in DHCP static IP (sing MAC address) for my Raspberry Pi (let say it is 192.168.1.155)

  3. I forwarded port 50022 on my router to port 22 of 192.168.1.155 which is reserved for Raspberry Pi


Next I am trying SSH



ssh pi@external.no-ip.org -p 50022 and I can not connect to SSH.



What I am doing wrong? I have tested and can ping external.no-ip.org and it have my IP. I have tested redirections and for sure 50022 is redirected to 22 on my raspberry PI.



Thank you for help.



BR
Arek










share|improve this question






















  • For the ssh response to arrive back the private IP should be SNATed a.k.a MASQUERADE
    – Nizam Mohamed
    Nov 11 at 7:42






  • 1




    pi@externail.no-ip.org Doesn’t look like a valid hostname - external.no-ip.org is what you should use. Also, if you use ping external.no-ip.org does the hostname resolve to the correct IP address (of the WAN side of your router)?
    – barny
    Nov 11 at 9:38












  • Oh actually the other problem is going to be that you are mapping external port 50022 to pi port 22 - try making both port numbers the same port 22 or port 50022, if necessary changing your ssh service to use port 50022 (simplest to first try making the external port 22). Also, change one thing at a time and retest because if you change two things you won’t know which thing fixed the problem.
    – barny
    Nov 11 at 9:41










  • And make sure your pi firewall is allowing incoming on port 22 - you can check this on your local network.
    – barny
    Nov 11 at 9:42










  • Hi @barny, thank you for your suggestions. I am sorry, to fast pressed Enter. Will write full answer bellow.
    – ArekS
    Nov 11 at 11:14

















up vote
0
down vote

favorite












I am struggling with connection to my Raspberry Pi behind NAT in my home from outside.
What I did until now:




  1. I set in my router DDNS to have access for outside because my ISP giving me dynamic IP (let say it is: external.no-ip.org)

  2. I set in my router in DHCP static IP (sing MAC address) for my Raspberry Pi (let say it is 192.168.1.155)

  3. I forwarded port 50022 on my router to port 22 of 192.168.1.155 which is reserved for Raspberry Pi


Next I am trying SSH



ssh pi@external.no-ip.org -p 50022 and I can not connect to SSH.



What I am doing wrong? I have tested and can ping external.no-ip.org and it have my IP. I have tested redirections and for sure 50022 is redirected to 22 on my raspberry PI.



Thank you for help.



BR
Arek










share|improve this question






















  • For the ssh response to arrive back the private IP should be SNATed a.k.a MASQUERADE
    – Nizam Mohamed
    Nov 11 at 7:42






  • 1




    pi@externail.no-ip.org Doesn’t look like a valid hostname - external.no-ip.org is what you should use. Also, if you use ping external.no-ip.org does the hostname resolve to the correct IP address (of the WAN side of your router)?
    – barny
    Nov 11 at 9:38












  • Oh actually the other problem is going to be that you are mapping external port 50022 to pi port 22 - try making both port numbers the same port 22 or port 50022, if necessary changing your ssh service to use port 50022 (simplest to first try making the external port 22). Also, change one thing at a time and retest because if you change two things you won’t know which thing fixed the problem.
    – barny
    Nov 11 at 9:41










  • And make sure your pi firewall is allowing incoming on port 22 - you can check this on your local network.
    – barny
    Nov 11 at 9:42










  • Hi @barny, thank you for your suggestions. I am sorry, to fast pressed Enter. Will write full answer bellow.
    – ArekS
    Nov 11 at 11:14















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am struggling with connection to my Raspberry Pi behind NAT in my home from outside.
What I did until now:




  1. I set in my router DDNS to have access for outside because my ISP giving me dynamic IP (let say it is: external.no-ip.org)

  2. I set in my router in DHCP static IP (sing MAC address) for my Raspberry Pi (let say it is 192.168.1.155)

  3. I forwarded port 50022 on my router to port 22 of 192.168.1.155 which is reserved for Raspberry Pi


Next I am trying SSH



ssh pi@external.no-ip.org -p 50022 and I can not connect to SSH.



What I am doing wrong? I have tested and can ping external.no-ip.org and it have my IP. I have tested redirections and for sure 50022 is redirected to 22 on my raspberry PI.



Thank you for help.



BR
Arek










share|improve this question













I am struggling with connection to my Raspberry Pi behind NAT in my home from outside.
What I did until now:




  1. I set in my router DDNS to have access for outside because my ISP giving me dynamic IP (let say it is: external.no-ip.org)

  2. I set in my router in DHCP static IP (sing MAC address) for my Raspberry Pi (let say it is 192.168.1.155)

  3. I forwarded port 50022 on my router to port 22 of 192.168.1.155 which is reserved for Raspberry Pi


Next I am trying SSH



ssh pi@external.no-ip.org -p 50022 and I can not connect to SSH.



What I am doing wrong? I have tested and can ping external.no-ip.org and it have my IP. I have tested redirections and for sure 50022 is redirected to 22 on my raspberry PI.



Thank you for help.



BR
Arek







ssh raspberry-pi






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 at 7:36









ArekS

213




213












  • For the ssh response to arrive back the private IP should be SNATed a.k.a MASQUERADE
    – Nizam Mohamed
    Nov 11 at 7:42






  • 1




    pi@externail.no-ip.org Doesn’t look like a valid hostname - external.no-ip.org is what you should use. Also, if you use ping external.no-ip.org does the hostname resolve to the correct IP address (of the WAN side of your router)?
    – barny
    Nov 11 at 9:38












  • Oh actually the other problem is going to be that you are mapping external port 50022 to pi port 22 - try making both port numbers the same port 22 or port 50022, if necessary changing your ssh service to use port 50022 (simplest to first try making the external port 22). Also, change one thing at a time and retest because if you change two things you won’t know which thing fixed the problem.
    – barny
    Nov 11 at 9:41










  • And make sure your pi firewall is allowing incoming on port 22 - you can check this on your local network.
    – barny
    Nov 11 at 9:42










  • Hi @barny, thank you for your suggestions. I am sorry, to fast pressed Enter. Will write full answer bellow.
    – ArekS
    Nov 11 at 11:14




















  • For the ssh response to arrive back the private IP should be SNATed a.k.a MASQUERADE
    – Nizam Mohamed
    Nov 11 at 7:42






  • 1




    pi@externail.no-ip.org Doesn’t look like a valid hostname - external.no-ip.org is what you should use. Also, if you use ping external.no-ip.org does the hostname resolve to the correct IP address (of the WAN side of your router)?
    – barny
    Nov 11 at 9:38












  • Oh actually the other problem is going to be that you are mapping external port 50022 to pi port 22 - try making both port numbers the same port 22 or port 50022, if necessary changing your ssh service to use port 50022 (simplest to first try making the external port 22). Also, change one thing at a time and retest because if you change two things you won’t know which thing fixed the problem.
    – barny
    Nov 11 at 9:41










  • And make sure your pi firewall is allowing incoming on port 22 - you can check this on your local network.
    – barny
    Nov 11 at 9:42










  • Hi @barny, thank you for your suggestions. I am sorry, to fast pressed Enter. Will write full answer bellow.
    – ArekS
    Nov 11 at 11:14


















For the ssh response to arrive back the private IP should be SNATed a.k.a MASQUERADE
– Nizam Mohamed
Nov 11 at 7:42




For the ssh response to arrive back the private IP should be SNATed a.k.a MASQUERADE
– Nizam Mohamed
Nov 11 at 7:42




1




1




pi@externail.no-ip.org Doesn’t look like a valid hostname - external.no-ip.org is what you should use. Also, if you use ping external.no-ip.org does the hostname resolve to the correct IP address (of the WAN side of your router)?
– barny
Nov 11 at 9:38






pi@externail.no-ip.org Doesn’t look like a valid hostname - external.no-ip.org is what you should use. Also, if you use ping external.no-ip.org does the hostname resolve to the correct IP address (of the WAN side of your router)?
– barny
Nov 11 at 9:38














Oh actually the other problem is going to be that you are mapping external port 50022 to pi port 22 - try making both port numbers the same port 22 or port 50022, if necessary changing your ssh service to use port 50022 (simplest to first try making the external port 22). Also, change one thing at a time and retest because if you change two things you won’t know which thing fixed the problem.
– barny
Nov 11 at 9:41




Oh actually the other problem is going to be that you are mapping external port 50022 to pi port 22 - try making both port numbers the same port 22 or port 50022, if necessary changing your ssh service to use port 50022 (simplest to first try making the external port 22). Also, change one thing at a time and retest because if you change two things you won’t know which thing fixed the problem.
– barny
Nov 11 at 9:41












And make sure your pi firewall is allowing incoming on port 22 - you can check this on your local network.
– barny
Nov 11 at 9:42




And make sure your pi firewall is allowing incoming on port 22 - you can check this on your local network.
– barny
Nov 11 at 9:42












Hi @barny, thank you for your suggestions. I am sorry, to fast pressed Enter. Will write full answer bellow.
– ArekS
Nov 11 at 11:14






Hi @barny, thank you for your suggestions. I am sorry, to fast pressed Enter. Will write full answer bellow.
– ArekS
Nov 11 at 11:14














1 Answer
1






active

oldest

votes

















up vote
0
down vote













the easy way would be to simply install dataplicity on your pi, they let you use one pi for free, its basically a ssh service that lets you access your pi over the internet.



are you able to access the pi using the ddns from within your network, i have used ssh on many linux computers like this and never had a problem oh and it could also be that your isp is blocking it.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    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: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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%2fstackoverflow.com%2fquestions%2f53246737%2fconnect-to-ssh-on-machine-behind-nat-with-forwarded-port%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    the easy way would be to simply install dataplicity on your pi, they let you use one pi for free, its basically a ssh service that lets you access your pi over the internet.



    are you able to access the pi using the ddns from within your network, i have used ssh on many linux computers like this and never had a problem oh and it could also be that your isp is blocking it.






    share|improve this answer

























      up vote
      0
      down vote













      the easy way would be to simply install dataplicity on your pi, they let you use one pi for free, its basically a ssh service that lets you access your pi over the internet.



      are you able to access the pi using the ddns from within your network, i have used ssh on many linux computers like this and never had a problem oh and it could also be that your isp is blocking it.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        the easy way would be to simply install dataplicity on your pi, they let you use one pi for free, its basically a ssh service that lets you access your pi over the internet.



        are you able to access the pi using the ddns from within your network, i have used ssh on many linux computers like this and never had a problem oh and it could also be that your isp is blocking it.






        share|improve this answer












        the easy way would be to simply install dataplicity on your pi, they let you use one pi for free, its basically a ssh service that lets you access your pi over the internet.



        are you able to access the pi using the ddns from within your network, i have used ssh on many linux computers like this and never had a problem oh and it could also be that your isp is blocking it.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 at 8:43









        doctor

        13




        13






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • 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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2fstackoverflow.com%2fquestions%2f53246737%2fconnect-to-ssh-on-machine-behind-nat-with-forwarded-port%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

            Florida Star v. B. J. F.

            Danny Elfman

            Lugert, Oklahoma