Announcement

Collapse
No announcement yet.

How to bond 2 1Gbps NICs on Debian/Ubuntu for 2Gbps port speed

Collapse
This topic is closed.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to bond 2 1Gbps NICs on Debian/Ubuntu for 2Gbps port speed

    Reference: http://www.cyberciti.biz/tips/debian...nnections.html

    1.
    First, we need to install ifenslave:

    Code:
    apt-get install ifenslave-2.6
    2.6 refers to the kernel you have on the machine, so change that accordingly. Find the kernel using the uname -a command.

    2.
    Now create the /etc/modprobe.d/bonding.conf file

    Code:
    nano /etc/modprobe.d/bonding.conf
    Put this into the file:
    Code:
    alias bond0 bonding
      options bonding mode=0 arp_interval=100 arp_ip_target=##switch IP##
    For the ##switch IP## line, put in the Ip that is right before your server's main IP when you do a traceroute to it. That would be the swith it's connected to.

    3.

    Load the driver:

    Code:
    # modprobe -v bonding mode=0 arp_interval=100 arp_ip_target=##switch IP##
    # tail -f /var/log/messages
    # ifconfig bond0
    replace ##switch IP## with the same IP you used in the bonding.conf file above.

    4.
    ALERT: You must do this via IPMI or direct console. If you do this via ssh, you will be disconnected when you kill the network!

    Now we need to modify the interfaces file to work with the new bond we setup. First, stop the network.

    Code:
    /etc/init.d/networking stop
    Now backup the existing interfaces file to a safe location in case you need to copy it back.

    After you backup the interfaces file, we can modify the existing one:/etc/network/interfaces.

    Replace the contents of the interfaces file with the following:

    Code:
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    allow-hotplug eth0
    iface eth0 inet static
    auto bond0
    iface bond0 inet static
            address #main server IP address#
            netmask 255.255.255.248
            network 1.1.1.1
            broadcast 1.1.1.1
            gateway 1.1.1.1
            # dns-* options are implemented by the resolvconf package, if installed
            dns-nameservers 8.8.8.8 4.2.2.2
    
    slaves eth0 eth1
        # jumbo frame support
        mtu 9000
        # Load balancing and fault tolerance
        bond-mode balance-rr
        bond-miimon 100
        bond-downdelay 200
        bond-updelay 200
        #dns-nameservers 8.8.8.8
    For the main IP, the netmask and 1.1.1.1 in this example, you must put your actual respective main IP, netmask, gateway, etc.. the numbers above are for example only and will not work for you. For the rest of the options, please do some research on what they mean, but this should give you a good start.

    Save the file and exit.

    5.
    Restart networking

    Code:
    /etc/init.d/neworking start
    You should now be all set and when you run ifconfig, you will see the bond0 on there with eth0 and eth1 being slaves.

    To check the bond0 settings you can run the following

    Code:
    cat /proc/net/bonding/bond0
    Need to setup bonding on a Centos/Redhat server? No problem, Go here.
    www.AYKsolutions.com
    From Shared to Dedicated
    Professional. Painless. Polite.

  • #2
    In Debian 7, please see this post: http://crashmag.net/how-to-configure...-debian-wheezy.

    If you are looking to use xmit_hash_policy layer3+4 to get best throughput on both NICs, add the following line to the bond0 definition in /etc/network/interfaces:

    Code:
    bond_xmit_hash_policy layer3+4
    NOTE: bond lacp_rate should be set to 1, not 4, as it is in the above link.
    www.AYKsolutions.com
    From Shared to Dedicated
    Professional. Painless. Polite.

    Comment

    Working...
    X