Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debian10 network fix #92

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion packetnetworking/distros/debian/bonded.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,19 @@ def build(self):
self.build_tasks()

def build_tasks(self):
self.task_template("etc/network/interfaces", "bonded/etc_network_interfaces.j2")
if (
self.metadata.operating_system.distro == "debian"
and self.metadata.operating_system.version == "10"
):
# Debian10 is failing if we don't configure the net this way
self.task_template(
"etc/network/interfaces", "bonded/etc_network_interfaces_debian10.j2"
)
else:
self.task_template(
"etc/network/interfaces", "bonded/etc_network_interfaces.j2"
)

self.task_template("etc/modules", "bonded/etc_modules.j2", write_mode="a")
self.tasks.update(generate_persistent_names_udev())
return self.tasks
2 changes: 1 addition & 1 deletion packetnetworking/distros/debian/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


versions = {
"debian": ["10", "11", "12"],
"debian": ["11", "12"],
"ubuntu": ["18.04", "20.04", "22.04"],
}
versions = [[distro, version] for distro in versions for version in versions[distro]]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
auto lo
iface lo inet loopback

{% for bond in bonds | sort %}

auto {{ bond }}
iface {{ bond }} inet {% if bond == "bond0" %}static{% else %}manual{% endif %}

{% if bond == "bond0" %}
{% if ip4pub %}
address {{ ip4pub.address }}
netmask {{ ip4pub.netmask }}
gateway {{ ip4pub.gateway }}
{% else %}
address {{ ip4priv.address }}
netmask {{ ip4priv.netmask }}
gateway {{ ip4priv.gateway }}
{% endif %}
hwaddress {{ interfaces[0].mac }}
dns-nameservers {{ resolvers | sort | join(" ") }}

{% endif %}
bond-downdelay 200
bond-miimon 100
bond-mode {{ net.bonding.mode }}
bond-updelay 200
bond-xmit_hash_policy layer3+4
{% if net.bonding.mode == 4 %}
bond-lacp-rate 1
{% endif %}
bond-slaves {{ bonds[bond] | map(attribute='name') | sort | join(' ') }}
{% if bond == "bond0" %}
{% if ip6pub %}

iface bond0 inet6 static
address {{ ip6pub.address }}
netmask {{ ip6pub.cidr }}
gateway {{ ip6pub.gateway }}
{% endif %}
{% if ip4pub %}

auto bond0:0
iface bond0:0 inet static
address {{ ip4priv.address }}
netmask {{ ip4priv.netmask }}
{% for subnet in private_subnets | sort %}
post-up route add -net {{ subnet }} gw {{ ip4priv.gateway }}
post-down route del -net {{ subnet }} gw {{ ip4priv.gateway }}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}

{% for iface in interfaces | sort(attribute="name") %}

auto {{ iface.name }}
iface {{ iface.name }} inet manual
{% if iface.name != interfaces[0].name %}
pre-up sleep 4
{% endif %}
bond-master bond0
{% endfor %}