diff options
author | Guillaume Girol <symphorien@users.noreply.github.com> | 2022-01-01 17:04:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-01 17:04:29 +0000 |
commit | fdc3784828dac4ebb465e1f4b5ac48af7c9e1a0b (patch) | |
tree | 28543dfb8a7607d3963c293285c874e590286669 /nixos/modules/tasks/network-interfaces.nix | |
parent | e426ec42beb6bbc02652e1a12c762e0122c847c6 (diff) | |
parent | 5ce70619451a18ba35de9cc9c8ab7af3ee1420a5 (diff) | |
download | nixpkgs-fdc3784828dac4ebb465e1f4b5ac48af7c9e1a0b.tar nixpkgs-fdc3784828dac4ebb465e1f4b5ac48af7c9e1a0b.tar.gz nixpkgs-fdc3784828dac4ebb465e1f4b5ac48af7c9e1a0b.tar.bz2 nixpkgs-fdc3784828dac4ebb465e1f4b5ac48af7c9e1a0b.tar.lz nixpkgs-fdc3784828dac4ebb465e1f4b5ac48af7c9e1a0b.tar.xz nixpkgs-fdc3784828dac4ebb465e1f4b5ac48af7c9e1a0b.tar.zst nixpkgs-fdc3784828dac4ebb465e1f4b5ac48af7c9e1a0b.zip |
Merge pull request #148637 from hexagonal-sun/network/gre-tap-tun
nixos/network: add gre virtual interfaces
Diffstat (limited to 'nixos/modules/tasks/network-interfaces.nix')
-rw-r--r-- | nixos/modules/tasks/network-interfaces.nix | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 3d1fa793eb3..854badb23f6 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -10,6 +10,7 @@ let interfaces = attrValues cfg.interfaces; hasVirtuals = any (i: i.virtual) interfaces; hasSits = cfg.sits != { }; + hasGres = cfg.greTunnels != { }; hasBonds = cfg.bonds != { }; hasFous = cfg.fooOverUDP != { } || filterAttrs (_: s: s.encapsulation != null) cfg.sits != { }; @@ -997,6 +998,65 @@ in }); }; + networking.greTunnels = mkOption { + default = { }; + example = literalExpression '' + { + greBridge = { + remote = "10.0.0.1"; + local = "10.0.0.22"; + dev = "enp4s0f0"; + type = "tap"; + }; + } + ''; + description = '' + This option allows you to define Generic Routing Encapsulation (GRE) tunnels. + ''; + type = with types; attrsOf (submodule { + options = { + + remote = mkOption { + type = types.nullOr types.str; + default = null; + example = "10.0.0.1"; + description = '' + The address of the remote endpoint to forward traffic over. + ''; + }; + + local = mkOption { + type = types.nullOr types.str; + default = null; + example = "10.0.0.22"; + description = '' + The address of the local endpoint which the remote + side should send packets to. + ''; + }; + + dev = mkOption { + type = types.nullOr types.str; + default = null; + example = "enp4s0f0"; + description = '' + The underlying network device on which the tunnel resides. + ''; + }; + + type = mkOption { + type = with types; enum [ "tun" "tap" ]; + default = "tap"; + example = "tap"; + apply = v: if v == "tun" then "gre" else "gretap"; + description = '' + Whether the tunnel routes layer 2 (tap) or layer 3 (tun) traffic. + ''; + }; + }; + }); + }; + networking.vlans = mkOption { default = { }; example = literalExpression '' @@ -1229,6 +1289,7 @@ in boot.kernelModules = [ ] ++ optional hasVirtuals "tun" ++ optional hasSits "sit" + ++ optional hasGres "gre" ++ optional hasBonds "bonding" ++ optional hasFous "fou"; |