Compare commits
3 Commits
2155bd60db
...
7c77818edf
| Author | SHA1 | Date | |
|---|---|---|---|
|
7c77818edf
|
|||
|
89fe727b3a
|
|||
|
031b935603
|
@ -79,17 +79,18 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: What other config options are there?
|
|
||||||
mkStaticNetworkManagerProfile = {
|
mkStaticNetworkManagerProfile = {
|
||||||
id,
|
id,
|
||||||
interface,
|
interface,
|
||||||
ip,
|
ip,
|
||||||
router,
|
router,
|
||||||
nameserver,
|
nameserver ? "8.8.8.8;8.8.4.4;",
|
||||||
autoconnect,
|
autoconnect ? true,
|
||||||
|
priority ? 0,
|
||||||
}: {
|
}: {
|
||||||
connection = {
|
connection = {
|
||||||
inherit id autoconnect;
|
inherit id autoconnect;
|
||||||
|
autoconnect-priority = "${priority}";
|
||||||
type = "ethernet";
|
type = "ethernet";
|
||||||
interface-name = interface;
|
interface-name = interface;
|
||||||
};
|
};
|
||||||
@ -100,5 +101,9 @@
|
|||||||
gateway = router;
|
gateway = router;
|
||||||
dns = nameserver;
|
dns = nameserver;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ipv6 = {
|
||||||
|
method = "disabled";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,22 +36,23 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# NetworkManager profiles
|
# NetworkManager profiles
|
||||||
|
# Run "nix run github:Janik-Haag/nm2nix | nix run github:kamadorueda/alejandra"
|
||||||
|
# in /etc/NetworkManager/system-connections/
|
||||||
profiles = {
|
profiles = {
|
||||||
"10-ether-2_5G" = mylib.networking.mkStaticNetworkManagerProfile {
|
"10-ether-2_5G" = mylib.networking.mkStaticNetworkManagerProfile {
|
||||||
id = "Wired 2.5G";
|
id = "Wired 2.5G";
|
||||||
interface = "enp8s0";
|
interface = "enp8s0";
|
||||||
ip = "192.168.86.50/24";
|
ip = "192.168.86.50/24";
|
||||||
router = "192.168.86.5";
|
router = "192.168.86.5";
|
||||||
nameserver = "192.168.86.26"; # TODO: Add fallback 8.8.8.8
|
nameserver = "192.168.86.26;8.8.8.8;";
|
||||||
autoconnect = true;
|
priority = 10; # Rather connect to 2.5G than to 1G
|
||||||
};
|
};
|
||||||
"10-ether-1G" = mylib.networking.mkStaticNetworkManagerProfile {
|
"10-ether-1G" = mylib.networking.mkStaticNetworkManagerProfile {
|
||||||
id = "Wired 1G";
|
id = "Wired 1G";
|
||||||
interface = "enp5s0";
|
interface = "enp5s0";
|
||||||
ip = "192.168.86.50/24";
|
ip = "192.168.86.50/24";
|
||||||
router = "192.168.86.5";
|
router = "192.168.86.5";
|
||||||
nameserver = "192.168.86.26"; # TODO: Add fallback 8.8.8.8
|
nameserver = "192.168.86.26;8.8.8.8;";
|
||||||
autoconnect = false;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,7 @@
|
|||||||
interface = "ens18";
|
interface = "ens18";
|
||||||
ips = ["192.168.86.25/24"];
|
ips = ["192.168.86.25/24"];
|
||||||
routers = ["192.168.86.5"];
|
routers = ["192.168.86.5"];
|
||||||
nameservers = ["192.168.86.26" "8.8.8.8"];
|
nameservers = ["8.8.8.8"]; # NOTE: Use reliable DNS for servers instead of 192.168.86.26
|
||||||
routable = true;
|
routable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
interface = "ens18";
|
interface = "ens18";
|
||||||
ips = ["192.168.86.26/24"];
|
ips = ["192.168.86.26/24"];
|
||||||
routers = ["192.168.86.5"];
|
routers = ["192.168.86.5"];
|
||||||
nameservers = ["127.0.0.1" "8.8.8.8"];
|
nameservers = ["8.8.8.8"]; # NOTE: Use reliable DNS for servers instead of 127.0.0.1
|
||||||
routable = true;
|
routable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -69,20 +69,28 @@
|
|||||||
# ${pkgs.iproute2}/bin/ip netns add ${name}
|
# ${pkgs.iproute2}/bin/ip netns add ${name}
|
||||||
# '';
|
# '';
|
||||||
|
|
||||||
|
# postSetup = ''
|
||||||
|
# ${pkgs.iptables}/bin/iptables -A FORWARD -i vps-wg-client -j ACCEPT
|
||||||
|
# ${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -o ens18 -j MASQUERADE
|
||||||
|
# '';
|
||||||
|
# postShutdown = ''
|
||||||
|
# ${pkgs.iptables}/bin/iptables -D FORWARD -i vps-wg-client -j ACCEPT
|
||||||
|
# ${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -o ens18 -j MASQUERADE
|
||||||
|
# '';
|
||||||
postSetup = ''
|
postSetup = ''
|
||||||
${pkgs.iptables}/bin/iptables -A FORWARD -i vps-wg-client -j ACCEPT
|
${pkgs.iptables} -A FORWARD -i wg0-client -j ACCEPT
|
||||||
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -o ens18 -j MASQUERADE
|
${pkgs.iptables} -t nat -A POSTROUTING -o eth0 -j MASQUERADE
|
||||||
'';
|
'';
|
||||||
postShutdown = ''
|
postShutdown = ''
|
||||||
${pkgs.iptables}/bin/iptables -D FORWARD -i vps-wg-client -j ACCEPT
|
${pkgs.iptables} -D FORWARD -i wg0-client -j ACCEPT
|
||||||
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -o ens18 -j MASQUERADE
|
${pkgs.iptables} -t nat -D POSTROUTING -o eth0 -j MASQUERADE
|
||||||
'';
|
'';
|
||||||
|
|
||||||
peers = [
|
peers = [
|
||||||
{
|
{
|
||||||
name = "chriphost-vps";
|
name = "chriphost-vps";
|
||||||
publicKey = "w/U8p9fizw0jk8PFaMZXV1N49Ws+q6mUHzNFYtoDTS8=";
|
publicKey = "w/U8p9fizw0jk8PFaMZXV1N49Ws+q6mUHzNFYtoDTS8=";
|
||||||
endpoint = "vps.chriphost.de:51820";
|
endpoint = "212.227.233.241:51820";
|
||||||
allowedIPs = [
|
allowedIPs = [
|
||||||
"10.10.10.0/24"
|
"10.10.10.0/24"
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user