File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash -x
22
3+ if [[ $( whoami) == root ]]; then
4+ echo " Applying Network Fix: Detecting interface and ignoring MAC mismatch..."
5+
6+ ETH_DEV=$( ip -o link show up | awk -F' : ' ' {print $2}' | grep -vE " ^(lo|docker|veth|br|virbr)" | head -n 1)
7+
8+ echo " Detected primary interface: $ETH_DEV "
9+
10+ if [[ -z " $ETH_DEV " ]]; then
11+ echo " WARNING: Could not detect interface, falling back to enp3s0"
12+ ETH_DEV=" enp3s0"
13+ fi
14+
15+ cat << EOF > /etc/netplan/99-force-dhcp.yaml
16+ network:
17+ version: 2
18+ ethernets:
19+ $ETH_DEV :
20+ dhcp4: true
21+ dhcp6: false
22+ match:
23+ name: $ETH_DEV
24+ set-name: $ETH_DEV
25+ EOF
26+
27+ rm -f /etc/netplan/50-cloud-init.yaml
28+
29+ chmod 600 /etc/netplan/99-force-dhcp.yaml
30+ netplan apply
31+
32+ ip link set $ETH_DEV up
33+
34+ echo " Waiting for DHCP on $ETH_DEV ..."
35+ sleep 5
36+ fi
37+
338if [[ $( whoami) == root ]]; then
439 # temporary hack to disable coredump to prevent OOM
540 systemctl mask systemd-coredump.socket
You can’t perform that action at this time.
0 commit comments