Skip to content

Commit 6cef1f1

Browse files
Merge pull request #92 from packethost/BMS-698-deb10-network-fix
Debian10 network fix
2 parents cfaa7aa + fcd05d4 commit 6cef1f1

File tree

3 files changed

+76
-2
lines changed

3 files changed

+76
-2
lines changed

packetnetworking/distros/debian/bonded.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,19 @@ def build(self):
1111
self.build_tasks()
1212

1313
def build_tasks(self):
14-
self.task_template("etc/network/interfaces", "bonded/etc_network_interfaces.j2")
14+
if (
15+
self.metadata.operating_system.distro == "debian"
16+
and self.metadata.operating_system.version == "10"
17+
):
18+
# Debian10 is failing if we don't configure the net this way
19+
self.task_template(
20+
"etc/network/interfaces", "bonded/etc_network_interfaces_debian10.j2"
21+
)
22+
else:
23+
self.task_template(
24+
"etc/network/interfaces", "bonded/etc_network_interfaces.j2"
25+
)
26+
1527
self.task_template("etc/modules", "bonded/etc_modules.j2", write_mode="a")
1628
self.tasks.update(generate_persistent_names_udev())
1729
return self.tasks

packetnetworking/distros/debian/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
versions = {
13-
"debian": ["10", "11", "12"],
13+
"debian": ["11", "12"],
1414
"ubuntu": ["18.04", "20.04", "22.04"],
1515
}
1616
versions = [[distro, version] for distro in versions for version in versions[distro]]
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
auto lo
2+
iface lo inet loopback
3+
4+
{% for bond in bonds | sort %}
5+
6+
auto {{ bond }}
7+
iface {{ bond }} inet {% if bond == "bond0" %}static{% else %}manual{% endif %}
8+
9+
{% if bond == "bond0" %}
10+
{% if ip4pub %}
11+
address {{ ip4pub.address }}
12+
netmask {{ ip4pub.netmask }}
13+
gateway {{ ip4pub.gateway }}
14+
{% else %}
15+
address {{ ip4priv.address }}
16+
netmask {{ ip4priv.netmask }}
17+
gateway {{ ip4priv.gateway }}
18+
{% endif %}
19+
hwaddress {{ interfaces[0].mac }}
20+
dns-nameservers {{ resolvers | sort | join(" ") }}
21+
22+
{% endif %}
23+
bond-downdelay 200
24+
bond-miimon 100
25+
bond-mode {{ net.bonding.mode }}
26+
bond-updelay 200
27+
bond-xmit_hash_policy layer3+4
28+
{% if net.bonding.mode == 4 %}
29+
bond-lacp-rate 1
30+
{% endif %}
31+
bond-slaves {{ bonds[bond] | map(attribute='name') | sort | join(' ') }}
32+
{% if bond == "bond0" %}
33+
{% if ip6pub %}
34+
35+
iface bond0 inet6 static
36+
address {{ ip6pub.address }}
37+
netmask {{ ip6pub.cidr }}
38+
gateway {{ ip6pub.gateway }}
39+
{% endif %}
40+
{% if ip4pub %}
41+
42+
auto bond0:0
43+
iface bond0:0 inet static
44+
address {{ ip4priv.address }}
45+
netmask {{ ip4priv.netmask }}
46+
{% for subnet in private_subnets | sort %}
47+
post-up route add -net {{ subnet }} gw {{ ip4priv.gateway }}
48+
post-down route del -net {{ subnet }} gw {{ ip4priv.gateway }}
49+
{% endfor %}
50+
{% endif %}
51+
{% endif %}
52+
{% endfor %}
53+
54+
{% for iface in interfaces | sort(attribute="name") %}
55+
56+
auto {{ iface.name }}
57+
iface {{ iface.name }} inet manual
58+
{% if iface.name != interfaces[0].name %}
59+
pre-up sleep 4
60+
{% endif %}
61+
bond-master bond0
62+
{% endfor %}

0 commit comments

Comments
 (0)