#!/bin/bash echo "Get MAC & IPs information ..." MAC_A="00:a0:f4:de:ad:cc" MAC_B="00:a0:f4:de:ad:cd" IP_A="192.168.33.188" MASK_A="255.255.255.0" GW_A="192.168.33.1" IP_B="3.11.33.188" MASK_B="255.255.255.0" GW_B="3.111.33.1" sleep 1 echo "Set LLA interface down .." ifconfig bond0 down ip link delete bond0 rmmod bonding sleep 1 echo "Set PRP interface down .." ifconfig prp0 down ip link delete prp0 sleep 1 echo "Set HSR interface down .." ifconfig hsr0 down ip link delete hsr0 sleep 1 echo "Set RSTP interface down .." ifconfig br0 down ip link delete br0 sleep 1 echo "Set DUAL interfaces down .." ifconfig eth2 0.0.0.0 down ifconfig eth3 0.0.0.0 down sleep 1 echo "Set MAC address ${MAC_A} to eth1 & eth2 interfaces .." ifconfig eth2 hw ether ${MAC_A} ifconfig eth3 hw ether ${MAC_A} sleep 1 echo "Set eth2 & eth3 interfaces up .." ifconfig eth2 up ifconfig eth3 up sleep 1 echo "Create br0 interface and add eth2 & eth3 ports .." brctl addbr br0 brctl addif br0 eth2 brctl addif br0 eth3 sleep 1 echo "Set br0 with IP=${IP_A} interface up .." /opt/edge-agent/ipv4-set eth2 MANUAL ip4 169.254.4.3/24 gw 169.254.4.1 /opt/edge-agent/ipv4-set eth3 MANUAL ip4 169.254.5.3/24 gw 169.254.5.1 ifconfig br0 ${IP_A} netmask ${MASK_A} up route add default gw ${GW_A} br0 sleep 1 echo "Start bridge br0 ..." brctl stp br0 on sleep 1 echo "Set rstp settings ..." mstpctl settreeprio br0 0 8 mstpctl settreeportprio br0 eth2 0 8 mstpctl setportpathcost br0 eth2 200000 mstpctl settreeportprio br0 eth3 0 8 mstpctl setportpathcost br0 eth3 200000 sleep 1 echo "Switch bridge mode from stp to rstp ..." mstpctl setforcevers br0 rstp sleep 1 echo "RSTP ready for PTP configuration ..." ifconfig > /tmp/start_redundancy.ok sleep 1