diff --git a/configuration.nix b/configuration.nix index d06c61a..05ec793 100644 --- a/configuration.nix +++ b/configuration.nix @@ -122,7 +122,10 @@ users.users.heroz = { shell = pkgs.nushell; isNormalUser = true; - extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + extraGroups = [ + "wheel" + "libvirtd" + ]; # Enable ‘sudo’ for the user. packages = with pkgs; [ gnomeExtensions.blur-my-shell gnomeExtensions.appindicator @@ -137,6 +140,10 @@ ]; }; + virtualisation.libvirtd.enable = true; + boot.kernelModules = [ "kvm-intel" ]; + programs.virt-manager.enable = true; + # List packages installed in system profile. # You can use https://search.nixos.org/ to find more packages (and options). # environment.systemPackages = with pkgs; [ @@ -162,6 +169,7 @@ # networking.firewall.allowedUDPPorts = [ ... ]; # Or disable the firewall altogether. # networking.firewall.enable = false; + networking.firewall.trustedInterfaces = [ "virbr0" ]; # Copy the NixOS configuration file and link it from the resulting system # (/run/current-system/configuration.nix). This is useful in case you diff --git a/virbr0.xml b/virbr0.xml new file mode 100644 index 0000000..ad27ed7 --- /dev/null +++ b/virbr0.xml @@ -0,0 +1,5 @@ + + virbr0 + + + \ No newline at end of file diff --git a/vm-bridge-networking.md b/vm-bridge-networking.md new file mode 100644 index 0000000..6d40f50 --- /dev/null +++ b/vm-bridge-networking.md @@ -0,0 +1,29 @@ +# Bridge networking + +Create a XML file called virbr0.xml with the definition of the bridge interface +```xml + + virbr0 + + + +``` + +Add and enable bridge interface +```sh +virsh net-define virbr0.xml +virsh net-start virbr0 +ip link add virbr0 type bridge +ip address ad dev virbr0 10.25.0.1/24 +ip link set dev virbr0 up +``` + +Add a new network device to the vm : +```xml + + + + +
+ +``` \ No newline at end of file