mirror of
https://github.com/nextcloud/vm.git
synced 2025-10-26 11:27:32 +00:00
parent
a1cf0952bc
commit
ecc83443bc
@ -456,39 +456,9 @@ then
|
||||
if [ "$IFACE" = "" ]
|
||||
then
|
||||
echo "IFACE is an emtpy value. Trying to set IFACE with another method..."
|
||||
IFCONFIG="/sbin/ifconfig"
|
||||
INTERFACES="/etc/network/interfaces"
|
||||
IFACE=$(ip -o link show | awk '{print $2,$9}' | grep 'UP' | cut -d ':' -f 1)
|
||||
ADDRESS=$(hostname -I | cut -d ' ' -f 1)
|
||||
NETMASK=$($IFCONFIG | grep -w inet |grep -v 127.0.0.1| awk '{print $4}' | cut -d ":" -f 2)
|
||||
GATEWAY=$(route -n|grep "UG"|grep -v "UGH"|cut -f 10 -d " ")
|
||||
|
||||
cat <<-IPCONFIG > "$INTERFACES"
|
||||
source /etc/network/interfaces.d/*
|
||||
|
||||
# The loopback network interface
|
||||
auto lo $IFACE
|
||||
iface lo inet loopback
|
||||
|
||||
# The primary network interface
|
||||
iface $IFACE inet static
|
||||
pre-up /sbin/ethtool -K $IFACE tso off
|
||||
pre-up /sbin/ethtool -K $IFACE gso off
|
||||
# Fixes https://github.com/nextcloud/vm/issues/92:
|
||||
pre-up ip link set dev $IFACE mtu 1430
|
||||
|
||||
# Best practice is to change the static address
|
||||
# to something outside your DHCP range.
|
||||
address $ADDRESS
|
||||
netmask $NETMASK
|
||||
gateway $GATEWAY
|
||||
|
||||
# This is an autoconfigured IPv6 interface
|
||||
# iface $IFACE inet6 auto
|
||||
|
||||
# Exit and save: [CTRL+X] + [Y] + [ENTER]
|
||||
# Exit without saving: [CTRL+X]
|
||||
IPCONFIG
|
||||
wget -q $STATIC/ip2.sh -P $SCRIPTS
|
||||
bash $SCRIPTS/ip2.sh
|
||||
rm $SCRIPTS/ip2.sh
|
||||
fi
|
||||
ifdown $IFACE
|
||||
sleep 1
|
||||
|
||||
41
static/ip2.sh
Normal file
41
static/ip2.sh
Normal file
@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This file is only used if IFACE fail in the startup-script
|
||||
|
||||
IFCONFIG="/sbin/ifconfig"
|
||||
INTERFACES="/etc/network/interfaces"
|
||||
|
||||
IFACE=$(ip -o link show | awk '{print $2,$9}' | grep 'UP' | cut -d ':' -f 1)
|
||||
ADDRESS=$(hostname -I | cut -d ' ' -f 1)
|
||||
NETMASK=$($IFCONFIG | grep -w inet |grep -v 127.0.0.1| awk '{print $4}' | cut -d ":" -f 2)
|
||||
GATEWAY=$(route -n|grep "UG"|grep -v "UGH"|cut -f 10 -d " ")
|
||||
|
||||
cat <<-IPCONFIG > "$INTERFACES"
|
||||
source /etc/network/interfaces.d/*
|
||||
|
||||
# The loopback network interface
|
||||
auto lo $IFACE
|
||||
iface lo inet loopback
|
||||
|
||||
# The primary network interface
|
||||
iface $IFACE inet static
|
||||
pre-up /sbin/ethtool -K $IFACE tso off
|
||||
pre-up /sbin/ethtool -K $IFACE gso off
|
||||
# Fixes https://github.com/nextcloud/vm/issues/92:
|
||||
pre-up ip link set dev $IFACE mtu 1430
|
||||
|
||||
# Best practice is to change the static address
|
||||
# to something outside your DHCP range.
|
||||
address $ADDRESS
|
||||
netmask $NETMASK
|
||||
gateway $GATEWAY
|
||||
|
||||
# This is an autoconfigured IPv6 interface
|
||||
# iface $IFACE inet6 auto
|
||||
|
||||
# Exit and save: [CTRL+X] + [Y] + [ENTER]
|
||||
# Exit without saving: [CTRL+X]
|
||||
|
||||
IPCONFIG
|
||||
|
||||
exit 0
|
||||
Loading…
Reference in New Issue
Block a user