Iṣowo ikanni Ethernet aka Ẹgbẹ NIC lori Awọn Ẹrọ Linux
Iṣọpọ Ikanni Ethernet n jẹ ki Kaadi Awọn wiwo Awọn Nẹtiwọọki meji tabi meji (NIC) si kaadi NIC foju kan ti o le mu bandiwidi pọ si ati pese apọju ti Awọn kaadi NIC. Eyi jẹ ọna nla lati ṣaṣeyọri awọn ọna asopọ apọju, ifarada ẹbi tabi awọn nẹtiwọọki iwọntunwọnsi fifuye ni eto iṣelọpọ. Ti NIC ti ara kan ba wa ni isalẹ tabi ti yọ kuro, yoo gbe awọn orisun laifọwọyi si kaadi NIC miiran. Ikanni ikanni/NIC yoo ṣiṣẹ pẹlu iranlọwọ ti awakọ mimu ni Kernel. A yoo lo NIC meji lati ṣe afihan kanna.
O fẹrẹ to awọn oriṣi mẹfa ti awọn iru Bond ikanni wa. Nibi, a yoo ṣe ayẹwo iru meji Bond Channel Bond eyiti o jẹ olokiki ati lilo ni ibigbogbo.
- 0: Iwontunwosi fifuye (Round-Robin): A gbe ijabọ wa ni tito lẹsẹsẹ tabi aṣa iyipo-yika lati mejeeji NIC. Ipo yii n pese iwọntunwọnsi fifuye ati ifarada ẹbi.
- 1: Afẹyinti-Ṣiṣẹ: NIK ẹrú nikan ni o nṣiṣẹ ni aaye eyikeyi ti a fifun. Kaadi Ọlọpọọmídí Miiran yoo ṣiṣẹ nikan ti ẹrú ti nṣiṣe lọwọ NIC ba kuna.
Ṣiṣẹda Iṣọpọ ikanni Ethernet
A ni Awọn kaadi Ethernet Nẹtiwọọki meji ie eth1 ati eth2 nibiti a ti ṣẹda bond0 fun idi isomọ. Nilo anfani superuser lati ṣe awọn ofin ni isalẹ.
Darukọ paramita MASTER bond0 ati wiwo eth1 bi SLAVE ninu faili atunto bi a ṣe han ni isalẹ.
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE="eth1" TYPE=Ethernet ONBOOT="yes" BOOTPROTO="none" USERCTL=no MASTER=bond0 SLAVE=yes
Nibi tun, ṣalaye paramita TITUNTO bond0 ati wiwo eth2 bi ọmọ-ọdọ.
# vi /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE="eth2" TYPE="Ethernet" ONBOOT="yes" USERCTL=no #NM_CONTROLLED=yes BOOTPROTO=none MASTER=bond0 SLAVE=yes
Ṣẹda bond0 ati tunto wiwo isopọ ikanni ni itọsọna “/ ati be be/sysconfig/awọn iwe afọwọkọ nẹtiwọọki /” ti a pe ni ifcfg-bond0.
Atẹle ni faili iṣeto isopọ ikanni apẹẹrẹ.
# vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0 ONBOOT=yes IPADDR=192.168.246.130 NETMASK=255.255.255.0 BONDING_OPTS="mode=0 miimon=100"
Akiyesi: Ninu iṣeto ti o wa loke a ti yan ipo Awọn aṣayan Ifunmọ = 0 ie Round-Robin ati miimon = 100 (Awọn aaye didi idibo 100 ms).
Jẹ ki a wo awọn atọkun ti a ṣẹda nipa lilo pipaṣẹ ifconfig eyiti o fihan “bond0” n ṣiṣẹ bi MASTER awọn atọkun mejeeji “eth1” ati “eth2” nṣiṣẹ bi awọn ẹrú.
# ifconfig
bond0 Link encap:Ethernet HWaddr 00:0C:29:57:61:8E inet addr:192.168.246.130 Bcast:192.168.246.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe57:618e/64 Scope:Link UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:17374 errors:0 dropped:0 overruns:0 frame:0 TX packets:16060 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1231555 (1.1 MiB) TX bytes:1622391 (1.5 MiB) eth1 Link encap:Ethernet HWaddr 00:0C:29:57:61:8E UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:16989 errors:0 dropped:0 overruns:0 frame:0 TX packets:8072 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1196931 (1.1 MiB) TX bytes:819042 (799.8 KiB) Interrupt:19 Base address:0x2000 eth2 Link encap:Ethernet HWaddr 00:0C:29:57:61:8E UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:385 errors:0 dropped:0 overruns:0 frame:0 TX packets:7989 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:34624 (33.8 KiB) TX bytes:803583 (784.7 KiB) Interrupt:19 Base address:0x2080 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:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:480 (480.0 b) TX bytes:480 (480.0 b)
Tun iṣẹ Nẹtiwọọki bẹrẹ ati awọn atọkun yẹ ki o DARA.
# service network restart
Shutting down interface bond0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface bond0: [ OK ]
Ṣiṣayẹwo ipo ti adehun.
# watch -n .1 cat /proc/net/bonding/bond0
Isẹjade ti o wa ni isalẹ fihan pe Ipo adehun jẹ Iwontunwosi Fifuye (RR) ati eth1 & eth2 n ṣe afihan.
Every 0.1s: cat /proc/net/bonding/bond0 Thu Sep 12 14:08:47 2013 Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009) Bonding Mode: load balancing (round-robin) MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 Slave Interface: eth1 MII Status: up Speed: Unknown Duplex: Unknown Link Failure Count: 2 Permanent HW addr: 00:0c:29:57:61:8e Slave queue ID: 0 Slave Interface: eth2 MII Status: up Speed: Unknown Duplex: Unknown Link Failure Count: 2 Permanent HW addr: 00:0c:29:57:61:98 Slave queue ID: 0
Ninu iwoye yii, awọn wiwo Slave wa kanna. iyipada kan ṣoṣo ni yoo wa nibẹ ni wiwo isopọ ifcfg-bond0 dipo '0' yoo jẹ '1' eyiti o han bi labẹ.
# vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0 ONBOOT=yes IPADDR=192.168.246.130 NETMASK=255.255.255.0 BONDING_OPTS="mode=1 miimon=100"
Tun iṣẹ nẹtiwọọki bẹrẹ ati ṣayẹwo ipo isopọmọ.
# service network restart
Shutting down interface bond0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface bond0: [ OK ]
Ṣiṣayẹwo ipo ti adehun pẹlu aṣẹ.
# watch -n .1 cat /proc/net/bonding/bond0
Ipo Iṣowo n ṣe ifarada ifarada-aṣiṣe (afẹyinti-nṣiṣe lọwọ) ati Ọlọpọọmídírẹ Slave ti wa ni oke.
Every 0.1s: cat /proc/n... Thu Sep 12 14:40:37 2013 Ethernet Channel Bonding Driver: v3.6.0 (September 2 6, 2009) Bonding Mode: fault-tolerance (active-backup) Primary Slave: None Currently Active Slave: eth1 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 Slave Interface: eth1 MII Status: up Speed: Unknown Duplex: Unknown Link Failure Count: 0 Permanent HW addr: 00:0c:29:57:61:8e Slave queue ID: 0 Slave Interface: eth2 MII Status: up Speed: Unknown Duplex: Unknown Link Failure Count: 0 Permanent HW addr: 00:0c:29:57:61:98 Slave queue ID: 0
Akiyesi: Ni afọwọse ni isalẹ ati si oke Awọn atọkun Ẹrú lati ṣayẹwo iṣiṣẹ Iṣọpọ ikanni. Jọwọ wo aṣẹ bi isalẹ.
# ifconfig eth1 down # ifconfig eth1 up
O n niyen!