diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-05-07 17:17:19 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-05-07 17:53:57 +0200 |
commit | 333bfe16c454d759e801425b5ef7cd435320a4b0 (patch) | |
tree | 26796f019b13adec306be9c88706f384a497eeb8 /nixos/modules/virtualisation | |
parent | 6f7aaf10a5beb6cc10ebe75674d9c8664bd187fa (diff) | |
download | nixlib-333bfe16c454d759e801425b5ef7cd435320a4b0.tar nixlib-333bfe16c454d759e801425b5ef7cd435320a4b0.tar.gz nixlib-333bfe16c454d759e801425b5ef7cd435320a4b0.tar.bz2 nixlib-333bfe16c454d759e801425b5ef7cd435320a4b0.tar.lz nixlib-333bfe16c454d759e801425b5ef7cd435320a4b0.tar.xz nixlib-333bfe16c454d759e801425b5ef7cd435320a4b0.tar.zst nixlib-333bfe16c454d759e801425b5ef7cd435320a4b0.zip |
Containers: Support setting up macvlan interfaces
By setting a line like MACVLANS="eno1" in /etc/containers/<name>.conf, the container will get an Ethernet interface named mv-eno1, which represents an additional MAC address on the physical eno1 interface. Thus the container has direct access to the physical network. You can specify multiple interfaces in MACVLANS. Unfortunately, you can't do this with wireless interfaces. Note that dhcpcd is disabled in containers by default, so you'll probably want to set networking.useDHCP = true; in the container, or configure a static IP address. To do: add a containers.* option for this, and a flag for "nixos-container create".
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r-- | nixos/modules/virtualisation/containers.nix | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix index 08c234b94133..a0238277f5d0 100644 --- a/nixos/modules/virtualisation/containers.nix +++ b/nixos/modules/virtualisation/containers.nix @@ -189,9 +189,13 @@ in "/nix/var/nix/gcroots/per-container/$INSTANCE" if [ "$PRIVATE_NETWORK" = 1 ]; then - extraFlags="--network-veth" + extraFlags+=" --network-veth" fi + for iface in $MACVLANS; do + extraFlags+=" --network-macvlan=$iface" + done + # If the host is 64-bit and the container is 32-bit, add a # --personality flag. ${optionalString (config.nixpkgs.system == "x86_64-linux") '' |