bond 767 Bytes
Newer Older
1
2
3
4
5
6
7
#! /bin/bash
. /usr/lib/network/network
IFENSLAVE="/sbin/ifenslave"

bond_up() {
    load_profile "$1"

Jouke Witteveen's avatar
Jouke Witteveen committed
8
    if [[ -e "/sys/class/net/$INTERFACE" ]]; then
9
10
11
12
13
        report_fail "Interface $INTERFACE already exists."
        exit 1
    else
        ip link add dev $INTERFACE type bond
    fi
14
    bring_interface up "$INTERFACE"
15

16
17
    for slave in "${SLAVE_INTERFACES[@]}"; do
        bring_interface up "$slave"
18
19
20
        $IFENSLAVE $INTERFACE $slave
    done

21
    "$CONN_DIR/ethernet" up "$1"
22
23
24
25
26
27
    return 0
}

bond_down() {
    load_profile "$1"

28
    for slave in "${SLAVE_INTERFACES[@]}"; do
29
30
31
32
        $IFENSLAVE $INTERFACE -d $slave
    done

    "$CONN_DIR/ethernet" down "$1"
33
    ip link delete "$INTERFACE"
34
35
36
37
38
39
40
    return 0
}

bond_$1 "$2"
exit $?

# vim: set ts=4 et sw=4: