Skip to content

Commit 407a067

Browse files
committed
ifstate: configure sysctl on all hosts
1 parent 885db41 commit 407a067

File tree

3 files changed

+51
-34
lines changed

3 files changed

+51
-34
lines changed

hosts/ixp-as11201/configuration.nix

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ lib, pkgs, ... }:
1+
{ lib, config, pkgs, ... }:
22

33
let
44
macPeering = "12:6d:81:f8:61:de";
@@ -27,45 +27,15 @@ in
2727
mac = macPeering;
2828
}];
2929

30-
binScripts.tap-up = lib.mkAfter ''
30+
binScripts.tap-up = lib.mkAfter /* bash */ ''
3131
${lib.getExe' pkgs.iproute2 "ip"} link set 'vm-ixp-as11201p' up
3232
${lib.getExe' pkgs.iproute2 "ip"} link set dev 'vm-ixp-as11201p' master 'ixp-peering'
3333
'';
3434
};
3535

3636
networking.ifstate.settings.namespaces.ixp-peering = {
37-
options.sysctl =
38-
let
39-
options = {
40-
ipv6 = {
41-
# this machine should not participate in SLAAC
42-
accept_ra = 0;
43-
autoconf = 0;
44-
# no redirects nor evil RH0
45-
accept_redirects = 0;
46-
accept_source_route = 0;
47-
# no forwarding
48-
forwarding = 0;
49-
};
50-
ipv4 = {
51-
# no redirects nor source route
52-
accept_redirects = 0;
53-
send_redirects = 0;
54-
accept_source_route = 0;
55-
# handle arp requests strict
56-
arp_ignore = 1;
57-
arp_notify = 1;
58-
# do strict rp filtering
59-
rp_filter = 1;
60-
# no forwarding
61-
forwarding = 0;
62-
};
63-
};
64-
in
65-
{
66-
all = options;
67-
default = options;
68-
};
37+
# copy sysctl from default netns
38+
options.sysctl = config.networking.ifstate.settings.options.sysctl;
6939
interfaces = [
7040
{
7141
name = "any112";

modules/dd-ix/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
./mariadb.nix
1313
./monitoring.nix
1414
./redis.nix
15+
./sysctl.nix
1516
];
1617
}

modules/dd-ix/sysctl.nix

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
networking.ifstate.settings.options.sysctl =
3+
let
4+
options = {
5+
ipv6 = {
6+
# this machine should not participate in SLAAC
7+
autoconf = 0;
8+
# nor accept router advertisements
9+
accept_ra = 0;
10+
# no redirects nor evil RH0
11+
accept_redirects = 0;
12+
accept_source_route = 0;
13+
# no forwarding
14+
forwarding = 0;
15+
# unsolicited neighbour advertisements
16+
ndisc_notify = 1;
17+
};
18+
ipv4 = {
19+
# no redirects
20+
accept_redirects = 0;
21+
send_redirects = 0;
22+
accept_source_route = 0;
23+
# handle arp requests strict
24+
arp_ignore = 1;
25+
arp_notify = 1;
26+
# do strict rp filtering
27+
rp_filter = 1;
28+
# no forwarding
29+
forwarding = 0;
30+
};
31+
};
32+
in
33+
{
34+
all = options;
35+
default = options;
36+
net.core = {
37+
# Bufferbloat: fair queuing controlled delay
38+
default_qdisc = "cake";
39+
# tune SoftIRQ packet handling (5x)
40+
netdev_budget_usecs = 10000;
41+
netdev_budget = 1500;
42+
dev_weight = 320;
43+
netdev_max_backlog = 5000;
44+
};
45+
};
46+
}

0 commit comments

Comments
 (0)