#!/bin/bash EMPTYBR=$(for br in /sys/devices/virtual/net/br*; do if [ ! -d $br ]; then continue; fi; ls $br/brif/ | grep -qv vxlan || echo ${br##*/br}; done) for id in $EMPTYBR do echo "removing unused customer bridge/vxlan id: $id" ip link del dev vxlan$id ip link set down br$id brctl delbr br$id done for route in $(vtysh -c "show ip route kernel" | grep 'unknown inactive' | awk '{ print $3 }') do echo "removing zombie route: $route" ip route add blackhole $route ip route del $route done #for route in $(vtysh -c "show ipv6 route kernel" | grep 'unknown inactive' | awk '{ print $3 }') # do # echo "removing zombie route: $route" # ip route add blackhole $route # ip route del $route #done