support.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/env bash
  2. # Required tools
  3. DOCKER="${DOCKER:-docker}"
  4. NSENTER="${NSENTER:-nsenter}"
  5. BRIDGE="${BRIDGE:-bridge}"
  6. BRCTL="${BRCTL:-brctl}"
  7. IPTABLES="${IPTABLES:-iptables}"
  8. NSDIR=/var/run/docker/netns
  9. BRIDGEIF=br0
  10. function die {
  11. echo $*
  12. exit 1
  13. }
  14. type -P ${DOCKER} > /dev/null || die "This tool requires the docker binary"
  15. type -P ${NSENTER} > /dev/null || die "This tool requires nsenter"
  16. type -P ${BRIDGE} > /dev/null || die "This tool requires bridge"
  17. type -P ${BRCTL} > /dev/null || die "This tool requires brctl"
  18. type -P ${IPTABLES} > /dev/null || die "This tool requires iptables"
  19. echo "iptables configuration"
  20. ${IPTABLES} -n -v -L -t filter
  21. ${IPTABLES} -n -v -L -t nat
  22. echo ""
  23. echo "Overlay network configuration"
  24. for networkID in $(${DOCKER} network ls --filter driver=overlay -q) ; do
  25. echo "Network ${networkID}"
  26. nspath=(${NSDIR}/*-$(echo ${networkID}| cut -c1-10))
  27. ${DOCKER} network inspect -v ${networkID}
  28. ${NSENTER} --net=${nspath[0]} ${BRIDGE} fdb show ${BRIDGEIF}
  29. ${NSENTER} --net=${nspath[0]} ${BRCTL} showmacs ${BRIDGEIF}
  30. echo ""
  31. done