JonathanFerguson

Differences between revisions 53 and 54
Revision 53 as of 2012-09-15 04:57:16
Size: 10601
Comment: ./Quagga
Revision 54 as of 2012-09-15 04:59:01
Size: 1314
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#!/bin/bash

########################################################################################
# #
# Computer Program ./Quagga #
# Version 3 Saturday, 15 September, 2012 #
# Jonathan Ferguson http://Jonathan-Ferguson.tk/ #
# Copyright Act 1968 http://www.comlaw.gov.au/Current/C2012C00265 #
# #
########################################################################################

case "$1" in
 'remove')
  sudo /etc/init.d/quagga stop
  if [ $? -eq 0 ]
  then
   echo -e "\n\t[ Good ]\tWe have stopped the quagga daemon\n"
  else
   echo -e "\n\t[ Bad ]\t\tWe failed to stop the quagga daemon\n"
   exit 1
  fi

  sleep 10 \
  && sudo sed -i '/net.ipv6.conf.default.forwarding=1/d' /etc/sysctl.conf \
  && sed 's/net.ipv6.conf.all.forwarding=1/#net.ipv6.conf.all.forwarding=1/g' /etc/sysctl.conf | sudo tee /etc/sysctl.conf \
  && sudo sed -i '/net.ipv4.conf.default.forwarding=1/d' /etc/sysctl.conf \
  && sudo sed -i '/net.ipv4.conf.all.forwarding=1/d' /etc/sysctl.conf \
  && sudo sysctl -p
  if [ $? -eq 0 ]
  then
   echo -e "\n\t[ Good ]\tWe have disabled IP forwarding\n"
  else
   echo -e "\n\t[ Bad ]\t\tWe failed to disable IP forwarding\n"
   exit 1
  fi

  sleep 10 \
  && sudo rm /etc/quagga/bgpd.conf \
  && sudo rm /etc/quagga/isisd.conf \
  && sudo rm /etc/quagga/ospf6d.conf \
  && sudo rm /etc/quagga/ospfd.conf \
  && sudo rm /etc/quagga/ripd.conf \
  && sudo rm /etc/quagga/ripngd.conf \
  && sudo rm /etc/quagga/vtysh.conf \
  && sudo rm /etc/quagga/zebra.conf
  if [ $? -eq 0 ]
  then
   echo -e "\t[ Good ]\tWe have deleted Quagga's configuration files\n"
  else
   echo -e "\t[ Bad ]\t\tWe failed to delete Quagga's configuration files\n"
   exit 1
  fi

  sudo dpkg --purge quagga
  if [ $? -eq 0 ]
  then
   echo -e "\n\t[ Good ]\tYou're finished\n"
  else
   echo -e "\n\t[ Bad ]\t\tWe failed to uninstall quagga\n"
   exit 1
  fi

  exit 0
 ;;

 'install')
  sudo apt-get -y install quagga
  if [ $? -eq 0 ]
  then
   echo -e "\n\t[ Good ]\tWe have installed quagga\n"
  else
   echo -e "\n\t[ Bad ]\t\tWe failed to install quagga\n"
   exit 1
  fi

  sleep 10 \
  && sudo wget --no-cache --no-check-certificate -O /tmp/bgpd.conf "https://wiki.ubuntu.com/JonathanFerguson/Quagga?action=AttachFile&do=get&target=bgpd.conf" \
  && sudo wget --no-cache --no-check-certificate -O /tmp/isisd.conf "https://wiki.ubuntu.com/JonathanFerguson/Quagga?action=AttachFile&do=get&target=isisd.conf" \
  && sudo wget --no-cache --no-check-certificate -O /tmp/ospf6d.conf "https://wiki.ubuntu.com/JonathanFerguson/Quagga?action=AttachFile&do=get&target=ospf6d.conf" \
  && sudo wget --no-cache --no-check-certificate -O /tmp/ospfd.conf "https://wiki.ubuntu.com/JonathanFerguson/Quagga?action=AttachFile&do=get&target=ospfd.conf" \
  && sudo wget --no-cache --no-check-certificate -O /tmp/ripd.conf "https://wiki.ubuntu.com/JonathanFerguson/Quagga?action=AttachFile&do=get&target=ripd.conf" \
  && sudo wget --no-cache --no-check-certificate -O /tmp/ripngd.conf "https://wiki.ubuntu.com/JonathanFerguson/Quagga?action=AttachFile&do=get&target=ripngd.conf" \
  && sudo wget --no-cache --no-check-certificate -O /tmp/vtysh.conf "https://wiki.ubuntu.com/JonathanFerguson/Quagga?action=AttachFile&do=get&target=vtysh.conf" \
  && sudo wget --no-cache --no-check-certificate -O /tmp/zebra.conf "https://wiki.ubuntu.com/JonathanFerguson/Quagga?action=AttachFile&do=get&target=zebra.conf"
  if [ $? -eq 0 ]
  then
   echo -e "\t[ Good ]\tWe have downloaded the configuration files for quagga\n"
  else
   echo -e "\t[ Bad ]\t\tWe failed to download the configuration files for quagga\n"
   exit 1
  fi

  sleep 10 \
  && sudo mv -f /tmp/bgpd.conf /etc/quagga/bgpd.conf \
  && sudo mv -f /tmp/isisd.conf /etc/quagga/isisd.conf \
  && sudo mv -f /tmp/ospf6d.conf /etc/quagga/ospf6d.conf \
  && sudo mv -f /tmp/ospfd.conf /etc/quagga/ospfd.conf \
  && sudo mv -f /tmp/ripd.conf /etc/quagga/ripd.conf \
  && sudo mv -f /tmp/ripngd.conf /etc/quagga/ripngd.conf \
  && sudo mv -f /tmp/vtysh.conf /etc/quagga/vtysh.conf \
  && sudo mv -f /tmp/zebra.conf /etc/quagga/zebra.conf
  if [ $? -eq 0 ]
  then
   echo -e "\t[ Good ]\tWe have moved the configuration files to /etc/quagga\n"
  else
   echo -e "\t[ Bad ]\t\tWe failed to move the configuration files to /etc/quagga\n"
   exit 1
  fi

  sleep 10 \
  && sudo chown quagga:quagga /etc/quagga/bgpd.conf \
  && sudo chown quagga:quagga /etc/quagga/isisd.conf \
  && sudo chown quagga:quagga /etc/quagga/ospf6d.conf \
  && sudo chown quagga:quagga /etc/quagga/ospfd.conf \
  && sudo chown quagga:quagga /etc/quagga/ripd.conf \
  && sudo chown quagga:quagga /etc/quagga/ripngd.conf \
  && sudo chown quagga:quaggavty /etc/quagga/vtysh.conf \
  && sudo chown quagga:quagga /etc/quagga/zebra.conf
  if [ $? -eq 0 ]
  then
   echo -e "\t[ Good ]\tWe have made Quagga the owner of his configuration files\n"
  else
   echo -e "\t[ Bad ]\t\tWe failed to make Quagga the owner of his configuration files\n"
   exit 1
  fi

  sleep 10 \
  && sudo chmod 640 /etc/quagga/bgpd.conf \
  && sudo chmod 640 /etc/quagga/isisd.conf \
  && sudo chmod 640 /etc/quagga/ospf6d.conf \
  && sudo chmod 640 /etc/quagga/ospfd.conf \
  && sudo chmod 640 /etc/quagga/ripd.conf \
  && sudo chmod 640 /etc/quagga/ripngd.conf \
  && sudo chmod 660 /etc/quagga/vtysh.conf \
  && sudo chmod 640 /etc/quagga/zebra.conf
  if [ $? -eq 0 ]
  then
   echo -e "\t[ Good ]\tWe have changed the mode of Quagga's configuration files\n"
  else
   echo -e "\t[ Bad ]\t\tWe failed to change the mode of Quagga's configuration files\n"
   exit 1
  fi

  sleep 10 \
  && sudo sed -i 's/zebra=no/zebra=yes/g' /etc/quagga/daemons \
  && sudo sed -i 's/bgpd=no/bgpd=yes/g' /etc/quagga/daemons \
  && sudo sed -i 's/ospfd=no/ospfd=yes/g' /etc/quagga/daemons \
  && sudo sed -i 's/ospf6d=no/ospf6d=yes/g' /etc/quagga/daemons \
  && sudo sed -i 's/ripd=no/ripd=yes/g' /etc/quagga/daemons \
  && sudo sed -i 's/ripngd=no/ripngd=yes/g' /etc/quagga/daemons \
  && sudo sed -i 's/isisd=no/isisd=yes/g' /etc/quagga/daemons
  if [ $? -eq 0 ]
  then
   echo -e "\t[ Good ]\tWe have altered /etc/quagga/daemons\n"
  else
   echo -e "\t[ Bad ]\t\tWe failed to alter /etc/quagga/daemons\n"
   exit 1
  fi

  sleep 10 \
  && sudo sed -i 's/zebra_options=" --daemon -A 127.0.0.1"/zebra_options=" --daemon -A 127.0.0.1 -P 2601 -u quagga --keep_kernel --retain"/g' /etc/quagga/debian.conf \
  && sudo sed -i 's/bgpd_options=" --daemon -A 127.0.0.1"/bgpd_options=" --daemon -A 127.0.0.1 -P 2605 -u quagga --retain -p 179"/g' /etc/quagga/debian.conf \
  && sudo sed -i 's/ospfd_options=" --daemon -A 127.0.0.1"/ospfd_options=" --daemon -A 127.0.0.1 -P 2604 -u quagga"/g' /etc/quagga/debian.conf \
  && sudo sed -i 's/ospf6d_options="--daemon -A ::1"/ospf6d_options=" --daemon -A ::1 -P 2606 -u quagga"/g' /etc/quagga/debian.conf \
  && sudo sed -i 's/ripd_options=" --daemon -A 127.0.0.1"/ripd_options=" --daemon -A 127.0.0.1 -P 2602 -u quagga --retain"/g' /etc/quagga/debian.conf \
  && sudo sed -i 's/ripngd_options="--daemon -A ::1"/ripngd_options=" --daemon -A ::1 -P 2603 -u quagga --retain"/g' /etc/quagga/debian.conf \
  && sudo sed -i 's/isisd_options=" --daemon -A 127.0.0.1"/isisd_options=" --daemon -A 127.0.0.1 -P 2608 -u quagga"/g' /etc/quagga/debian.conf
  if [ $? -eq 0 ]
  then
   echo -e "\t[ Good ]\tWe have altered /etc/quagga/debian.conf\n"
  else
   echo -e "\t[ Bad ]\t\tWe failed to alter /etc/quagga/debian.conf\n"
   exit 1
  fi

  sleep 10 \
  && grep net.ipv4.conf.all.forwarding=1 /etc/sysctl.conf
  if [ $? -eq 1 ]
  then
   echo "net.ipv4.conf.all.forwarding=1" | sudo tee -a /etc/sysctl.conf
  fi
  grep net.ipv4.conf.default.forwarding=1 /etc/sysctl.conf
  if [ $? -eq 1 ]
  then
   echo "net.ipv4.conf.default.forwarding=1" | sudo tee -a /etc/sysctl.conf
  fi
  sed 's/#net.ipv6.conf.all.forwarding=1/net.ipv6.conf.all.forwarding=1/g' /etc/sysctl.conf | sudo tee /etc/sysctl.conf \
  && grep net.ipv6.conf.default.forwarding=1 /etc/sysctl.conf
  if [ $? -eq 1 ]
  then
   echo "net.ipv6.conf.default.forwarding=1" | sudo tee -a /etc/sysctl.conf
  fi
  sudo sysctl -p
  if [ $? -eq 0 ]
  then
   echo -e "\n\t[ Good ]\tWe have enabled IP forwarding\n"
  else
   echo -e "\n\t[ Bad ]\t\tWe failed to enable IP forwarding\n"
   exit 1
  fi

  sleep 10 \
  && sudo /etc/init.d/quagga restart
  if [ $? -eq 0 ]
  then
   echo -e "\n\t[ Good ]\tWe're done\n"
  else
   echo -e "\n\t[ Bad ]\t\tWe failed to restart the quagga daemon\n"
   exit 1
  fi

  exit 0
 ;;

 '')
  if [[ -f /etc/quagga/bgpd.conf && -f /etc/quagga/isisd.conf && -f /etc/quagga/ospf6d.conf && -f /etc/quagga/ospfd.conf && -f /etc/quagga/ripd.conf && -f /etc/quagga/ripngd.conf && -f /etc/quagga/vtysh.conf && -f /etc/quagga/zebra.conf ]]
  then
   declare currently="Installed"
  elif [[ -f /etc/quagga/bgpd.conf || -f /etc/quagga/isisd.conf || -f /etc/quagga/ospf6d.conf || -f /etc/quagga/ospfd.conf || -f /etc/quagga/ripd.conf || -f /etc/quagga/ripngd.conf || -f /etc/quagga/vtysh.conf || -f /etc/quagga/zebra.conf ]]
  then
   declare currently="Needs to be reinstalled"
  else
   declare currently="Not installed"
  fi

  echo -e "\nCurrently:\t$currently\n"
  echo -e "Install:\tsudo ./Quagga install"
  echo -e "Reinstall:\tsudo ./Quagga install"
  echo -e "Uninstall:\tsudo ./Quagga remove\n"

  exit 0
 ;;
esac

########################################################################################
# #
# Computer Program ./Quagga #
# Version 3 Saturday, 15 September, 2012 #
# Jonathan Ferguson http://Jonathan-Ferguson.tk/ #
# Copyright Act 1968 http://www.comlaw.gov.au/Current/C2012C00265 #
# #
########################################################################################
<<BR>>'''[[http://Jonathan-Ferguson.tk/|Internet Site: http://Jonathan-Ferguson.tk/]]'''
<<BR>>
<<BR>>'''[[https://launchpad.net/~jonathan-ferguson|Launchpad: jonathan-ferguson]]'''
<<BR>>
<<BR>>'''[[http://au.linkedin.com/pub/jonathan-ferguson/27/961/abb|Linkedin: Jonathan Ferguson]]'''
<<BR>>
<<BR>>[[https://shipit.edubuntu.org/|Shipit: Edubuntu]], received Version 6.06.1 LTS on Thursday the `12`^th^ of October, 2006.
<<BR>>[[https://shipit.edubuntu.org/|Shipit: Edubuntu]], received Version 7.04 on Wednesday the `9`^th^ of May, 2007.
<<BR>>[[https://shipit.edubuntu.org/|Shipit: Edubuntu]], received Version 7.10 on Wednesday the `7`^th^ of November, 2007.
<<BR>>[[https://shipit.edubuntu.org/|Shipit: Edubuntu]], received Version 8.04 LTS on Wednesday the `4`^th^ of June, 2008.
<<BR>>
<<BR>>'''Nuisances:'''
<<BR>> {{attachment:IconsPage/IconNIC.png}} [[http://www.linuxant.com/driverloader/wlan/full/downloads-ubuntu-x86.php|Broadcom Corporation BCM4318(rev 02)]] US$19.95
<<BR>> [[attachment:bcmwl5.sys]]
<<BR>> [[attachment:bcmwl5a.inf]]
<<BR>> `sudo dldrconfig --netdevname=eth1`
<<BR>>
<<BR>>'''My Intellectual Property:'''
<<BR>> {{attachment:IconsPage/terminal.png}} [[attachment:Quagga|./Quagga]]
<<BR>>
<<BR>>
----
''[[https://wiki.edubuntu.org/JonathanFerguson]]''
----


Internet Site: http://Jonathan-Ferguson.tk/

Launchpad: jonathan-ferguson

Linkedin: Jonathan Ferguson

Shipit: Edubuntu, received Version 6.06.1 LTS on Thursday the 12th of October, 2006.
Shipit: Edubuntu, received Version 7.04 on Wednesday the 9th of May, 2007.
Shipit: Edubuntu, received Version 7.10 on Wednesday the 7th of November, 2007.
Shipit: Edubuntu, received Version 8.04 LTS on Wednesday the 4th of June, 2008.

Nuisances:
IconsPage/IconNIC.png Broadcom Corporation BCM4318(rev 02) US$19.95
bcmwl5.sys
bcmwl5a.inf
sudo dldrconfig --netdevname=eth1

My Intellectual Property:
IconsPage/terminal.png ./Quagga


https://wiki.edubuntu.org/JonathanFerguson