Debian Codegraph @

share/doc/host-setup-with-networkd.txt

raw
1 compute-tools: Host Setup (with systemd-networkd)
2 =================================================
3
4
5 1. Debian Packages
6 -------------------
7
8 apt install systemd-networkd bridge-utils
9
10 Make sure to enable networkd (sudo systemctl enable systemd-networkd)
11 and convert /etc/network/interfaces (see systemd-networkd documentation).
12
13
14 2. Boot Parameters
15 ------------------
16
17 2.1 CGroup Memory Controller (optional)
18 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19
20 In order to enable the memory controller the following boot parameter needs to be used:
21
22 cgroup_enable=memory
23
24
25 2.2 CGroup Swap Controller (optional)
26 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27
28 In order to enable the swap controller the following boot parameter needs to be used:
29
30 swapaccount=1
31
32 2.3 vsyscall (legacy)
33 ~~~~~~~~~~~~~~~~~~~~~
34
35 In order to be able to execute binaries linked to older libc versions
36 (<= wheezy) on newer linux versions (>= buster), add the following boot
37 parameter (see #881813 for more information):
38
39 vsyscall=emulate
40
41
42 3. Networking
43 ~~~~~~~~~~~~~
44
45 3.1 Configure Network Bridge
46 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47
48 3.1.1 Bridge: 1 Interface, standalone, DHCP
49 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50
51 cat > /etc/systemd/network/bridge0.netdev << EOF
52 [NetDev]
53 Name=bridge0
54 Kind=bridge
55 EOF
56
57 cat > /etc/systemd/network/bridge0.network << EOF
58 [Match]
59 Name=bridge0
60
61 [Network]
62 DHCP=yes
63 EOF
64
65
66 3.1.2 Bridge: 1 Interface, standalone, static
67 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68
69 cat > /etc/systemd/network/bridge0.netdev << EOF
70 [NetDev]
71 Name=bridge0
72 Kind=bridge
73 EOF
74
75 cat > /etc/systemd/network/bridge0.network << EOF
76 [Match]
77 Name=bridge-0
78
79 [Network]
80 Address=10.0.0.2/24
81 Gateway=10.0.0.1
82 EOF
83
84
85 3.1.3 Bridge: 3 physical Interfaces, vlan, bonding, static
86 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87
88 cat > /etc/systemd/network/eno2.network<< EOF
89 [Match]
90 Name=eno2
91
92 [Network]
93 Bond=bond0
94 EOF
95
96 cat > /etc/systemd/network/eno3.network<< EOF
97 [Match]
98 Name=eno3
99
100 [Network]
101 Bond=bond0
102 EOF
103
104 cat > /etc/systemd/network/bond0.netdev << EOF
105 [NetDev]
106 Name=bond0
107 Kind=bond
108
109 [Bond]
110 Mode=802.3ad
111 TransmitHashPolicy=layer3+4
112 MIIMonitorSec=0.1
113 UpDelaySec=0.2
114 DownDelaySec=0.2
115 EOF
116
117 cat > /etc/systemd/network/bond0.network << EOF
118 [Match]
119 Name=bond0
120
121 [Network]
122 VLAN=100
123 EOF
124
125 cat > /etc/systemd/network/vlan-100.netdev << EOF
126 [NetDev]
127 Name=vlan-100
128 Kind=vlan
129
130 [VLAN]
131 Id=100
132 EOF
133
134 cat > /etc/systemd/network/vlan-100.network << EOF
135 [Match]
136 Name=vlan-100
137
138 [Network]
139 Bridge=bridge-100
140 EOF
141
142 cat > /etc/systemd/network/bridge-100.netdev << EOF
143 [NetDev]
144 Name=bridge-100
145 Kind=bridge
146 EOF
147
148 cat > /etc/systemd/network/bridge-100.network << EOF
149 [Match]
150 Name=bridge-100
151
152 [Network]
153 Address=10.100.0.2/24
154 Gateway=10.100.0.1
155 EOF
156
157
158 4. Enabling user namespace for unprivileged containers
159 ------------------------------------------------------
160
161 Linux supports unprivileged containers with the user namespace.
162 By default the user namespace is disabled on Debian systems (see #898446).
163 To enable user namespace, edit the following file for a permant change:
164
165 /etc/sysctl.d/zz-compute-tools.conf
166 sysctl -p
167
168 or enable it manually with:
169
170 echo 1 > /proc/sys/kernel/unprivileged_userns_clone
171
172 Note that containers need to be started with the correct
173 configuration in /etc/compute-tools/container/config to run unpriviled
174 (private-users option).
175
176
177 5. Enabling container-shell
178 ---------------------------
179
180 Managing privileged containers requires root privileges. In order to allow
181 unprivileged users to manage privileged containers without granting them
182 privileges or accounts, the container-shell can be used together with sudo
183 and a container user.
184
185 sudo adduser --gecos "compute-tools,,," \
186 --home /var/lib/open-infrastructure/container-shell \
187 --shell /usr/bin/container-shell
188
189
190 6. IPv4 and IPv6 dual-stack
191 ---------------------------
192
193 Examples for /etc/network/interfaces above work for IPv6 too when using correct
194 IPv6 addresses and netmasks.
195
196 In order to use dual-stack, bridges must have a IPv4 address assigned
197 (can be a dummy one from a privacy range or 127.0.0.0/8).
198
199 Let me repeat: dual-stack only works when you assign a primary IPv6 address
200 (private or public, doesn't matter) *and* add an additional IPv4 address.
201 Yes, the IPv4 address can be a private address, the containers can still
202 have a public IPv4 address.
203
204 A complete example looks like this:
205
206 auto bridge0
207 iface bridge0 inet6 static
208 address 2a07:6b47:4::4:1
209 netmask 48
210
211 up ip addr add 127.4.4.1 dev $IFACE
212 down ip addr del 127.4.4.1 dev $IFACE
213
214 bridge_fd 0
215 bridge_maxwait 0
216 bridge_stp 0
217 bridge-mcquerier 1