]> git.sven.stormbind.net Git - sven/scripts.git/blob - home/fix-vbox-net.sh
add a workaround to bring up lokal host only virtualbox interfaces
[sven/scripts.git] / home / fix-vbox-net.sh
1 #!/bin/bash
2 VBoxManage list hostonlyifs |
3     while IFS= read -r line; do
4         if [[ ${line} =~ ^Name ]]; then
5             lastIf=$(echo ${line} | cut -d' ' -f 2)
6         fi
7
8         if [[ ${line} =~ ^IPAddress ]]; then
9             lastIfIP=$(echo ${line} | cut -d' ' -f 2)
10         fi
11
12         if [[ ${line} =~ ^NetworkMask ]]; then
13             lastIfNetM=$(echo ${line} | cut -d' ' -f 2)
14             sudo ip link set up dev ${lastIf}
15             sudo ip a a ${lastIfIP}/${lastIfNetM} dev ${lastIf}
16             unset -v lastIf lastIfIP lastIfNetM
17         fi
18     done