Created
July 14, 2016 16:47
-
-
Save heyseus1/66bf566da527e53c6e6d7ea393c23608 to your computer and use it in GitHub Desktop.
change bond0 hash policy to xmit in centos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #stop services | |
| #x27 is single quote character | |
| #start services | |
| xmit_hash_policy | |
| xmit_hash_policy() { | |
| if egrep '^BONDING_OPTS.*mode=802.3ad' /etc/sysconfig/network-scripts/ifcfg-bond0 > /dev/null | |
| then | |
| echo modifying bonding xmit_hash_policy | |
| perl -pi.bak -e 's/^(BONDING_OPTS=.*802.3ad.*)("|\x27)$/$1 xmit_hash_policy=layer3+4$2/' /etc/sysconfig/network-scripts/ifcfg-bond0 | |
| grep BONDING_OPTS /etc/sysconfig/network-scripts/ifcfg-bond0 | |
| service network stop | |
| modprobe -r bonding | |
| service network start | |
| else | |
| echo could not find LACP bond. no changes made. please check server. | |
| fi | |
| } | |
| cp /etc/sysconfig/network-scripts/ifcfg-bond0 /root/ifcfg-bond0-$(date +%F_%H%M%S) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment