This commit is contained in:
spiritlhl 2023-06-26 01:17:02 +00:00
parent 00b1390ba0
commit e7aa515235
2 changed files with 15 additions and 10 deletions

View file

@ -116,6 +116,18 @@ iface vmbr0 inet static
bridge_stp off
bridge_fd 0
EOF
elif [ -f "/root/iface_auto.txt" ]; then
cat << EOF | sudo tee -a "$interfaces_file"
auto vmbr0
iface vmbr0 inet static
address $ipv4_address
gateway $gateway
bridge_ports $interface
bridge_stp off
bridge_fd 0
iface eth0 inet6 auto
EOF
else
cat << EOF | sudo tee -a "$interfaces_file"
auto vmbr0
@ -162,7 +174,7 @@ if grep -q "^net.ipv4.ip_forward=1" /etc/sysctl.conf; then
sed -i 's/^#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf
fi
else
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
fi
${sysctl_path} -p

View file

@ -1,7 +1,7 @@
#!/bin/bash
# from
# https://github.com/spiritLHLS/pve
# 2023.06.25
# 2023.06.26
cd /root >/dev/null 2>&1
_red() { echo -e "\033[31m\033[01m$@\033[0m"; }
@ -168,14 +168,7 @@ do
if [ -n "$matches" ]; then
# SLAAC动态分配做无IPV6的处理
sed -i "/iface $interface inet6 auto/d" $1
# cdn_urls=("https://cdn.spiritlhl.workers.dev/" "https://cdn3.spiritlhl.net/" "https://cdn1.spiritlhl.net/" "https://ghproxy.com/" "https://cdn2.spiritlhl.net/")
# check_cdn_file
# wget ${cdn_success_url}https://raw.githubusercontent.com/spiritLHLS/pve/main/extra_scripts/configure_network.sh -O /usr/local/bin/configure_network.sh
# wget ${cdn_success_url}https://raw.githubusercontent.com/spiritLHLS/pve/main/extra_scripts/configure_network.service -O /etc/systemd/system/configure_network.service
# chmod 777 /usr/local/bin/configure_network.sh
# chmod 777 /etc/systemd/system/configure_network.service
# systemctl daemon-reload
# systemctl enable configure_network.service
echo "$interface" > "/root/iface_auto.txt"
else
# 将 "auto" 替换为 "static"
modified_line="${line/auto/static}"