How to connect to guest vm(KVM) on remote host PC











up vote
0
down vote

favorite
1












I have dedicated server with ip.
I installed KVM, launched virtual machine(Centos), vm has internet connection(NAT), I installed and launched openssh server (22 port).
How can I connect to that VM via ssh?
Yes, i can connect to host pc via ssh, then from host pc connect to VM via ssh. But I want to connect to VM directly, without typing host PC password.
I think, i need forward ports? how to do that in right way?
P.S. host pc uses ppp0










share|improve this question


























    up vote
    0
    down vote

    favorite
    1












    I have dedicated server with ip.
    I installed KVM, launched virtual machine(Centos), vm has internet connection(NAT), I installed and launched openssh server (22 port).
    How can I connect to that VM via ssh?
    Yes, i can connect to host pc via ssh, then from host pc connect to VM via ssh. But I want to connect to VM directly, without typing host PC password.
    I think, i need forward ports? how to do that in right way?
    P.S. host pc uses ppp0










    share|improve this question
























      up vote
      0
      down vote

      favorite
      1









      up vote
      0
      down vote

      favorite
      1






      1





      I have dedicated server with ip.
      I installed KVM, launched virtual machine(Centos), vm has internet connection(NAT), I installed and launched openssh server (22 port).
      How can I connect to that VM via ssh?
      Yes, i can connect to host pc via ssh, then from host pc connect to VM via ssh. But I want to connect to VM directly, without typing host PC password.
      I think, i need forward ports? how to do that in right way?
      P.S. host pc uses ppp0










      share|improve this question













      I have dedicated server with ip.
      I installed KVM, launched virtual machine(Centos), vm has internet connection(NAT), I installed and launched openssh server (22 port).
      How can I connect to that VM via ssh?
      Yes, i can connect to host pc via ssh, then from host pc connect to VM via ssh. But I want to connect to VM directly, without typing host PC password.
      I think, i need forward ports? how to do that in right way?
      P.S. host pc uses ppp0







      ssh kvm virtualization






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Sep 3 '16 at 11:09









      Igor Kasuan

      112




      112






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          In my opinion, you need to set up a bridge on your host and assign IP(s) to your VM(s) in order to connect directly via ssh. Here is an example setup on this link (under title "Public Bridge"): http://www.linux-kvm.org/page/Networking






          share|improve this answer





















          • Thanks for reply. I have only 1 static ip for server. I can't understand how to differ 22 port of host pc and 22 port on VM at the same public IP. I want to have access <myPublicIp>:22 to my host server and allow access to VMs on other ports. for e.q.: <local VM1 address on host>:22 will be allowed on <myPublicIp>:2222 <local VM2 address on host>:22 will be allowed on <myPublicIp>:3333 etc.
            – Igor Kasuan
            Sep 3 '16 at 13:37










          • So you cannot get / assign IPs for your VMs, is that right?
            – B. Turan
            Sep 4 '16 at 7:24










          • yes, i have only 1 ip for my host pc; I solved that problem by transmitting input packets from my host's ports to internal VM's ports
            – Igor Kasuan
            Sep 5 '16 at 12:47










          • @IgorKasuan please post an answer with what you did to solve this (I'm guessing NAT rules with iptables?)
            – Robert Riedl
            Jan 20 at 10:11











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          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%2faskubuntu.com%2fquestions%2f820401%2fhow-to-connect-to-guest-vmkvm-on-remote-host-pc%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













          In my opinion, you need to set up a bridge on your host and assign IP(s) to your VM(s) in order to connect directly via ssh. Here is an example setup on this link (under title "Public Bridge"): http://www.linux-kvm.org/page/Networking






          share|improve this answer





















          • Thanks for reply. I have only 1 static ip for server. I can't understand how to differ 22 port of host pc and 22 port on VM at the same public IP. I want to have access <myPublicIp>:22 to my host server and allow access to VMs on other ports. for e.q.: <local VM1 address on host>:22 will be allowed on <myPublicIp>:2222 <local VM2 address on host>:22 will be allowed on <myPublicIp>:3333 etc.
            – Igor Kasuan
            Sep 3 '16 at 13:37










          • So you cannot get / assign IPs for your VMs, is that right?
            – B. Turan
            Sep 4 '16 at 7:24










          • yes, i have only 1 ip for my host pc; I solved that problem by transmitting input packets from my host's ports to internal VM's ports
            – Igor Kasuan
            Sep 5 '16 at 12:47










          • @IgorKasuan please post an answer with what you did to solve this (I'm guessing NAT rules with iptables?)
            – Robert Riedl
            Jan 20 at 10:11















          up vote
          0
          down vote













          In my opinion, you need to set up a bridge on your host and assign IP(s) to your VM(s) in order to connect directly via ssh. Here is an example setup on this link (under title "Public Bridge"): http://www.linux-kvm.org/page/Networking






          share|improve this answer





















          • Thanks for reply. I have only 1 static ip for server. I can't understand how to differ 22 port of host pc and 22 port on VM at the same public IP. I want to have access <myPublicIp>:22 to my host server and allow access to VMs on other ports. for e.q.: <local VM1 address on host>:22 will be allowed on <myPublicIp>:2222 <local VM2 address on host>:22 will be allowed on <myPublicIp>:3333 etc.
            – Igor Kasuan
            Sep 3 '16 at 13:37










          • So you cannot get / assign IPs for your VMs, is that right?
            – B. Turan
            Sep 4 '16 at 7:24










          • yes, i have only 1 ip for my host pc; I solved that problem by transmitting input packets from my host's ports to internal VM's ports
            – Igor Kasuan
            Sep 5 '16 at 12:47










          • @IgorKasuan please post an answer with what you did to solve this (I'm guessing NAT rules with iptables?)
            – Robert Riedl
            Jan 20 at 10:11













          up vote
          0
          down vote










          up vote
          0
          down vote









          In my opinion, you need to set up a bridge on your host and assign IP(s) to your VM(s) in order to connect directly via ssh. Here is an example setup on this link (under title "Public Bridge"): http://www.linux-kvm.org/page/Networking






          share|improve this answer












          In my opinion, you need to set up a bridge on your host and assign IP(s) to your VM(s) in order to connect directly via ssh. Here is an example setup on this link (under title "Public Bridge"): http://www.linux-kvm.org/page/Networking







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 3 '16 at 11:28









          B. Turan

          18714




          18714












          • Thanks for reply. I have only 1 static ip for server. I can't understand how to differ 22 port of host pc and 22 port on VM at the same public IP. I want to have access <myPublicIp>:22 to my host server and allow access to VMs on other ports. for e.q.: <local VM1 address on host>:22 will be allowed on <myPublicIp>:2222 <local VM2 address on host>:22 will be allowed on <myPublicIp>:3333 etc.
            – Igor Kasuan
            Sep 3 '16 at 13:37










          • So you cannot get / assign IPs for your VMs, is that right?
            – B. Turan
            Sep 4 '16 at 7:24










          • yes, i have only 1 ip for my host pc; I solved that problem by transmitting input packets from my host's ports to internal VM's ports
            – Igor Kasuan
            Sep 5 '16 at 12:47










          • @IgorKasuan please post an answer with what you did to solve this (I'm guessing NAT rules with iptables?)
            – Robert Riedl
            Jan 20 at 10:11


















          • Thanks for reply. I have only 1 static ip for server. I can't understand how to differ 22 port of host pc and 22 port on VM at the same public IP. I want to have access <myPublicIp>:22 to my host server and allow access to VMs on other ports. for e.q.: <local VM1 address on host>:22 will be allowed on <myPublicIp>:2222 <local VM2 address on host>:22 will be allowed on <myPublicIp>:3333 etc.
            – Igor Kasuan
            Sep 3 '16 at 13:37










          • So you cannot get / assign IPs for your VMs, is that right?
            – B. Turan
            Sep 4 '16 at 7:24










          • yes, i have only 1 ip for my host pc; I solved that problem by transmitting input packets from my host's ports to internal VM's ports
            – Igor Kasuan
            Sep 5 '16 at 12:47










          • @IgorKasuan please post an answer with what you did to solve this (I'm guessing NAT rules with iptables?)
            – Robert Riedl
            Jan 20 at 10:11
















          Thanks for reply. I have only 1 static ip for server. I can't understand how to differ 22 port of host pc and 22 port on VM at the same public IP. I want to have access <myPublicIp>:22 to my host server and allow access to VMs on other ports. for e.q.: <local VM1 address on host>:22 will be allowed on <myPublicIp>:2222 <local VM2 address on host>:22 will be allowed on <myPublicIp>:3333 etc.
          – Igor Kasuan
          Sep 3 '16 at 13:37




          Thanks for reply. I have only 1 static ip for server. I can't understand how to differ 22 port of host pc and 22 port on VM at the same public IP. I want to have access <myPublicIp>:22 to my host server and allow access to VMs on other ports. for e.q.: <local VM1 address on host>:22 will be allowed on <myPublicIp>:2222 <local VM2 address on host>:22 will be allowed on <myPublicIp>:3333 etc.
          – Igor Kasuan
          Sep 3 '16 at 13:37












          So you cannot get / assign IPs for your VMs, is that right?
          – B. Turan
          Sep 4 '16 at 7:24




          So you cannot get / assign IPs for your VMs, is that right?
          – B. Turan
          Sep 4 '16 at 7:24












          yes, i have only 1 ip for my host pc; I solved that problem by transmitting input packets from my host's ports to internal VM's ports
          – Igor Kasuan
          Sep 5 '16 at 12:47




          yes, i have only 1 ip for my host pc; I solved that problem by transmitting input packets from my host's ports to internal VM's ports
          – Igor Kasuan
          Sep 5 '16 at 12:47












          @IgorKasuan please post an answer with what you did to solve this (I'm guessing NAT rules with iptables?)
          – Robert Riedl
          Jan 20 at 10:11




          @IgorKasuan please post an answer with what you did to solve this (I'm guessing NAT rules with iptables?)
          – Robert Riedl
          Jan 20 at 10:11


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • 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%2faskubuntu.com%2fquestions%2f820401%2fhow-to-connect-to-guest-vmkvm-on-remote-host-pc%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

          Ellipse (mathématiques)

          Quarter-circle Tiles

          Mont Emei