Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #
- # Scrict basic code was taken from http://en.wikibooks.org/wiki/QEMU/Networking and modified.
- # All copyrights belong to the original authors of the wikibooks article
- # Last changed 2011/08/05
- #
- # script to bring down the bridge/tap device after QEMU closed
- #
- #
- # Redistribution and use in source and binary forms, with or without
- # modification, are permitted provided that the following conditions are
- # met:
- #
- # * Redistributions of source code must retain the above copyright
- # notice, this list of conditions and the following disclaimer.
- # * Redistributions in binary form must reproduce the above
- # copyright notice, this list of conditions and the following disclaimer
- # in the documentation and/or other materials provided with the
- # distribution.
- # * Neither the name of the authors nor the names of its
- # contributors may be used to endorse or promote products derived from
- # this software without specific prior written permission.
- #
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- #
- # Bring down eth0 and br0
- #
- echo "0/6. STOP QEMU NETRWORK INTERFACE ----- ----- ----- ----- STOP QEMU NETRWORK INTERFACE"
- sbinPath=/usr/sbin
- echo "1/6. Bring down eth0 and br0"
- ifconfig eth0 down
- ifconfig br0 down
- #
- # Delete the bridge
- #
- echo "2/6. Delete the bridge"
- ${sbinPath}/brctl delbr br0
- #
- # bring up eth0 in "normal" mode
- #
- echo "3/6. Bring up eth0 in 'normal' mode"
- ifconfig eth0 -promisc
- ifconfig eth0 up
- #
- # delete the tap device
- #
- echo "4/6. Delete the tap device $1"
- ${sbinPath}/openvpn --rmtun --dev $1
- #
- # start firewall again ... disabled (see start script)
- #
- #/sbin/service firestarter start
- # Refreshing the DHCP settings
- echo "5/6. Refreshing the DHCP"
- dhclient eth0 -r
- dhclient eth0
- echo "6/6. FINISHED ----- ----- ----- ----- ----- ----- ----- FINISHED"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement