Ferramentas de Usuário

Ferramentas de Site


en:wheezy:config:network:bonding

This page was automatically translated. Please help to improve Translations.

2.1.4 Network interface aggregation

Objectives

The vast majority of the systems provides 2 Ethernet connections. These can be used separately or in parallel, in a technique called bonding. This technique is very interesting since it allows load-balancing data (data is transmitted across 2 network interfaces) and fault tolerance (if a link fails, the transmission is ensured by another).

On our server, we will aggregate the two physical interfaces eth0 and eth1 system to create a new high availability network interface over bond0.

Ethernet bonding
Ethernet bonding, regulated by IEEE 802.3ad with the title link aggregation is a term of the discipline of computer networks that describes the coupling of two or more Ethernet channels in parallel to produce a single higher-speed channel and/or increase the availability and redundancy of this channel.

Installation

root@server~# aptitude install ifenslave

Configuration

To create a bond0 interface, the kernel module bonding is required. This module will be loaded automatically after setting; for now it must be loaded manually::

root@server:~# modprobe bonding

Check if the module is correctly loaded:

root@server:~# lsmod | grep bonding
bonding                65204  0

The next step is the parameterization of the new network interface and remove (or comment out) any references to physical interfaces used by our bond0 interface, which is done in the file /etc/network/interfaces:

/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
# allow-hotplug eth0
# iface eth0 inet dhcp

# Static IP address
# auto eth0
# iface eth0 inet static
#        address 192.168.1.100
#        netmask 255.255.255.0
#        network 192.168.1.0
#        broadcast 192.168.1.255
#        gateway 192.168.1.1

# Interface bonding
# Static IP address
auto bond0
iface bond0 inet static
        bond-slaves eth0 eth1
        bond-mode balance-rr
        bond-miimon 100
        bond-primary eth0 eth1

        address 192.168.1.100
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1

The parameter bond-mode balance-rr indicates that the interface will operate in balance-rr mode, in which the data will be transmitted alternately by the various physical interfaces that make up the new interface over bond0.

Finally, restart the network services:

root@server:~# /etc/init.d/networking restart

Verification

The ifconfig command enables you to check the status of network interfaces:

root@server:~# ifconfig
bond0     Link encap:Ethernet  HWaddr 00:30:1b:b0:6e:84
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::230:1bff:feb0:6e84/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:23339499 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11308048 errors:0 dropped:0 overruns:5 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:182934407 (174.4 MiB)  TX bytes:1008040228 (961.3 MiB)

eth0      Link encap:Ethernet  HWaddr 00:30:1b:b0:6e:84
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:12004063 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5654023 errors:0 dropped:0 overruns:5 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:597782690 (570.0 MiB)  TX bytes:519229722 (495.1 MiB)
          Interrupt:18 Base address:0xa000

eth1      Link encap:Ethernet  HWaddr 00:30:1b:b0:6e:84
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:11335436 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5654025 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3880119013 (3.6 GiB)  TX bytes:488810506 (466.1 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:193243 errors:0 dropped:0 overruns:0 frame:0
          TX packets:193243 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:31609190 (30.1 MiB)  TX bytes:31609190 (30.1 MiB)

The bond0 interface is assigned an Internet address and the 3 interfaces (bond0, eth0 and eth1) have the same physical address (“HWaddr 00:30: 1b: b0: 6e: 84”), so they are “seen” by the rest of the network as being only one.

References

en/wheezy/config/network/bonding.txt · Última modificação em: 2024-02-15 01:05 por 127.0.0.1