1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # VirtualBox TAP setup script for Solaris hosts.
|
---|
4 | # usage: ./tapinit.sh tapname
|
---|
5 | #
|
---|
6 | # format of TAP interface names MUST be like [name][number]
|
---|
7 | # example: tap0, tap1, tap2 etc.
|
---|
8 |
|
---|
9 | if [ -z "$1" ]; then
|
---|
10 | echo "Missing TAP interface name."
|
---|
11 | echo
|
---|
12 | echo "Usage: $0 tapifname"
|
---|
13 | exit 1
|
---|
14 | fi
|
---|
15 |
|
---|
16 | tap_name=`echo $1 | /usr/xpg4/bin/tr -s [:upper:] [:lower:]`
|
---|
17 | ppa=${tap_name##*[a-z]}
|
---|
18 | tap_name=$1
|
---|
19 | host_ip="192.168.1.10${ppa}"
|
---|
20 | guest_ip="192.168.1.20${ppa}"
|
---|
21 | netmask="255.255.255.0"
|
---|
22 |
|
---|
23 | /sbin/ifconfig $tap_name $host_ip destination $guest_ip netmask $netmask
|
---|
24 | /sbin/ifconfig $tap_name up
|
---|
25 |
|
---|
26 | # Output the TAP interface though not used by VirtualBox
|
---|
27 | echo "$tap_name"
|
---|
28 |
|
---|
29 | exit $?
|
---|
30 |
|
---|