Bounding, LACP - Debian/Ubuntu

Bounding to łączenie kilku interfejsów fizycznych w jeden. Przydaje się gdy chcemy rozłożyć ruchu sieciowy lub ograniczyć awaryjność.
W pierwszej kolejności instalujemy kilka paczek:
apt-get install ifenslave-2.6 bridge-utils
Ja posiadam cztery fizyczne karty sieciowe w moim serwerze – Dell r610.
Wszystko działa w oparciu o protokół LACP – tutaj musi to switch ogarniać. Możliwe iż będzie potrzebne skonfigurowanie odpowiednich part portów na switchu.
Musimy załadować odpowiednie moduły.
vim /etc/modules
dodajemy
bonding mii 8021q
Tworzymy interfejs bond0
vim /etc/modprobe.d/bonding.conf
wrzucamy:
alias bond0 bonding options bonding mode=4 miimon=100 lacp_rate=1
Teraz czas na konfiguracje sieci:
vim /etc/network/interfaces
Co tam mamy kasujemy i wrzucamy coś ja poniżej:
auto lo iface lo inet loopback # The primary network interface auto em1 iface em1 inet manual bond-master bond0 auto em2 iface em2 inet manual bond-master bond0 auto em3 iface em3 inet manual bond-master bond0 auto em4 iface em4 inet manual bond-master bond0 auto bond0 iface bond0 inet static address 192.168.88.101 netmask 255.255.255.0 gateway 192.168.88.1 dns-nameservers 192.168.88.1 bond-mode 802.3ad bond-miimon 100 bond-lacp-rate 1 bond-slaves none bond-updelay 200 bond-downdelay 200 bond-xmit_hash_policy layer3+4
Dajemy restart maszyny, polecenie ifconfig pokaże nam nowy interfejs:
[email protected]:~# ifconfig bond0 Link encap:Ethernet HWaddr d4:ae:52:70:e1:61 inet addr:192.168.88.101 Bcast:192.168.88.255 Mask:255.255.255.0 inet6 addr: fe80::d6ae:52ff:fe70:e161/64 Scope:Link UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:112175113 errors:0 dropped:0 overruns:0 frame:0 TX packets:216479037 errors:0 dropped:6 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:77967460206 (77.9 GB) TX bytes:252627940834 (252.6 GB) em1 Link encap:Ethernet HWaddr d4:ae:52:70:e1:61 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:41239161 errors:0 dropped:0 overruns:0 frame:0 TX packets:101304727 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:38992849042 (38.9 GB) TX bytes:112752941171 (112.7 GB) em2 Link encap:Ethernet HWaddr d4:ae:52:70:e1:61 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:70935952 errors:0 dropped:0 overruns:0 frame:0 TX packets:115174310 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:38974611164 (38.9 GB) TX bytes:139874999663 (139.8 GB) em3 Link encap:Ethernet HWaddr d4:ae:52:70:e1:63 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:162179608 errors:0 dropped:0 overruns:0 frame:0 TX packets:97731682 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:211977971084 (211.9 GB) TX bytes:94355253011 (94.3 GB) em4 Link encap:Ethernet HWaddr d4:ae:52:70:e1:63 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:87594161 errors:0 dropped:0 overruns:0 frame:0 TX packets:42818511 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:105254625922 (105.2 GB) TX bytes:44845426778 (44.8 GB) 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:65536 Metric:1 RX packets:5397113 errors:0 dropped:0 overruns:0 frame:0 TX packets:5397113 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:516427855 (516.4 MB) TX bytes:516427855 (516.4 MB)
No i super teraz brige. Zmieniamy zawartośc /etc/network/interfaces. Tym razem konfiguracja sieci będzie pobierana z serwera DHCP. Musimy dodać nasz interfejs br0 jako brige oraz usunąć konfiguracje IP z interfejsun bond0, coś jak poniżej:
auto bond0 iface bond0 inet manual bond-mode 802.3ad bond-miimon 100 bond-lacp-rate 1 bond-slaves none bond-updelay 200 bond-downdelay 200 bond-xmit_hash_policy layer3+4 auto br0 iface br0 inet dhcp bridge_ports bond0 bridge_stp off bridge_fd 0
ifconfig nam pokaże:
[email protected]:~# ifconfig bond0 Link encap:Ethernet HWaddr 18:03:73:f4:fe:42 UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:3042412867 errors:3 dropped:3 overruns:0 frame:3 TX packets:2814433514 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:3546459128495 (3.2 TiB) TX bytes:3153052785000 (2.8 TiB) eth0 Link encap:Ethernet HWaddr 18:03:73:f4:fe:42 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:223937811 errors:0 dropped:0 overruns:0 frame:0 TX packets:1710831383 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:66295113189 (61.7 GiB) TX bytes:2348006133041 (2.1 TiB) eth1 Link encap:Ethernet HWaddr 18:03:73:f4:fe:42 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:687921224 errors:0 dropped:0 overruns:0 frame:0 TX packets:351739865 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:857208910460 (798.3 GiB) TX bytes:215341911270 (200.5 GiB) eth2 Link encap:Ethernet HWaddr 18:03:73:f4:fe:42 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:1087675708 errors:0 dropped:0 overruns:0 frame:0 TX packets:384146020 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1339624548989 (1.2 TiB) TX bytes:304000602924 (283.1 GiB) eth3 Link encap:Ethernet HWaddr 18:03:73:f4:fe:42 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:1042878124 errors:3 dropped:3 overruns:0 frame:3 TX packets:367716246 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1283330555857 (1.1 TiB) TX bytes:285704137765 (266.0 GiB) 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:65536 Metric:1 RX packets:6603299 errors:0 dropped:0 overruns:0 frame:0 TX packets:6603299 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:399751270 (381.2 MiB) TX bytes:399751270 (381.2 MiB) br0 Link encap:Ethernet HWaddr 18:03:73:f4:fe:42 inet addr:192.168.88.239 Bcast:192.168.88.255 Mask:255.255.255.0 inet6 addr: fe80::1a03:73ff:fef4:fe42/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:939004002 errors:0 dropped:0 overruns:0 frame:0 TX packets:900835860 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:3328472008716 (3.0 TiB) TX bytes:2710259841740 (2.4 TiB)
Natomiast polecenie ip pokaże co i jak inaczej :)
[email protected]:~# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000 link/ether 18:03:73:f4:fe:42 brd ff:ff:ff:ff:ff:ff 3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000 link/ether 18:03:73:f4:fe:42 brd ff:ff:ff:ff:ff:ff 4: eth2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000 link/ether 18:03:73:f4:fe:42 brd ff:ff:ff:ff:ff:ff 5: eth3: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000 link/ether 18:03:73:f4:fe:42 brd ff:ff:ff:ff:ff:ff 6: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP link/ether 18:03:73:f4:fe:42 brd ff:ff:ff:ff:ff:ff 7: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN link/ether 18:03:73:f4:fe:42 brd ff:ff:ff:ff:ff:ff inet 192.168.88.239/24 brd 192.168.88.255 scope global br0 inet6 fe80::1a03:73ff:fef4:fe42/64 scope link valid_lft forever preferred_lft forever
Widać powyżej, iż karty fizyczne są w boundingu.
Wszystko:)