qemu user networking: forward non-localhost guest IPs to the host
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
New contributor
add a comment |
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
New contributor
add a comment |
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
New contributor
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
networking routing qemu
New contributor
New contributor
New contributor
asked 3 hours ago
mangomango
1062
1062
New contributor
New contributor
add a comment |
add a comment |
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
});
}
});
mango is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
mango is a new contributor. Be nice, and check out our Code of Conduct.
mango is a new contributor. Be nice, and check out our Code of Conduct.
mango is a new contributor. Be nice, and check out our Code of Conduct.
mango 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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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