Compare commits

..

2 commits

Author SHA1 Message Date
5903ca453d Update cloud-init/10-network-init.sh 2024-12-10 13:06:49 +01:00
f314d9d35a Add cloud-init/10-network-init.sh 2024-12-10 13:03:26 +01:00
2 changed files with 23 additions and 1 deletions

View file

@ -0,0 +1,23 @@
#!/bin/bash
VLAN=$1
IP=$2
GATEWAY=$3
rm /etc/network/interfaces.d/*
echo "source /etc/network/interfaces.d/*" > /etc/network/interfaces
echo "" >> /etc/network/interfaces
echo "auto lo" >> /etc/network/interfaces
echo "iface lo inet loopback" >> /etc/network/interfaces
echo "auto eth1" > /etc/network/interfaces.d/ifcfg-eth1
echo "iface eth1 inet static" >> /etc/network/interfaces.d/ifcfg-eth1
echo " address 255.255.255.255/32" >> /etc/network/interfaces.d/ifcfg-eth1
echo "auto eth1.$VLAN" > /etc/network/interfaces.d/ifcfg-eth1.$VLAN
echo "iface eth1.$VLAN inet static" >> /etc/network/interfaces.d/ifcfg-eth1.$VLAN
echo " address $IP" >> /etc/network/interfaces.d/ifcfg-eth1.$VLAN
echo " gateway $GATEWAY" >> /etc/network/interfaces.d/ifcfg-eth1.$VLAN
service networking restart

View file

@ -18,7 +18,6 @@ then
echo "$(date) -- START CRON_LOCK -- $(hostname)" >> $FILE.log echo "$(date) -- START CRON_LOCK -- $(hostname)" >> $FILE.log
$2 $2
$3
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then