diff --git a/how-to-run-a-vm-with-nat-bridged-network.md b/how-to-run-a-vm-with-nat-bridged-network.md new file mode 100644 index 0000000..cd331da --- /dev/null +++ b/how-to-run-a-vm-with-nat-bridged-network.md @@ -0,0 +1,47 @@ +create a bridge configuration file, /tmp/virbro.xml : +```xml + + default + 9014424a-8422-40ec-94d1-9f593b98cb7a + + + + + + + + + +``` + +apply bridge configuration : +```sh +virsh net-define /tmp/virbr0.xml +virsh net-start virbr0 +``` + +optionnaly, make it to auto start : +```sh +virsh net-autostart virbr0 +``` + + +copy the VM start script +```sh +cp /nix/store/iim2hsbfj7kbxfygn741ica52fka6xk3-nixos-vm/bin/run-hedgedoc-vm ./run-vm-2 +``` + +change network options : +```sh +< -net nic,netdev=user.0,model=virtio -netdev user,id=user.0,"$QEMU_NET_OPTS" \ +--- +> -net nic,netdev=user.0,model=virtio -netdev bridge,br=virbr0,id=user.0,"$QEMU_NET_OPTS" \ +``` + + + +run the VM : +```sh +QEMU_NET_OPTS=helper=/run/wrappers/bin/qemu-bridge-helper ./run-vm-2 +``` +