Advertisement
ducnc

setup_ceph.sh

Jan 18th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.42 KB | None | 0 0
  1. #!/bin/bash
  2. MGNT_IP=10.193.0.51
  3. STORAGE_IP=10.0.30.51
  4. REPLICATE_IP=10.0.40.51
  5. NETMASK=255.255.255.0
  6. GATEWAY=10.193.0.1
  7.  
  8. #Install bonding
  9. grep bonding /etc/modules
  10. if ! [[ $? -eq 0 ]]; then
  11.     apt-get install ifenslave-2.6 -y
  12.     echo "bonding" >> /etc/modules
  13.     modprobe bonding
  14. fi
  15.  
  16. #Install vlan
  17. grep 8021q /etc/modules
  18. if ! [[ $? -eq 0 ]]; then
  19.     apt-get install vlan
  20.     modprobe 8021q
  21.     echo "8021q" >> /etc/modules
  22. fi
  23.  
  24. test -f /etc/network/interfaces | cp /etc/network/interfaces /etc/network/interfaces.bka
  25.  
  26. cat << EOF > /etc/network/interfaces
  27. #Bond0
  28. auto eth0
  29. iface eth0 inet manual
  30. bond-master bond0
  31.  
  32. auto eth1
  33. iface eth1 inet manual
  34. bond-master bond0
  35.  
  36. auto bond0
  37. iface bond0 inet static
  38. address $MGNT_IP
  39. netmask $NETMASK
  40. gateway $GATEWAY
  41. dns-nameservers 8.8.8.8
  42. bond-miimon 100
  43. bond-downdelay 0
  44. bond-updelay 0
  45. bond-mode 4
  46. bond-lacp-rate 1
  47. bond-slaves eth0 eth1
  48.  
  49.  
  50. #Bond2
  51. auto p6p1
  52. iface p6p1 inet manual
  53. bond-master bond2
  54. bond-primary p6p1
  55.  
  56. auto p6p2
  57. iface p6p2 inet manual
  58. bond-master bond2
  59.  
  60. auto bond2
  61. iface bond2 inet manual
  62. bond-slaves none
  63. bond-primary p6p1
  64. bond-mode active-backup
  65. bond-miimon 100
  66. bond-downdelay 200
  67. bond-updelay 200
  68.  
  69. EOF
  70.  
  71.  
  72. cat << EOF >> /etc/network/interfaces
  73. #VLANs
  74. auto bond2.30
  75. iface bond2.30 inet static
  76. address $STORAGE_IP
  77. netmask $NETMASK
  78.  
  79. auto bond2.40
  80. iface bond2.40 inet static
  81. address $REPLICATE_IP
  82. netmask $NETMASK
  83. EOF
  84.  
  85. ifdown -a && ifup -a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement