ifdown-nat 734 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. BRIDGE=dragonos-bridge
  3. if [ -n "$1" ]; then
  4. echo "正在断开接口 $1"
  5. ip link set $1 down
  6. brctl delif "$BRIDGE" $1
  7. tap=`brctl show | grep natnet | awk '{print $4}'`
  8. if [[ $tap != tap* ]];then
  9. ip link set "$BRIDGE" down
  10. brctl delbr "$BRIDGE"
  11. iptables -t nat -F
  12. kill `ps aux | grep dnsmasq | grep -v grep | awk '{print $2}'`
  13. echo "断开接口 $1 成功"
  14. echo "网桥 $BRIDGE 卸载成功"
  15. echo "dnsmasq 服务停止成功"
  16. exit 0
  17. else
  18. echo "断开接口 $1 成功"
  19. exit 0
  20. fi
  21. else
  22. echo "删除错误:未指定接口"
  23. exit 1
  24. fi