多 bonding 使用不同 mode 方法

2021-09-23 17:41:37 字數 3580 閱讀 6607

環境,

多網絡卡, 多 bond 裝置,  需要使用不同的工作方式, 如下:

eth0  eth1  -> bond0  ->  mode 0  ( active-backup )

eth2, eth3  -> bond1  -> mode 1  (balance-rr)

參考:[root@hh-yun-puppet-129021 kickstarts]# yum install -y kernel-doc

[root@hh-yun-puppet-129021 kickstarts]# rpm -ql kernel-doc | grep bonding.txt

/usr/share/doc/kernel-doc-2.6.32/documentation/networking/bonding.txt

其中該文件描述

/etc/modprobe.d/bond.conf 需要具有下面的配置

alias bond0 bonding

options bond0 -o bond0 mode=balance-rr miimon=100

alias bond1 bonding

options bond1 -o bond1 mode=balance-alb miimon=50

但上述文件只能夠針對 centos 5 或之前版本,  而文件也沒有更新 centos 6, 7 下的方法

而 centos 6,7 將不可以使用 -o 引數進行引數定義,  另外,  假如把配置, 引數都寫入 /etc/modprobe.d/bond.conf 如

alias bond0 bonding

options bond0 mode=balance-rr miimon=100

alias bond1 bonding

options bond1 mode=balance-alb miimon=50

看上去 bond0, bond1 可以啟動,  但從核心引數顯示,  上述的裝置只會使用相同的工作模式,  不滿足不同 bond 裝置使用不同模式方法

參考:

[root@hh-yun-compute-130026 ~]# grep mode /proc/net/bonding/bond0

bonding mode: load balancing (round-robin)

[root@hh-yun-compute-130026 ~]# grep mode /proc/net/bonding/bond1

bonding mode: load balancing (round-robin)

centos 6, 7 上正確配置方法:

/etc/modprobe.d/bond.conf

alias bond0 bonding

alias bond1 bonding

/etc/sysconfig/network-scripts/ifcfg-bond0

bonding_opts='mode=1 miimon=100'

/etc/sysconfig/network-scripts/ifcfg-bond1

bonding_opts='mode=0 miimon=100'

另: 注意,  centos 7  下, 假如關閉 ipv6 模組使用,  那麼 bond 模組也是無法正常使用的.

而 centos 7 已推薦使用 teamd 進行 bond 配置

teamd 與 bond 實現相同功能,  但新增不少新特性,  比較靈活,   相關資訊自己看官方文旦

測試配置方法

[root@node147 network-scripts]# cat ifcfg-eth0

device="eth0"

devicetype=teamport

onboot=yes

team_master=team0

team_port_config=''

[root@node147 network-scripts]# cat ifcfg-eth1

device=eth1

devicetype=teamport

onboot=yes

team_master=team0

team_port_config=''

[root@node147 network-scripts]# cat ifcfg-eth2

device="eth2"

devicetype=teamport

onboot=yes

team_master=team1

team_port_config=''

[root@node147 network-scripts]# cat ifcfg-eth3

device="eth3"

devicetype=teamport

onboot=yes

team_master=team1

team_port_config=''

team 配置與 mode 配置

[root@node147 network-scripts]# cat ifcfg-team0

device=team0

devicetype=team

onboot=yes

bootproto=none

ipaddr=192.168.48.147

gateway=192.168.48.1

prefix=24

team_config=', "link_watch": }'

[root@node147 network-scripts]# cat ifcfg-team1

device=team1

devicetype=team

onboot=yes

bootproto=none

ipaddr=10.0.0.147

prefix=24

team_config=', "link_watch": }'

校驗方法

[root@node147 network-scripts]# teamdctl -o -v team0 state dump

, "link": , "link_watches": }, "up": true}}, "eth1": , "link": , "link_watches": }, "up": true}}}, "runner": , "setup": , "team_device": }}

[root@node147 network-scripts]# teamdctl -o -v team1 state dump

, "link": , "link_watches": }, "up": true}}, "eth3": , "link": , "link_watches": }, "up": true}}}, "setup": , "team_device": }}



Pyrorch MNIST 使用不同優化器

import torch.nn.functional as f 選擇啟用函式 import torch.optim as optim 選擇優化器 import matplotlib.pyplot as plt 準備資料 batch size 64 trans transforms.compose t...

不同的使用者使用不同語種的Gnome

今天,忽發奇想,怎麼才能讓不同的使用者,使用不同語言的 gnome 比如 root 使用者,我讓他用英文的 gnome 但是可以用 fcitx 而使用者 wallace 我讓他用中文的 gnome。我實現用中文 gnome 靠的是這個檔案 etc x11 xsession.d 95input 內容是...

Drupal實現不同節點型別使用不同模板的方法

drupal有獨立的主題機制 theme engine 這個engine使得drupal的模板控制非常靈活,與此同時要掌握drupal主題機制就顯得不是那麼容易了。drupal的主題模板檔案有一些tpl.php檔案組成,這些檔案包括 node.tpl.php page.tpl.php block.t...