2022-09-28 22:33:18 +02:00
|
|
|
{ config, pkgs, lib, ... } :
|
2022-09-25 12:54:31 +02:00
|
|
|
let
|
2023-07-14 23:53:25 +02:00
|
|
|
inherit (pkgs.liminix.networking) interface address route;
|
2022-09-25 12:54:31 +02:00
|
|
|
inherit (pkgs.liminix.services) oneshot longrun bundle target output;
|
|
|
|
in rec {
|
2022-09-28 22:33:18 +02:00
|
|
|
services.lan4 =
|
|
|
|
let iface = interface { type = "hardware"; device = "eth1";};
|
|
|
|
in address iface { family = "inet4"; address ="192.168.19.1"; prefixLength = 24;};
|
|
|
|
|
2023-07-14 23:23:11 +02:00
|
|
|
imports = [
|
|
|
|
../../modules/ppp
|
2023-07-14 23:53:25 +02:00
|
|
|
../../modules/dnsmasq
|
2023-07-14 23:23:11 +02:00
|
|
|
];
|
2022-09-25 22:12:23 +02:00
|
|
|
|
2022-09-25 12:54:31 +02:00
|
|
|
services.pppoe =
|
2023-07-14 23:23:11 +02:00
|
|
|
config.system.service.pppoe {
|
|
|
|
interface = interface { type = "hardware"; device = "eth0"; };
|
2022-09-25 22:12:23 +02:00
|
|
|
ppp-options = [
|
|
|
|
"debug" "+ipv6" "noauth"
|
|
|
|
"name" "db123@a.1"
|
|
|
|
"password" "NotReallyTheSecret"
|
|
|
|
];
|
|
|
|
};
|
2022-09-25 12:54:31 +02:00
|
|
|
|
2022-09-26 13:55:10 +02:00
|
|
|
services.defaultroute4 = route {
|
2023-07-14 23:23:11 +02:00
|
|
|
name = "defaultroute";
|
2022-10-02 17:35:55 +02:00
|
|
|
via = "$(output ${services.pppoe} address)";
|
2022-09-26 13:55:10 +02:00
|
|
|
target = "default";
|
|
|
|
dependencies = [ services.pppoe ];
|
|
|
|
};
|
|
|
|
|
|
|
|
services.packet_forwarding =
|
|
|
|
let
|
|
|
|
iface = services.pppoe;
|
2022-10-02 17:35:55 +02:00
|
|
|
filename = "/proc/sys/net/ipv4/conf/$(output ${iface} ifname)/forwarding";
|
2022-09-25 12:54:31 +02:00
|
|
|
in oneshot {
|
2022-09-26 13:55:10 +02:00
|
|
|
name = "let-the-ip-flow";
|
|
|
|
up = "echo 1 > ${filename}";
|
|
|
|
down = "echo 0 > ${filename}";
|
2022-09-25 12:54:31 +02:00
|
|
|
dependencies = [iface];
|
|
|
|
};
|
|
|
|
|
2022-09-28 22:33:18 +02:00
|
|
|
services.dns =
|
2023-07-14 23:53:25 +02:00
|
|
|
config.system.service.dnsmasq {
|
2022-09-28 22:33:18 +02:00
|
|
|
interface = services.lan4;
|
|
|
|
ranges = ["192.168.19.10,192.168.19.253"];
|
|
|
|
domain = "fake.liminix.org";
|
|
|
|
};
|
|
|
|
|
2022-09-25 12:54:31 +02:00
|
|
|
services.default = target {
|
|
|
|
name = "default";
|
2022-09-26 13:55:10 +02:00
|
|
|
contents = with services; [
|
2023-03-07 23:02:24 +01:00
|
|
|
config.hardware.networkInterfaces.lo
|
2022-09-26 13:55:10 +02:00
|
|
|
defaultroute4
|
|
|
|
packet_forwarding
|
2022-09-28 22:33:18 +02:00
|
|
|
dns
|
2022-09-26 13:55:10 +02:00
|
|
|
];
|
2022-09-25 12:54:31 +02:00
|
|
|
};
|
2022-09-27 17:17:55 +02:00
|
|
|
defaultProfile.packages = [ pkgs.hello ] ;
|
2022-09-25 12:54:31 +02:00
|
|
|
}
|