Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- MGNT_IP=10.193.0.51
- STORAGE_IP=10.0.30.51
- REPLICATE_IP=10.0.40.51
- NETMASK=255.255.255.0
- GATEWAY=10.193.0.1
- #Install bonding
- grep bonding /etc/modules
- if ! [[ $? -eq 0 ]]; then
- apt-get install ifenslave-2.6 -y
- echo "bonding" >> /etc/modules
- modprobe bonding
- fi
- #Install vlan
- grep 8021q /etc/modules
- if ! [[ $? -eq 0 ]]; then
- apt-get install vlan
- modprobe 8021q
- echo "8021q" >> /etc/modules
- fi
- test -f /etc/network/interfaces | cp /etc/network/interfaces /etc/network/interfaces.bka
- cat << EOF > /etc/network/interfaces
- #Bond0
- auto eth0
- iface eth0 inet manual
- bond-master bond0
- auto eth1
- iface eth1 inet manual
- bond-master bond0
- auto bond0
- iface bond0 inet static
- address $MGNT_IP
- netmask $NETMASK
- gateway $GATEWAY
- dns-nameservers 8.8.8.8
- bond-miimon 100
- bond-downdelay 0
- bond-updelay 0
- bond-mode 4
- bond-lacp-rate 1
- bond-slaves eth0 eth1
- #Bond2
- auto p6p1
- iface p6p1 inet manual
- bond-master bond2
- bond-primary p6p1
- auto p6p2
- iface p6p2 inet manual
- bond-master bond2
- auto bond2
- iface bond2 inet manual
- bond-slaves none
- bond-primary p6p1
- bond-mode active-backup
- bond-miimon 100
- bond-downdelay 200
- bond-updelay 200
- EOF
- cat << EOF >> /etc/network/interfaces
- #VLANs
- auto bond2.30
- iface bond2.30 inet static
- address $STORAGE_IP
- netmask $NETMASK
- auto bond2.40
- iface bond2.40 inet static
- address $REPLICATE_IP
- netmask $NETMASK
- EOF
- ifdown -a && ifup -a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement