forked from extern/nix-config
aaa0fe82cd
This was my working solution at forwarding ports from a container to the host. Although mullvad no longer supports port forwarding, this example can still be used to forward e.g. web services from containers to the host.
32 lines
557 B
Nix
32 lines
557 B
Nix
{ pkgs, ... }:
|
|
|
|
{
|
|
environment.systemPackages = [ pkgs.mullvad-vpn ];
|
|
|
|
services.mullvad-vpn = {
|
|
enable = true;
|
|
enableExcludeWrapper = false;
|
|
};
|
|
|
|
networking.firewall.allowedTCPPorts = [ 11918 ];
|
|
|
|
networking = {
|
|
nat = {
|
|
enable = true;
|
|
internalInterfaces = [ "ve-+" ];
|
|
externalInterface = "wg-mullvad";
|
|
|
|
forwardPorts = [
|
|
{
|
|
destination = "192.168.100.11:80";
|
|
sourcePort = 11918;
|
|
}
|
|
];
|
|
};
|
|
|
|
networkmanager = {
|
|
unmanaged = [ "interface-name:ve-*" ];
|
|
};
|
|
};
|
|
}
|