Advertisement
SkipIfEqual

stop_qemu_networking.sh

Aug 4th, 2011
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.73 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. #   Scrict basic code was taken from http://en.wikibooks.org/wiki/QEMU/Networking and modified.
  4. #       All copyrights belong to the original authors of the wikibooks article
  5. #       Last changed 2011/08/05
  6. #
  7. #       script to bring down the bridge/tap device after QEMU closed
  8. #
  9. #
  10. #       Redistribution and use in source and binary forms, with or without
  11. #       modification, are permitted provided that the following conditions are
  12. #       met:
  13. #      
  14. #       * Redistributions of source code must retain the above copyright
  15. #         notice, this list of conditions and the following disclaimer.
  16. #       * Redistributions in binary form must reproduce the above
  17. #         copyright notice, this list of conditions and the following disclaimer
  18. #         in the documentation and/or other materials provided with the
  19. #         distribution.
  20. #       * Neither the name of the authors nor the names of its
  21. #         contributors may be used to endorse or promote products derived from
  22. #         this software without specific prior written permission.
  23. #      
  24. #       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  25. #       "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  26. #       LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  27. #       A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  28. #       OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  29. #       SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  30. #       LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  31. #       DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  32. #       THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  33. #       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  34. #       OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. #      
  36. # Bring down eth0 and br0
  37. #
  38. echo "0/6.    STOP QEMU NETRWORK INTERFACE ----- ----- ----- ----- STOP QEMU NETRWORK INTERFACE"
  39. sbinPath=/usr/sbin
  40.  
  41. echo "1/6.    Bring down eth0 and br0"
  42. ifconfig eth0 down
  43. ifconfig br0 down
  44. #
  45. # Delete the bridge
  46. #
  47. echo "2/6.    Delete the bridge"
  48. ${sbinPath}/brctl delbr br0
  49. #
  50. # bring up eth0 in "normal" mode
  51. #
  52. echo "3/6.    Bring up eth0 in 'normal' mode"
  53. ifconfig eth0 -promisc
  54. ifconfig eth0 up
  55. #
  56. # delete the tap device
  57. #
  58. echo "4/6.    Delete the tap device $1"
  59. ${sbinPath}/openvpn --rmtun --dev $1
  60. #
  61. # start firewall again ... disabled (see start script)
  62. #
  63. #/sbin/service firestarter start
  64.  
  65. # Refreshing the DHCP settings
  66. echo "5/6.    Refreshing the DHCP"
  67. dhclient eth0 -r
  68. dhclient eth0
  69. echo "6/6.    FINISHED ----- ----- ----- ----- ----- ----- ----- FINISHED"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement