Dual-nic bond script

Source: Internet
Author: User

This script is used to enable the NIC bonding to monitor bonding to stop bonding.


[root@crushlinux ~]# vi /etc/init.d/bond#!/bin/bash# chkconfig: 345 10 90# description: Activates/Deactives bonding device# filename: bond.sh# auth: crushlinux# date: 2013/09/28IP=192.168.1.254NETMASK=255.255.255.0id root &>/dev/null||exit 1start () {/sbin/ifenslave bond0 &>/dev/null&&exit 0/sbin/modprobe bonding mode=1 miimon=100/sbin/ifconfig bond0 $IP netmask $NETMASK/sbin/ifenslave bond0 eth0/sbin/ifenslave bond0 eth1}stop () {/sbin/ifenslave bond0 &>/dev/null||exit 1/sbin/ifenslave -d bond0 eth0/sbin/ifenslave -d bond0 eth1/sbin/modprobe -r bonding}status () {if/sbin/ifenslave bond0 &>/dev/nullthenecho "Bonding is run"echo "The ip address is `ifconfig bond0|grep 'inet addr'|awk '{print $2}'|awk -F: '{print $2}'`"elseecho "Bonding is down"fi}case $1 instart)start;;stop)stop;;status)status;;*)echo $"Usage: $0 {start|stop|status}"esacexit 0

Add this script to chkconfig for management

[root@crushlinux ~]# chmod a+x /etc/init.d/bond[root@crushlinux ~]# chkconfig --add bond[root@crushlinux ~]# chkconfig --list bond[root@crushlinux ~]# service bond start[root@crushlinux ~]# ifconfig


This article is from the "Crushlinux Studio" blog!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.