Channel Bonding เป็นวิธีการนำเอา network interface card หลายๆใบมารวมกันเพื่อให้สามารถ ขยาย bandwidth, fail-over interface, load balancing หรือ port trunking 802.3ad และยัง support VLAN หรือ 802.1q ได้อีกด้วย
Mode ต่างๆของการทำ bonding interface
- mode=0 round-robin policy เป็นการรับและส่งข้อมูลเป็นลำดับบนแต่ละ port lan โหมดนี้ใช้สำหรับ fault tolerance และ load balancing
- mode=1 (active-backup) เป็นวิธีการทำงานแบบ active และ backup โดยที่ interface ที่ถูกกำหนดให้เป็น master จะทำงานตามปกติ และอีก interface หนึ่งที่ถูกกำหนดให้เป็น slave จะไม่ทำงาน แต่เมื่อ interface ที่เป็น master เกิดใช้งานไม่ได้ interface ที่เป็น slave จะขึ้นมาทำให้ที่แทน โหมดนี้ใช้สำหรับ fault tolerance
- mode=2 (balance-xor) XOR policy ไม่ขอกล่าวถึง โหมดนี้ใช้สำหรับ fault tolerance และ load balancing
- mode=3 (broadcast) จะทำการ broadcast การส่งข้อมูลไปทุกๆ slave interface โหมดนี้ใช้สำหรับ fault tolerance
- mode=4 (802.3ad) IEEE 802.3ad Dynamic link aggregation หรือเรียกว่า link aggregation หรือ port trunking โดยเมื่อ set configure เป็น 802.3ad แล้วจะต้องใช้งานกับ switch ที่ set configure แบบ 802.3ad ด้วย สิ่งที่ต้องการเพิ่มเติม จะต้องใช้ ethtool จะต้อง support กับ driver เพื่อดึงค่า speed และ duplex ของทุกๆ slave port ด้วย
- mode=5 (balance-tlb หรือ Adaptive transmit load balancing) จะส่งข้อมูลออกไปในแต่ละ slave interface แต่เมื่อตอนรับข้อมูลจะรับข้อมูลที่ slave ที่ใช้งานอยู่ ถ้าเมื่อใดก็ตามที่ slave ที่รับข้อมูลเกิด fail slave ตัวอื่นจะนำ MAC address ของ slave ที่ fail มาใช้แทน โหมดนี้ใช้สำหรับ fault tolerance และ load balancing สิ่งที่ต้องการสำหรับ mode 5 คือ Ethtool support การตรวจสอบความเร็ว interface ของแต่ละ slave
- mode=6 (balance-alb หรือ Adaptive load balancing) เป็นโหมดในการทำ load balancing สำหรับข้อมูลในการรับและส่งสำหรับ IPV4 เท่านั้น ในการรับข้อมูลแบบ load balancing จะดักจับ ARP replies ที่จะส่งออกไปยังข้างนอกและทำการเขียนทับด้วย MAC address ของ slave interface ตัวใดตัวหนึ่ง โหมดนี้ใช้สำหรับ fault tolerance และ load balancing
miimon คือ การระบุความถี่ในการตรวจสอบ link เพื่อให้แน่ใจว่า link ของ NIC ต่างๆ ยังคง active อยู่ โดยหน่วยเป็น milliseconds แต่การจะใช้ option นี้ได้จะต้องตรวจสอบว่า NIC supoort MII tool หรือไม่ด้วยคำสั่ง
ethtool | grep "Link detected:"
ตัวอย่างการ set bonding interface แบบ balance-tlb หรือ mode 5
แก้ไขไฟล์ /etc/modprobe.conf โดยเพิ่ม
alias bond0 bonding
options bond0 miimon=80 mode=5
รันคำสั่ง insmod เพื่อให้ add module
insmod bond0 miimon=80 mode=5
สร้างไฟล์ ifcfg-bond0 ใน /etc/sysconfig/network-scripts/ โดย copy ข้างล่างนี้ และแก้ไข ip address netmask และอื่นๆตามที่ต้องการ
DEVICE=bond0
IPADDR=
NETMASK=
NETWORK=
BROADCAST=
GATEWAY=
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
แก้ไขไฟล์ ifcfg-eth0 ที่ /etc/sysconfig/network-scripts/
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes
แก้ไขไฟล์ ifcfg-eth1 ที่ /etc/sysconfig/network-scripts/
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes
Related posts:
- Configure VLAN devices over a bond interface ใน Linux เราสามารถตั้งค่าของ VLAN network ได้ไม่ยาก ซึ่ง Linux เองก็ support การทำงานของ VLAN ด้วยเช่นกันโดยใช้ driver 8021q ซึ่งขั้นตอนการติดตั้งที่ยกตัวอย่างมานี้เป็นการทำ bonding channel +...
- Other Virtual network interfaces go down when bring down virtual network interfaces เคยเกิดปัญหาไหม ถ้าเราทำการสร้าง Virtual network interfaces ขึ้นมาหลายๆ interface และพบว่าเมื่อเรา down Virtual network interfaces บาง Virtual network interfaces จะทำให้ Virtual network...
- Test the connectivity to any socket on my server from a client on the same network using netcat เมื่อต้องการทดสอบ connection เราสามารถที่จะใช้โปรแกรม netcat เพื่อทำการทดสอบได้ ขั้นตอนการทดสอบสามารถทำได้ดังนี้ ถ้าไม่มีโปรแกรม netcat ให้ใช้คำสั่ง ดังข้างล่างนี้ #yum install nc จากนั้นในฝั่ง server ให้ทำการเปิด socket หรือ port...
- Linux Cluster Concept [Fail-Over and Load-Balancing Cluster] Linux Cluster style 1. High Availability or Fail-Over Cluster 2. Load balancing Cluster 1. Linux Cluster: High Availibility (HA)...
- Make bridge multiple network interfaces on Xen host to guests os. ขั้นแรกให้สร้าง script file ขึ้นมาโดยใช้คำสั่ง #vi /etc/xen/scripts/network-xen-custom จากนั้น copy ข้อความด้านล่างไปไว้ที่ไฟล์ #!/bin/sh # network-xen-custom # Exit if anything goes wrong...