ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Linux Bonding
    Computer/Network 2010. 9. 17. 15:39


    BotHunter가 interface 1개만 감시할 수 있어서

    두 개 interface를 동시에 감시하기 위하여 bonding을 했다.

     


    eth4와 eth5에 monitoring tap을 통한 트래픽이 오고 있는 상태였고

    promisc 설정이 되어 있었다.


    /etc/sysconfig/network-scripts
    에 있는 ifcfg-eth4와 ifcfg-eth5를 수정
    ifcfg-bond0 만들고
    /etc/modprobe.conf
    를 수정하는 스크립트를 고맙게도 누가 만들어놔서 적절히 사용했다.

     

    #!/bin/bash
    set -x
    # 1: Create a bond0 configuration file
    touch /etc/sysconfig/network-scripts/ifcfg-bond0
    echo “DEVICE=bond0
    IPADDR=192.168.x.x
    NETWORK=192.168.0.0
    NETMASK=255.255.255.0
    USERCTL=no
    BOOTPROTO=static
    ONBOOT=yes” > /etc/sysconfig/network-scripts/ifcfg-bond0

    # 2: Modify eth4 and eth5 config files:
    echo “USERCTL=no
    MASTER=bond0
    SLAVE=yes” >> /etc/sysconfig/network-scripts/ifcfg-eth4
    echo “USERCTL=no
    MASTER=bond0
    SLAVE=yes” >> /etc/sysconfig/network-scripts/ifcfg-eth5
    sed -i ‘s/ONBOOT=.*/ONBOOT=yes/g’ /etc/sysconfig/network-scripts/ifcfg-eth4
    sed -i ‘s/ONBOOT=.*/ONBOOT=yes/g’ /etc/sysconfig/network-scripts/ifcfg-eth5
    sed -i ‘s/BOOTPROTO=.*/BOOTPROTO=static/g’ /etc/sysconfig/network-scripts/ifcfg-eth4
    sed -i ‘s/BOOTPROTO=.*/BOOTPROTO=static/g’ /etc/sysconfig/network-scripts/ifcfg-eth5

    # 3: Load bond driver/module
    echo “alias bond0 bonding
    options bond0 mode=0 miimon=100″ >> /etc/modprobe.conf

    # 4: Test configuration
    modprobe bonding
    service network restart
    sleep 2
    cat /proc/net/bonding/bond0
    echo ” ifconfig for bonding”
    /sbin/ifconfig | grep bond

     

     


     

Designed by Tistory.