Networking: Difference between revisions

imported>Zie
m fix quoting problem. thanks @Fadenb for syntax highliting fix!
imported>DavHau
No edit summary
Line 63: Line 63:
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
     networking = {
     networking = {
    hostId = "deadb33f";
      hostId = "deadb33f";
    hostName = "nixos";
      hostName = "nixos";
       domain = "example.com";
       domain = "example.com";
       dhcpcd.enable = false;
       dhcpcd.enable = false;
Line 72: Line 72:
         prefixLength = 28;
         prefixLength = 28;
       }];
       }];
    vlans = {
      vlans = {
    vlan100 = { id=100; interface="eth0"; };
        vlan100 = { id=100; interface="eth0"; };
    vlan101 = { id=101; interface="eth0"; };
        vlan101 = { id=101; interface="eth0"; };
  };
      };
       interfaces.vlan100.ipv4.addresses = [{
       interfaces.vlan100.ipv4.addresses = [{
         address = "10.1.1.2";
         address = "10.1.1.2";
         prefixLength = 24;
         prefixLength = 24;
       }];
       }];
      interfaces.vlan101.ipv4.addresses = [{
    interfaces.vlan101.ipv4.addresses = [{
        address = "10.10.10.3";
      address = "10.10.10.3";
        prefixLength = 24;
      prefixLength = 24;
      }];
    }];
       defaultGateway = "192.168.1.1";
       defaultGateway = "192.168.1.1";
       nameservers = [ "1.1.1.1" "8.8.8.8" ];
       nameservers = [ "1.1.1.1" "8.8.8.8" ];
     };
     };
</syntaxhighlight>
</syntaxhighlight>