Last active
August 29, 2015 14:11
-
-
Save mevansam/7bd8298e3e5316008108 to your computer and use it in GitHub Desktop.
Re-enabling VBox networks if disabled by VPN tools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for device in $(VBoxManage list hostonlyifs | awk '/^Name:/ { print $2 }'); do \ | |
ipaddress=$(VBoxManage list hostonlyifs | grep -A 3 "$device" | awk '/IPAddress:/ { print $2 }'); \ | |
VBoxManage hostonlyif ipconfig $device --ip $ipaddress; \ | |
sudo ifconfig $device down; \ | |
sudo ifconfig $device up; \ | |
echo "Restarted $device with ip $ipaddress."; \ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run this copy and paste the following to a shell: