How can I specific local port when establish ssh connection?How do I tunnel SSH over SSH?SSH client...

Golf the smallest circle!

Why does a brace command group need spaces after the opening brace in POSIX Shell Grammar?

Being paid less than a "junior" colleague

Can I ask to speak to my future colleagues before accepting an offer?

Is there reliable evidence that depleted uranium from the 1999 NATO bombing is causing cancer in Serbia?

Why was Mal so quick to drop Bester in favour of Kaylee?

How to fix a dry solder pin in BGA package?

Details of video memory access arbitration in Space Invaders

Can I travel from Germany to England alone as an unaccompanied minor?

Different budgets within roommate group

Are these intended activities legal to do in the USA under the VWP?

Averting Real Women Don’t Wear Dresses

Do space suits measure "methane" levels or other biological gases?

Should I report a leak of confidential HR information?

I hit a pipe with a mower and now it won't turn

How can I get edges to bend to avoid crossing?

How hard is it to sell a home which is currently mortgaged?

3D nonogram, beginner's edition

Why is my line not appearing smooth?

What's the safest way to inform a new user of their password on my web site?

Inquiring about the possibility of a job

Does Anosov geodesic flow imply asphericity?

Why transcripts instead of degree certificates?

Questions about authorship rank and academic politics



How can I specific local port when establish ssh connection?


How do I tunnel SSH over SSH?SSH client connection not working to remote servers not workingSSH Server not answering connection requestsRestart a specific reverse ssh tunnel?Which processes do the ports (as communication connection endpoints) belong to in SSH port forwarding?SSH tunnel with different ssh portSSH session through jumphost via remote port forwardingCan't establish ssh connection: “debug1: read_passphrase: can't open /dev/tty: No such file or directory” and “Host key verification failed.”Can't do reverse SSH tunneling in LOCAL networkCan not access ssh fowarding port






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







0















I have two servers hosted in IDC. I can only use these port 20/21/22/23/3389/33101-33109 to establish connection between two server. The IDC network device will block any other package which source port or destination port not in 20/21/22/23/80/3389/33101-33109. But the source port of ssh is random. There is wild known that using command



ssh username@server -p remote_port


can easily specific remote port. So is there a parament or some way can specific local port so I can using maybe port 33101 to eastablish ssh connection?

My network topo just like this:
enter image description here










share|improve this question







New contributor



fajin yu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


























    0















    I have two servers hosted in IDC. I can only use these port 20/21/22/23/3389/33101-33109 to establish connection between two server. The IDC network device will block any other package which source port or destination port not in 20/21/22/23/80/3389/33101-33109. But the source port of ssh is random. There is wild known that using command



    ssh username@server -p remote_port


    can easily specific remote port. So is there a parament or some way can specific local port so I can using maybe port 33101 to eastablish ssh connection?

    My network topo just like this:
    enter image description here










    share|improve this question







    New contributor



    fajin yu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      0












      0








      0








      I have two servers hosted in IDC. I can only use these port 20/21/22/23/3389/33101-33109 to establish connection between two server. The IDC network device will block any other package which source port or destination port not in 20/21/22/23/80/3389/33101-33109. But the source port of ssh is random. There is wild known that using command



      ssh username@server -p remote_port


      can easily specific remote port. So is there a parament or some way can specific local port so I can using maybe port 33101 to eastablish ssh connection?

      My network topo just like this:
      enter image description here










      share|improve this question







      New contributor



      fajin yu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I have two servers hosted in IDC. I can only use these port 20/21/22/23/3389/33101-33109 to establish connection between two server. The IDC network device will block any other package which source port or destination port not in 20/21/22/23/80/3389/33101-33109. But the source port of ssh is random. There is wild known that using command



      ssh username@server -p remote_port


      can easily specific remote port. So is there a parament or some way can specific local port so I can using maybe port 33101 to eastablish ssh connection?

      My network topo just like this:
      enter image description here







      ssh






      share|improve this question







      New contributor



      fajin yu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share|improve this question







      New contributor



      fajin yu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share|improve this question




      share|improve this question






      New contributor



      fajin yu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      asked 1 hour ago









      fajin yufajin yu

      1




      1




      New contributor



      fajin yu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      New contributor




      fajin yu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          you can not specify the source port for ssh client.



          but you can use nc as a proxy, like this:



          ssh -p 33101 -o 'ProxyCommand nc -p 33101 %h %p' $SERVER_2


          refer:



          https://serverfault.com/questions/920007/how-can-i-set-the-source-port-for-ssh-on-unbuntu-server





          share








          New contributor



          PapEr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






















            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
            });


            }
            });






            fajin yu is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f526745%2fhow-can-i-specific-local-port-when-establish-ssh-connection%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









            0














            you can not specify the source port for ssh client.



            but you can use nc as a proxy, like this:



            ssh -p 33101 -o 'ProxyCommand nc -p 33101 %h %p' $SERVER_2


            refer:



            https://serverfault.com/questions/920007/how-can-i-set-the-source-port-for-ssh-on-unbuntu-server





            share








            New contributor



            PapEr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.
























              0














              you can not specify the source port for ssh client.



              but you can use nc as a proxy, like this:



              ssh -p 33101 -o 'ProxyCommand nc -p 33101 %h %p' $SERVER_2


              refer:



              https://serverfault.com/questions/920007/how-can-i-set-the-source-port-for-ssh-on-unbuntu-server





              share








              New contributor



              PapEr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.






















                0












                0








                0







                you can not specify the source port for ssh client.



                but you can use nc as a proxy, like this:



                ssh -p 33101 -o 'ProxyCommand nc -p 33101 %h %p' $SERVER_2


                refer:



                https://serverfault.com/questions/920007/how-can-i-set-the-source-port-for-ssh-on-unbuntu-server





                share








                New contributor



                PapEr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                you can not specify the source port for ssh client.



                but you can use nc as a proxy, like this:



                ssh -p 33101 -o 'ProxyCommand nc -p 33101 %h %p' $SERVER_2


                refer:



                https://serverfault.com/questions/920007/how-can-i-set-the-source-port-for-ssh-on-unbuntu-server






                share








                New contributor



                PapEr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.







                share


                share






                New contributor



                PapEr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                answered 4 mins ago









                PapErPapEr

                11 bronze badge




                11 bronze badge




                New contributor



                PapEr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.




                New contributor




                PapEr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.
























                    fajin yu is a new contributor. Be nice, and check out our Code of Conduct.










                    draft saved

                    draft discarded


















                    fajin yu is a new contributor. Be nice, and check out our Code of Conduct.













                    fajin yu is a new contributor. Be nice, and check out our Code of Conduct.












                    fajin yu is a new contributor. Be nice, and check out our Code of Conduct.
















                    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%2f526745%2fhow-can-i-specific-local-port-when-establish-ssh-connection%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

                    Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                    Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                    Ciclooctatetraenă Vezi și | Bibliografie | Meniu de navigare637866text4148569-500570979m