#!/bin/bash # configuració /etc/network/interfaces IPBASE="192.168.101." IFACE="eth2" # paquets apt-get update apt-get install -y bridge-utils # trobem numero de node numero=$(echo "$(hostname)" | grep -oE '[0-9]+$') # si no té número, és que és el frontend (.10) if [ -z "$numero" ]; then numero=0 fi lastipnum=$((10+$numero)) IP="$IPBASE$lastipnum" echo "Configurant xarxa br0 a "$(hostname)" : $IP" echo " # interficie física per al pont #auto $IFACE iface $IFACE inet manual # Bridge principal auto br0 # Bridge amb IP estàtica iface br0 inet static bridge_ports $IFACE bridge_stp off bridge_fd 0 bridge_maxwait 0 address $IP netmask 255.255.255.0 # gateway "$IPBASE"1 # gateway: Descomentar si cal " >> /etc/network/interfaces # reiniciem xarxa systemctl restart networking.service