You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.7 KiB

  1. #!/bin/bash
  2. #
  3. OLD_NAME=vague-router
  4. HNAME=router1
  5. sed -i "s/$OLD_NAME/$HNAME/g" /etc/hostname
  6. sed -i "s/$OLD_NAME/$HNAME/g" /etc/hosts
  7. hostname $HNAME
  8. apt-get update
  9. apt-get install quagga quagga-doc traceroute
  10. cp /usr/share/doc/quagga/examples/zebra.conf.sample /etc/quagga/zebra.conf
  11. cp /usr/share/doc/quagga/examples/ospfd.conf.sample /etc/quagga/ospfd.conf
  12. chown quagga.quaggavty /etc/quagga/*.conf
  13. chmod 640 /etc/quagga/*.conf
  14. sed -i s'/zebra=no/zebra=yes/' /etc/quagga/daemons
  15. sed -i s'/ospfd=no/ospfd=yes/' /etc/quagga/daemons
  16. echo 'VTYSH_PAGER=more' >>/etc/environment
  17. echo 'export VTYSH_PAGER=more' >>/etc/bash.bashrc
  18. cat >> /etc/quagga/ospfd.conf << EOF
  19. interface enp0s8
  20. interface enp0s9
  21. interface enp0s10
  22. interface lo
  23. router ospf
  24. passive-interface enp0s8
  25. network 192.168.1.0/24 area 0.0.0.0
  26. network 192.168.100.0/24 area 0.0.0.0
  27. network 192.168.101.0/24 area 0.0.0.0
  28. line vty
  29. EOF
  30. cat >> /etc/quagga/zebra.conf << EOF
  31. interface enp0s8
  32. ip address 192.168.1.254/24
  33. ipv6 nd suppress-ra
  34. interface enp0s9
  35. ip address 192.168.100.1/24
  36. ipv6 nd suppress-ra
  37. interface enp0s10
  38. ip address 192.168.101.2/24
  39. ipv6 nd suppress-ra
  40. interface lo
  41. ip forwarding
  42. line vty
  43. EOF
  44. /etc/init.d/quagga start
  45. # Disable rp_filter and enable forwarding for routers
  46. #
  47. echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
  48. echo "net.ipv4.conf.all.rp_filter=0" >> /etc/sysctl.conf
  49. echo "net.ipv4.conf.default.rp_filter=0" >> /etc/sysctl.conf
  50. echo "net.ipv4.conf.lo.rp_filter=0" >> /etc/sysctl.conf
  51. echo "net.ipv4.conf.enp0s3.rp_filter=0" >> /etc/sysctl.conf
  52. echo "net.ipv4.conf.enp0s8.rp_filter=0" >> /etc/sysctl.conf
  53. echo "net.ipv4.conf.enp0s9.rp_filter=0" >> /etc/sysctl.conf
  54. echo "net.ipv4.conf.enp0s10.rp_filter=0" >> /etc/sysctl.conf
  55. sysctl -p
  56. exit