BRIDGE CONNECTION
the default network manager on Astra linux is "nmcli". Below an example script to create a bridge using nmcli and by cloning the same mac address of the network device
check network interfaces:
ip addr
change IF variable with the network interface you want to use with the bridge and use an IP you can actually ping with the conditional after the sleep command
cat > /tmp/mkbridge.sh <<'EOF'
#!/bin/bash
IF=eno1
CON=$(nmcli -g GENERAL.CONNECTION dev show $IF)
MAC=$(cat /sys/class/net/$IF/address)
nmcli con add type bridge ifname br0 con-name br0 bridge.stp no ipv4.method auto bridge.mac-address "$MAC"
nmcli con add type bridge-slave ifname $IF master br0 con-name br0-$IF
nmcli con mod "$CON" connection.autoconnect no
nmcli con down "$CON"
nmcli con up br0
nmcli con up br0-$IF
sleep 45
if ! ping -c2 -W2 172.31.99.1 >/dev/null 2>&1; then
# rollback
nmcli con down br0
nmcli con mod "$CON" connection.autoconnect yes
nmcli con up "$CON"
nmcli con delete br0-$IF br0
fi
EOF
sudo nohup bash /tmp/mkbridge.sh >/tmp/mkbridge.log 2>&1 &
this script will make automatically rollback if the creation goes wrong, you can fetch mkbridge.log to check what happened
sudo tail -n5 /tmp/mkbridge.log