Skip to content
Snippets Groups Projects
Commit 0b1832dd authored by Brandon Heller's avatar Brandon Heller
Browse files

Consolidate install script and add cmd-line options

Now, the majority the install can be done with one line, but the other
to each part of the install is still available.

Also fix a few bugs and add Wireshark coloring rules.
parent e91b2815
No related branches found
No related tags found
No related merge requests found
......@@ -28,20 +28,18 @@ def __init__( self, enable_all = True ):
rightHost = 4
# Add nodes
self._add_node( leftSwitch, Node( is_switch=True ) )
self._add_node( rightSwitch, Node( is_switch=True ) )
self._add_node( leftHost, Node( is_switch=False ) )
self._add_node( rightHost, Node( is_switch=False ) )
self.add_node( leftSwitch, Node( is_switch=True ) )
self.add_node( rightSwitch, Node( is_switch=True ) )
self.add_node( leftHost, Node( is_switch=False ) )
self.add_node( rightHost, Node( is_switch=False ) )
# Add edges
self._add_edge( leftHost, leftSwitch )
self._add_edge( leftSwitch, rightSwitch )
self._add_edge( rightSwitch, rightHost )
self.add_edge( leftHost, leftSwitch )
self.add_edge( leftSwitch, rightSwitch )
self.add_edge( rightSwitch, rightHost )
# Consider all switches and hosts 'on'
self.enable_all()
topos = { 'mytopo': MyTopo }
# topos = { 'mytopo': ( lambda: MyTopo() ) }
\ No newline at end of file
topos = { 'mytopo': ( lambda: MyTopo() ) }
# DO NOT EDIT THIS FILE! It was created by Wireshark
@Bad TCP@tcp.analysis.flags@[0,0,0][65535,24383,24383]
@HSRP State Change@hsrp.state != 8 && hsrp.state != 16@[0,0,0][65535,63222,0]
@Spanning Tree Topology Change@stp.type == 0x80@[0,0,0][65535,63222,0]
@OSPF State Change@ospf.msg != 1@[0,0,0][65535,63222,0]
@ICMP errors@icmp.type eq 3 || icmp.type eq 4 || icmp.type eq 5 || icmp.type eq 11@[0,0,0][0,65535,3616]
@ARP@arp@[55011,59486,65534][0,0,0]
@ICMP@icmp@[49680,49737,65535][0,0,0]
@TCP RST@tcp.flags.reset eq 1@[37008,0,0][65535,63121,32911]
@TTL low or unexpected@( ! ip.dst == 224.0.0.0/4 && ip.ttl < 5) || (ip.dst == 224.0.0.0/24 && ip.ttl != 1)@[37008,0,0][65535,65535,65535]
@of@of@[0,5,65535][65535,65535,65535]
@Checksum Errors@cdp.checksum_bad==1 || edp.checksum_bad==1 || ip.checksum_bad==1 || tcp.checksum_bad==1 || udp.checksum_bad==1@[0,0,0][65535,24383,24383]
@SMB@smb || nbss || nbns || nbipx || ipxsap || netbios@[65534,64008,39339][0,0,0]
@HTTP@http || tcp.port == 80@[36107,65535,32590][0,0,0]
@IPX@ipx || spx@[65534,58325,58808][0,0,0]
@DCERPC@dcerpc@[51199,38706,65533][0,0,0]
@Routing@hsrp || eigrp || ospf || bgp || cdp || vrrp || gvrp || igmp || ismp@[65534,62325,54808][0,0,0]
@TCP SYN/FIN@tcp.flags & 0x02 || tcp.flags.fin == 1@[41026,41026,41026][0,0,0]
@TCP@tcp@[59345,58980,65534][0,0,0]
@UDP@udp@[28834,57427,65533][0,0,0]
@Broadcast@eth[0] & 1@[65535,65535,65535][32768,32768,32768]
#!/bin/sh
#Brandon Heller (brandonh@stanford.edu)
#Install custom kernel on Debian Lenny
#The easy approach: download pre-built linux-image and linux-headers packages:
wget http://www.stanford.edu/~brandonh/linux-headers-2.6.29.6-custom_2.6.29.6-custom-10.00.Custom_i386.deb
wget http://www.stanford.edu/~brandonh/linux-image-2.6.29.6-custom_2.6.29.6-custom-10.00.Custom_i386.deb
#Install custom linux headers and image:
sudo dpkg -i linux-image-2.6.29.6-custom_2.6.29.6-custom-10.00.Custom_i386.deb linux-headers-2.6.29.6-custom_2.6.29.6-custom-10.00.Custom_i386.deb
#The default should be the new kernel. Otherwise, you may need to modify /boot/grub/menu.lst to set the default to the entry corresponding to the kernel you just installed.
#Reduce boot screen opt-out delay. Modify timeout in /boot/grub/menu.lst to 1:
sudo sed -i -e 's/^timeout.*$/timeout 1/' /boot/grub/menu.lst"
\ No newline at end of file
#!/bin/sh
#Brandon Heller (brandonh@stanford.edu)
#Clean up custom kernel on Debian Lenny (part 2)
#To save disk space, remove previous kernel
sudo apt-get -y remove linux-image-2.6.26-2-686
#Also remove downloaded packages:
rm linux-headers-2.6.29.6-custom_2.6.29.6-custom-10.00.Custom_i386.deb linux-image-2.6.29.6-custom_2.6.29.6-custom-10.00.Custom_i386.deb
\ No newline at end of file
#!/bin/sh
#Brandon Heller (brandonh@stanford.edu)
#Install Mininet deps on Debian Lenny
#Install dependencies:
sudo apt-get install -y screen psmisc xterm ssh iperf iproute python-setuptools
#Add sysctl parameters as noted in the INSTALL file to increase kernel limits to support larger setups:
sudo su -c "cat /home/mininet/mininet/util/sysctl_addon >> /etc/sysctl.conf"
#Load sysctl settings:
sudo sysctl -p
\ No newline at end of file
#!/bin/sh
#Brandon Heller (brandonh@stanford.edu)
#Install NOX on Debian Lenny
#Install NOX:
git clone git://noxrepo.org/noxcore
cd noxcore
./boot.sh
mkdir build
cd build
../configure --with-python=yes
make
#make check
#Add NOX_CORE_DIR env var;; modify ~/.bashrc:
sed -i -e 's|# for examples$|&\ncomplete -cf sudo|' ~/.bashrc
\ No newline at end of file
#!/bin/sh
#Brandon Heller (brandonh@stanford.edu)
#Install NOX deps on Debian Lenny
#Install NOX deps:
sudo apt-get -y install autoconf automake g++ libtool python python-twisted swig libboost1.35-dev libxerces-c2-dev libssl-dev make
#Install NOX optional deps:
sudo apt-get install -y libsqlite3-dev python-simplejson
\ No newline at end of file
#!/bin/sh
#Brandon Heller (brandonh@stanford.edu)
#Install OpenFlow and tools on Debian Lenny
#The following will cause a full OF install, with both user and kernel switch, dissector, tests, and everything.
#The instructions below are an abbreviated version from [[http://www.openflowswitch.org/wk/index.php/Debian_Install][ !OpenFlow Debian install instructions]], modified to use Debian Lenny rather than unstable.
sudo apt-get install -y git-core automake m4 pkg-config libtool make libc6-dev autoconf autotools-dev gcc
git clone git://openflowswitch.org/openflow.git
cd ~/openflow
#Switch to a temporary branch that should work on Debian Lenny.
git checkout -b debianfix origin/debianfix
#Install deps:
sudo regress/scripts/install_deps.pl
#Resume the install:
git fetch
git checkout -b release/0.8.9 origin/release/0.8.9
./boot.sh
./configure --with-l26=/lib/modules/`uname -r`
make
sudo make install
#Modify /etc/rc.local to auto-add the ofdatapath kmod on boot, as well as auto-add the tun module (used by user-space datapath to create a local switch port):
sudo sed -i -e 's|# By default this script does nothing.|&\nmodprobe tun\ninsmod /home/mininet/openflow/datapath/linux-2.6/ofdatapath.ko|' /etc/rc.local
#Run both commands now, before trying mininet:
sudo modprobe tun
sudo insmod /home/mininet/openflow/datapath/linux-2.6/ofdatapath.ko
#Install dissector:
sudo apt-get install -y wireshark libgtk2.0-dev
cd ~/openflow/utilities/wireshark_dissectors/openflow
make
sudo make install
#Remove avahi-daemon, which may cause unwanted discovery packets to be sent during tests, near link status changes:
sudo apt-get remove -y avahi-daemon
#Disable IPv6. Add to /etc/modprobe.d/blacklist.conf:
sudo sh -c "echo -e 'blacklist net-pf-10\nblacklist ipv6' > /etc/modprobe.d/blacklist.conf"
#Enable command auto completion using sudo; modify ~/.bashrc:
sudo sed -i -e 's|# for examples$|&\ncomplete -cf sudo|' ~/.bashrc
#!/bin/sh
#Brandon Heller (brandonh@stanford.edu)
#Install OVS on Debian Lenny
#Install OVS:
git clone git://openvswitch.org/openvswitch
cd openvswitch
./boot.sh
./configure --with-l26=/lib/modules/`uname -r`/build
make
\ No newline at end of file
#!/bin/sh
#Brandon Heller (brandonh@stanford.edu)
#Install OVS on Debian Lenny
#Install OVS:
cd openvswitch
sudo make install
\ No newline at end of file
#!/bin/sh
#Brandon Heller (brandonh@stanford.edu)
#Install OVS deps on Debian Lenny
#The following files were useful for the install process:
#OVS INSTALL file:
#http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=INSTALL.Linux;hb=HEAD
#OVS OpenFlow INSTALL file:
#http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=INSTALL.OpenFlow;hb=HEAD
#OVS README file:
#http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=README;hb=HEAD
#Install Autoconf 2.63+ backport from Debian Backports repo:
#Instructions from http://backports.org/dokuwiki/doku.php?id=instructions
sudo apt-get -y install debian-backports-keyring
sudo su -c "echo 'deb http://www.backports.org/debian lenny-backports main contrib non-free' >> /etc/apt/sources.list"
sudo apt-get update
sudo apt-get -y -t lenny-backports install autoconf
\ No newline at end of file
#!/bin/sh
#Brandon Heller (brandonh@stanford.edu)
#Install extra tools on Debian Lenny
#Install tcpdump and tshark, cmd-line packet dump tools. Also install gitk,
#a graphical git history viewer.
sudo apt-get install -y tcpdump tshark gitk
#Set git to colorize everything.
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
\ No newline at end of file
#!/bin/sh
#Brandon Heller (brandonh@stanford.edu)
#Clean up after VM installation
sudo apt-get clean
sudo rm -rf /tmp/*
history -c
rm ~/.ssh/id_rsa*
sudo rm ~/.ssh/authorized_keys2
sudo rm -rf ~/mininet
\ No newline at end of file
#!/usr/bin/env bash
# Mininet install script for Debian
# Brandon Heller (brandonh@stanford.edu)
# Fail on error
set -e
# Fail on unset var usage
set -o nounset
# Location of CONFIG_NET_NS-enabled kernel(s)
KERNEL_LOC=http://www.stanford.edu/~brandonh
# Kernel params
# These kernels have been tried:
#KERNEL_NAME=2.6.29.6-custom
#KERNEL_NAME=2.6.33-custom
KERNEL_NAME=2.6.33.1-custom
#KERNEL_NAME=`uname -r`
KERNEL_HEADERS=linux-headers-${KERNEL_NAME}_${KERNEL_NAME}-10.00.Custom_i386.deb
KERNEL_IMAGE=linux-image-${KERNEL_NAME}_${KERNEL_NAME}-10.00.Custom_i386.deb
# Kernel Deb pkg to be removed:
KERNEL_IMAGE_OLD=linux-image-2.6.26-2-686
DRIVERS_DIR=/lib/modules/${KERNEL_NAME}/kernel/drivers
OVS_RELEASE=openvswitch-0.99.2
#OVS_RELEASE=openvswitch
OVS_DIR=~/$OVS_RELEASE
OVS_KMOD=openvswitch_mod.ko
OF_DIR=~/openflow
OF_KMOD=ofdatapath.ko
function kernel {
echo "Install new kernel..."
# The easy approach: download pre-built linux-image and linux-headers packages:
wget $KERNEL_LOC/$KERNEL_HEADERS
wget $KERNEL_LOC/$KERNEL_IMAGE
#Install custom linux headers and image:
sudo dpkg -i $KERNEL_IMAGE $KERNEL_HEADERS
# The default should be the new kernel. Otherwise, you may need to modify /boot/grub/menu.lst to set the default to the entry corresponding to the kernel you just installed.
}
function kernel_clean {
echo "Cleaning kernel..."
# To save disk space, remove previous kernel
sudo apt-get -y remove $KERNEL_IMAGE_OLD
#Also remove downloaded packages:
rm -f ~/linux-headers-* ~/linux-image-*
}
# Install Mininet deps
function mn_deps {
#Install dependencies:
sudo apt-get install -y screen psmisc xterm ssh iperf iproute python-setuptools
#Add sysctl parameters as noted in the INSTALL file to increase kernel limits to support larger setups:
sudo su -c "cat /home/mininet/mininet/util/sysctl_addon >> /etc/sysctl.conf"
#Load new sysctl settings:
sudo sysctl -p
}
# The following will cause a full OF install, covering:
# -user switch
# -kernel switch
# -dissector
# The instructions below are an abbreviated version from
# http://www.openflowswitch.org/wk/index.php/Debian_Install
# ... modified to use Debian Lenny rather than unstable.
function of {
echo "Installing OpenFlow and its tools..."
cd ~/
sudo apt-get install -y git-core automake m4 pkg-config libtool make libc6-dev autoconf autotools-dev gcc
git clone git://openflowswitch.org/openflow.git
cd ~/openflow
git fetch
# Get debianfix branch, which doesn't break on test deps install
# This is an optional step.
git checkout -b debianfix origin/debianfix
sudo regress/scripts/install_deps.pl
# Resume the install:
git checkout -b release/0.8.9 origin/release/0.8.9
./boot.sh
./configure --with-l26=/lib/modules/${KERNEL_NAME}
make
sudo make install
# Install dissector:
sudo apt-get install -y wireshark libgtk2.0-dev
cd ~/openflow/utilities/wireshark_dissectors/openflow
make
sudo make install
# Copy coloring rules: OF is white-on-blue:
mkdir -p ~/.wireshark
cp ~/mininet/util/colorfilters ~/.wireshark
# Remove avahi-daemon, which may cause unwanted discovery packets to be sent during tests, near link status changes:
sudo apt-get remove -y avahi-daemon
# Disable IPv6. Add to /etc/modprobe.d/blacklist.conf:
sudo sh -c "echo -e 'blacklist net-pf-10\nblacklist ipv6' >> /etc/modprobe.d/blacklist.conf"
}
# Install OpenVSwitch
# Instructions derived from OVS INSTALL, INSTALL.OpenFlow and README files.
function ovs {
echo "Installing OpenVSwitch..."
#Install Autoconf 2.63+ backport from Debian Backports repo:
#Instructions from http://backports.org/dokuwiki/doku.php?id=instructions
sudo su -c "echo 'deb http://www.backports.org/debian lenny-backports main contrib non-free' >> /etc/apt/sources.list"
sudo apt-get update
sudo apt-get -y --force-yes install debian-backports-keyring
sudo apt-get -y -t lenny-backports install autoconf
#Install OVS from git
#git clone git://openvswitch.org/openvswitch
#cd openvswitch
#./boot.sh
#Install OVS from release
cd ~/
wget http://openvswitch.org/releases/${OVS_RELEASE}.tar.gz
tar xzf ${OVS_RELEASE}.tar.gz
cd $OVS_RELEASE
./configure --with-l26=/lib/modules/${KERNEL_NAME}/build
make
sudo make install
}
# Install NOX
function nox {
echo "Install NOX..."
#Install NOX deps:
sudo apt-get -y install autoconf automake g++ libtool python python-twisted swig libboost1.35-dev libxerces-c2-dev libssl-dev make
#Install NOX optional deps:
sudo apt-get install -y libsqlite3-dev python-simplejson
#Install NOX:
git clone git://noxrepo.org/noxcore
cd noxcore
# With later autoconf versions this doesn't work:
#./boot.sh
# So use this instead:
autoreconf --install --force
mkdir build
cd build
../configure --with-python=yes
make
#make check
# Add NOX_CORE_DIR env var:
sed -i -e 's|# for examples$|&\nexport NOX_CORE_DIR=~/noxcore/build/src|' ~/.bashrc
# To verify this install:
#cd ~/noxcore/build/src
#./nox_core -v -i ptcp:
}
function other {
echo "Doing other setup tasks..."
#Enable command auto completion using sudo; modify ~/.bashrc:
sed -i -e 's|# for examples$|&\ncomplete -cf sudo|' ~/.bashrc
#Install tcpdump and tshark, cmd-line packet dump tools. Also install gitk,
#a graphical git history viewer.
sudo apt-get install -y tcpdump tshark gitk
#Set git to colorize everything.
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
#Reduce boot screen opt-out delay. Modify timeout in /boot/grub/menu.lst to 1:
sudo sed -i -e 's/^timeout.*$/timeout 1/' /boot/grub/menu.lst
}
# Script to copy built OVS and OF kernel modules to where modprobe will
# find them automatically. Removes the need to keep an environment variable
# for each, and works nicely with multiple kernel versions.
#
# The downside is that after each recompilation of OVS or OF you'll need to
# re-run this script. If you're using only one kernel version, then it may be
# a good idea to use a symbolic link in place of the copy below.
function modprobe {
echo "Setting up modprobe for OVS kmod..."
sudo cp $OVS_DIR/datapath/linux-2.6/$OVS_KMOD $DRIVERS_DIR
echo "Setting up modprobe for OF kmod..."
sudo cp $OF_DIR/datapath/linux-2.6/$OF_KMOD $DRIVERS_DIR
sudo depmod -a
}
function all {
echo "Running all commands..."
kernel
mn_deps
of
ovs
modprobe
nox
other
echo "Please reboot, then run ./mininet/util/install.sh -c to remove unneeded packages."
echo "Enjoy Mininet!"
}
# Restore disk space and remove sensitive files before shipping a VM.
function vm_clean {
echo "Cleaning VM..."
sudo apt-get clean
sudo rm -rf /tmp/*
sudo rm -rf openvswitch*.tar.gz
# Remove sensistive files
history -c
rm ~/.ssh/id_rsa*
sudo rm ~/.ssh/authorized_keys2
# Remove Mininet files
sudo rm -rf ~/mininet
sudo rm /lib/modules/python2.5/site-packets/mininet*
sudo rm /usr/bin/mnexec
# Clear git changes
git config --global user.name "None"
git config --global user.email "None"
}
function usage {
printf "Usage: %s: [-acdfhkmntvx] args\n" $(basename $0) >&2
exit 2
}
if [ $# -eq 0 ]
then
all
else
while getopts 'acdfhkmntvx' OPTION
do
case $OPTION in
a) all;;
c) kernel_clean;;
d) vm_clean;;
f) of;;
h) usage;;
k) kernel;;
m) modprobe;;
n) mn_deps;;
t) other;;
v) ovs;;
x) nox;;
?) usage;;
esac
done
shift $(($OPTIND - 1))
fi
#!/bin/sh
# Script to copy built OVS and OF kernel modules to where modprobe will
# find them automatically. Removes the need to keep an environment variable
# for each, and works nicely with multiple kernel versions.
#
# The downside is that after each recompilation of OVS or OF you'll need to
# re-run this script. If you're using only one kernel version, then it may be
# a good idea to use a symbolic link in place of the copy below.
DRIVERS_DIR=/lib/modules/`uname -r`/kernel/drivers
OVS_DIR=~/openvswitch
OVS_KMOD=openvswitch_mod.ko
cp $OVS_DIR/datapath/linux-2.6/$OVS_KMOD $DRIVERS_DIR
OF_DIR=~/openflow
OF_KMOD=ofdatapath.ko
cp $OF_DIR/datapath/linux-2.6/$OF_KMOD $DRIVERS_DIR
# Update for modprobe
sudo depmod -a
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment