Networking: Difference between revisions

Yuannan (talk | contribs)
Yuannan (talk | contribs)
 
(One intermediate revision by the same user not shown)
Line 120: Line 120:


=== Virtualization ===
=== Virtualization ===
 
Sometimes complex network configurations with VPNs or firewall rules you may need extra configurations in order for your VMs to have network access. It is recommended to use more granular control over the ports instead of simply allowing the entire interface.<syntaxhighlight lang="nix">networking = {
== Sometimes with complex network configurations such as with VPNs or firewall rules you may need extra configurations in order for your VMs to have network access. ==
<syntaxhighlight lang="nix">
networking = {
   firewall = {
   firewall = {
     enable = true;
     enable = true;
      
      
     trustedInterfaces = [
     # Allows the entire interface through the firewall.
      "virbr0"
    # trustedInterfaces = [
     ];
    #  "virbr0"
     # ];
 
    # Allows individual ports through the firewall.
    interfaces = {
      virbr0 = {
        allowedUDPPorts = [
          # DNS
          53
          # DHCP
          67
          # You may want to allow more ports such as ipv6 and other services here.
        ];
      };
    };
   };
   };
   nat = {
   nat = {
Line 138: Line 149:
     ];
     ];
   };
   };
};
};</syntaxhighlight>
</syntaxhighlight>


== IPv6 ==
== IPv6 ==