qemu user networking: forward non-localhost guest IPs to the host

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












1















I'm running a qemu VM in user networking mode and I'd like to be able to access forwarded ports from the host. Something like the following works well.



-netdev user,id=t0,hostfwd=tcp::9992-:9992 


But my VM makes an internal bridge network and I'd like to be able to access IPs from within that network. According to the documentation, the following should work but there's definitely something missing



-netdev user,id=t0,hostfwd=tcp:10.144.0.2:6868-10.144.0.2:6868


After adding a network alias for virbr0 or lo (sudo ifconfig virbr0 add 10.144.0.2) that host and port may respond to the netcat utility, but I'm having trouble contacting the services on the other side.



Is what I'm attempting possible? Here's my full invocation:



/usr/bin/qemu-system-x86_64 
-smp 1
-m 1024
-uuid 6780dc39-da5f-4dda-844c-59f81b1a3c4c
-pidfile cfdev-efi-state/qemu.pid
-enable-kvm
-machine q35,accel=kvm:tcg
-object rng-random,id=rng0,filename=/dev/urandom
-device virtio-rng-pci,rng=rng0
-drive file=cfdev-efi-state/disk.img,format=qcow2,index=0,media=disk
-boot d
-cdrom cfdev-efi.iso
-drive if=pflash,format=raw,file=/usr/share/ovmf/OVMF.fd
-device virtio-net-pci,netdev=t0,mac=52:7a:c1:64:44:26
-netdev user,id=t0,hostfwd=tcp::9992-:9992,hostfwd=tcp::9999-:9999,hostfwd=tcp:10.144.0.2:25555-10.144.0.2:25555,hostfwd=tcp:10.144.0.2:8844-10.144.0.2:8844,hostfwd=tcp:10.144.0.2:8443-10.144.0.2:8443,hostfwd=tcp:10.144.0.2:6868-10.144.0.2:6868
-nographic









share|improve this question


























    1















    I'm running a qemu VM in user networking mode and I'd like to be able to access forwarded ports from the host. Something like the following works well.



    -netdev user,id=t0,hostfwd=tcp::9992-:9992 


    But my VM makes an internal bridge network and I'd like to be able to access IPs from within that network. According to the documentation, the following should work but there's definitely something missing



    -netdev user,id=t0,hostfwd=tcp:10.144.0.2:6868-10.144.0.2:6868


    After adding a network alias for virbr0 or lo (sudo ifconfig virbr0 add 10.144.0.2) that host and port may respond to the netcat utility, but I'm having trouble contacting the services on the other side.



    Is what I'm attempting possible? Here's my full invocation:



    /usr/bin/qemu-system-x86_64 
    -smp 1
    -m 1024
    -uuid 6780dc39-da5f-4dda-844c-59f81b1a3c4c
    -pidfile cfdev-efi-state/qemu.pid
    -enable-kvm
    -machine q35,accel=kvm:tcg
    -object rng-random,id=rng0,filename=/dev/urandom
    -device virtio-rng-pci,rng=rng0
    -drive file=cfdev-efi-state/disk.img,format=qcow2,index=0,media=disk
    -boot d
    -cdrom cfdev-efi.iso
    -drive if=pflash,format=raw,file=/usr/share/ovmf/OVMF.fd
    -device virtio-net-pci,netdev=t0,mac=52:7a:c1:64:44:26
    -netdev user,id=t0,hostfwd=tcp::9992-:9992,hostfwd=tcp::9999-:9999,hostfwd=tcp:10.144.0.2:25555-10.144.0.2:25555,hostfwd=tcp:10.144.0.2:8844-10.144.0.2:8844,hostfwd=tcp:10.144.0.2:8443-10.144.0.2:8443,hostfwd=tcp:10.144.0.2:6868-10.144.0.2:6868
    -nographic









    share|improve this question
























      1












      1








      1








      I'm running a qemu VM in user networking mode and I'd like to be able to access forwarded ports from the host. Something like the following works well.



      -netdev user,id=t0,hostfwd=tcp::9992-:9992 


      But my VM makes an internal bridge network and I'd like to be able to access IPs from within that network. According to the documentation, the following should work but there's definitely something missing



      -netdev user,id=t0,hostfwd=tcp:10.144.0.2:6868-10.144.0.2:6868


      After adding a network alias for virbr0 or lo (sudo ifconfig virbr0 add 10.144.0.2) that host and port may respond to the netcat utility, but I'm having trouble contacting the services on the other side.



      Is what I'm attempting possible? Here's my full invocation:



      /usr/bin/qemu-system-x86_64 
      -smp 1
      -m 1024
      -uuid 6780dc39-da5f-4dda-844c-59f81b1a3c4c
      -pidfile cfdev-efi-state/qemu.pid
      -enable-kvm
      -machine q35,accel=kvm:tcg
      -object rng-random,id=rng0,filename=/dev/urandom
      -device virtio-rng-pci,rng=rng0
      -drive file=cfdev-efi-state/disk.img,format=qcow2,index=0,media=disk
      -boot d
      -cdrom cfdev-efi.iso
      -drive if=pflash,format=raw,file=/usr/share/ovmf/OVMF.fd
      -device virtio-net-pci,netdev=t0,mac=52:7a:c1:64:44:26
      -netdev user,id=t0,hostfwd=tcp::9992-:9992,hostfwd=tcp::9999-:9999,hostfwd=tcp:10.144.0.2:25555-10.144.0.2:25555,hostfwd=tcp:10.144.0.2:8844-10.144.0.2:8844,hostfwd=tcp:10.144.0.2:8443-10.144.0.2:8443,hostfwd=tcp:10.144.0.2:6868-10.144.0.2:6868
      -nographic









      share|improve this question














      I'm running a qemu VM in user networking mode and I'd like to be able to access forwarded ports from the host. Something like the following works well.



      -netdev user,id=t0,hostfwd=tcp::9992-:9992 


      But my VM makes an internal bridge network and I'd like to be able to access IPs from within that network. According to the documentation, the following should work but there's definitely something missing



      -netdev user,id=t0,hostfwd=tcp:10.144.0.2:6868-10.144.0.2:6868


      After adding a network alias for virbr0 or lo (sudo ifconfig virbr0 add 10.144.0.2) that host and port may respond to the netcat utility, but I'm having trouble contacting the services on the other side.



      Is what I'm attempting possible? Here's my full invocation:



      /usr/bin/qemu-system-x86_64 
      -smp 1
      -m 1024
      -uuid 6780dc39-da5f-4dda-844c-59f81b1a3c4c
      -pidfile cfdev-efi-state/qemu.pid
      -enable-kvm
      -machine q35,accel=kvm:tcg
      -object rng-random,id=rng0,filename=/dev/urandom
      -device virtio-rng-pci,rng=rng0
      -drive file=cfdev-efi-state/disk.img,format=qcow2,index=0,media=disk
      -boot d
      -cdrom cfdev-efi.iso
      -drive if=pflash,format=raw,file=/usr/share/ovmf/OVMF.fd
      -device virtio-net-pci,netdev=t0,mac=52:7a:c1:64:44:26
      -netdev user,id=t0,hostfwd=tcp::9992-:9992,hostfwd=tcp::9999-:9999,hostfwd=tcp:10.144.0.2:25555-10.144.0.2:25555,hostfwd=tcp:10.144.0.2:8844-10.144.0.2:8844,hostfwd=tcp:10.144.0.2:8443-10.144.0.2:8443,hostfwd=tcp:10.144.0.2:6868-10.144.0.2:6868
      -nographic






      networking routing qemu






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 25 at 20:20









      mangomango

      1062




      1062




















          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%2f502982%2fqemu-user-networking-forward-non-localhost-guest-ips-to-the-host%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%2f502982%2fqemu-user-networking-forward-non-localhost-guest-ips-to-the-host%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

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay