Skip to content

Instantly share code, notes, and snippets.

@samueldr
Last active November 20, 2017 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samueldr/586073da46a4d7ff3c5984157154c723 to your computer and use it in GitHub Desktop.
Save samueldr/586073da46a4d7ff3c5984157154c723 to your computer and use it in GitHub Desktop.
samueldr's container bridge configuration
{ config, pkgs, ... }:
{
# ...
networking = {
# or DHCP
interfaces.eno1 = {
ip4 = [ { address = "142.x.x.x"; prefixLength = 24; } ];
#ip6 = [ { address = "'xxxx:xxxx:xxxx:xxxx::1"; prefixLength = 128; } ];
};
bridges = {
br0 = {
interfaces = [];
};
};
interfaces.br0 = {
ip4 = [{ address = "10.0.3.1"; prefixLength = 24; }];
#ip6 = [{ address = hostIp6; prefixLength = 7; }];
};
nat = {
enable = true;
externalInterface = "eno1";
internalIPs = ["10.0.3.0/24"];
internalInterfaces = ["ve-+" "vb-+"];
};
};
# ...
containers.some_name = {
privateNetwork = true;
hostBridge = "br0";
localAddress = "10.0.3.80/24";
config =
{ config, lib, pkgs, ... }:
{
networking.defaultGateway = "10.0.3.1";
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment