Skip to content

Commit

Permalink
Add IOU support and install config in /etc
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-duponchelle committed Mar 25, 2016
1 parent 3fe8016 commit 38a86e7
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions scripts/remote-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
function help {
echo "Usage:" >&2
echo "--with-openvpn: Install Open VPN" >&2
echo "--with-iou: Install IOU" >&2
echo "--help: This help" >&2
}

Expand All @@ -42,8 +43,9 @@ fi

# Read the options
USE_VPN=0
USE_IOU=0

TEMP=`getopt -o h --long with-openvpn,help -n 'gns3-remote-install.sh' -- "$@"`
TEMP=`getopt -o h --long with-openvpn,with-iou,help -n 'gns3-remote-install.sh' -- "$@"`
if [ $? != 0 ]
then
help
Expand All @@ -58,6 +60,10 @@ while true ; do
USE_VPN=1
shift
;;
--with-iou)
USE_IOU=1
shift
;;
-h|--help)
help
exit 1
Expand Down Expand Up @@ -107,17 +113,20 @@ fi
log "Add GNS3 to the docker group"
usermod -aG docker gns3

log "IOU setup"
#apt-get install -y gns3-iou
if [ $USE_IOU == 1 ]
then
log "IOU setup"
apt-get install -y gns3-iou

# Force the host name to gns3vm
hostnamectl set-hostname gns3vm
# Force the host name to gns3vm
hostnamectl set-hostname gns3vm

# Force hostid for IOU
dd if=/dev/zero bs=4 count=1 of=/etc/hostid
# Force hostid for IOU
dd if=/dev/zero bs=4 count=1 of=/etc/hostid

# Block iou call. The server is down
echo "127.0.0.254 xml.cisco.com" | tee --append /etc/hosts
# Block iou call. The server is down
echo "127.0.0.254 xml.cisco.com" | tee --append /etc/hosts
fi

log "Add gns3 to the kvm group"
usermod -aG kvm gns3
Expand All @@ -128,20 +137,19 @@ apt-get install -y vde2 uml-utilities

usermod -a -G vde2-net gns3

cat <<EOF > /etc/network/interfaces.d/qemu0.conf
cat <<EOFV > /etc/network/interfaces.d/qemu0.conf
# A vde network
auto qemu0
iface qemu0 inet static
address 172.16.0.1
netmask 255.255.255.0
vde2-switch -t qemu0
EOF
EOFV

log "Setup GNS3 server"


#TODO: 1.4.5 allow /etc/gns3/gns3_server.conf it's cleaner
cat <<EOF > /opt/gns3/gns3_server.conf
mkdir -p /etc/gns3
cat <<EOFC > /etc/gns3/gns3_server.conf
[Server]
host = 0.0.0.0
port = 8000
Expand All @@ -151,7 +159,9 @@ report_errors = True
[Qemu]
enable_kvm = True
EOF
EOFC
chown -R gns3:gns3 /etc/gns3
chmod -R 700 /etc/gns3

cat <<EOF > /etc/init/gns3.conf
description "GNS3 server"
Expand Down Expand Up @@ -193,7 +203,7 @@ if [ $USE_VPN == 1 ]
then
log "Setup VPN"

cat <<EOF > /opt/gns3/gns3_server.conf
cat <<EOF > /etc/gns3/gns3_server.conf
[Server]
host = 172.16.253.1
port = 8000
Expand Down

0 comments on commit 38a86e7

Please sign in to comment.