İki veya daha fazla ethernet interface olması durumunda bonding network interface kullanarak, ethernetlerin load balance bond, round-robin bond ya da fault tolerant bond şeklinde çalışması sağlanabilmektedir. Bu sayede bir interface down olması durumunda sunucuya erişim ikinci interface üzerinden devam edecektir.
Ubuntu 16.04 Uzerinde Bonding Interface
apt-get install ifenslave-2.6
Komutu ile paket yuklenir.
nano /etc/modules açılır
içine
loop
lp
bonding
yazılır kaydedilir.
nano /etc/modprobe.d/bonding.conf
açılır içine
alias bond0 bonding
options bonding mode=0 arp_interval=100 arp_ip_target=gateway_ip, cihaz_ip
yazılıp kaydedilir. sonra komut satırında
modprobe -v bonding mode=0 arp_interval=100 arp_ip_target=gateway_ip, cihaz_ip
çalıştırılır.
nano /etc/network/interfaces
içine
#This file describes the network interfaces available on your system
#and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
#The loopback network interface
auto lo
iface lo inet loopback
#The first network interface
auto eth0
iface eth0 inet manual
bond-master bond0
#The second network interface
auto eth1
iface eth1 inet manual
bond-master bond0
#The third network interface
auto eth2
iface eth2 inet manual
bond-master bond0
#The forth network interface
auto eth3
iface eth3 inet manual
bond-master bond0
#The bondmaster network interface
auto bond0
iface bond0 inet static
address xxx.xxx.xx.xx
netmask xxx.xxx.xxx.xx
network xxx.xxx.xx.xx
gateway xxx.xxx.xxx.xx
slaves eth0 eth1 eth2 eth3
#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 xxx.xxx.xx.xx
yazılır.
NOT:Sunucu üstünde bulunan ve bonding yapılması istenen interface sayısına göre config değişkenlik gösterebilir Burada 4 adet varmis gibi config yapiliyor.
makina reboot edilir. Sonra bonding ayarlarınızı kontrol etmek için
ifconfig -a
bond0 Link encap:Ethernet HWaddr f4:8e:38:c5:5c:e1
inet addr:10.10.30.56 Bcast:10.10.30.255 Mask:255.255.255.0
UP BROADCAST RUNNING MASTER MULTICAST MTU:9000 Metric:1
RX packets:51020201 errors:0 dropped:1496 overruns:0 frame:0
TX packets:34324489 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:25821288062 (25.8 GB) TX bytes:7106197452 (7.1 GB)
eth0 Link encap:Ethernet HWaddr f4:8e:38:c5:5c:e1
UP BROADCAST RUNNING SLAVE MULTICAST MTU:9000 Metric:1
RX packets:12728674 errors:0 dropped:0 overruns:0 frame:0
TX packets:8580716 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6438582764 (6.4 GB) TX bytes:1775724161 (1.7 GB)
eth1 Link encap:Ethernet HWaddr f4:8e:38:c5:5c:e1
UP BROADCAST RUNNING SLAVE MULTICAST MTU:9000 Metric:1
RX packets:12786830 errors:0 dropped:0 overruns:0 frame:0
TX packets:8581040 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6475670467 (6.4 GB) TX bytes:1776551980 (1.7 GB)
eth2 Link encap:Ethernet HWaddr f4:8e:38:c5:5c:e1
UP BROADCAST RUNNING SLAVE MULTICAST MTU:9000 Metric:1
RX packets:12746786 errors:0 dropped:0 overruns:0 frame:0
TX packets:8581601 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6444551874 (6.4 GB) TX bytes:1777303075 (1.7 GB)
eth3 Link encap:Ethernet HWaddr f4:8e:38:c5:5c:e1
UP BROADCAST RUNNING SLAVE MULTICAST MTU:9000 Metric:1
RX packets:12757911 errors:0 dropped:0 overruns:0 frame:0
TX packets:8581132 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6462482957 (6.4 GB) TX bytes:1776618236 (1.7 GB)
gibi olmalı.
Anlık link durumunu kontrol etmek için;
cat /proc/net/bonding/bond0
EEthernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200
Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: f4:8e:38:c5:5c:e1
Slave queue ID: 0
Slave Interface: eth2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: f4:8e:38:c5:5c:e2
Slave queue ID: 0
Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: f4:8e:38:c5:5c:e0
Slave queue ID: 0
Slave Interface: eth3
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: f4:8e:38:c5:5c:e3
Slave queue ID: 0
benzeri bir çıktı alınıyorsa sorun yok demektir fakat;
Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200
Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: f4:8e:38:c5:5c:e1
Slave queue ID: 0
Slave Interface: eth2
MII Status: down
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: f4:8e:38:c5:5c:e2
Slave queue ID: 0
Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: f4:8e:38:c5:5c:e0
Slave queue ID: 0
Slave Interface: eth3
MII Status: down
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: f4:8e:38:c5:5c:e3
Slave queue ID: 0
benzeri bir çıktı alınıyorsa ilgili interface’de veya interfacelerin linkinde bir sorun var demektir.