溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

高級(jí)網(wǎng)絡(luò)配置——bond/team/橋接網(wǎng)絡(luò)

發(fā)布時(shí)間:2020-08-14 13:42:19 來源:網(wǎng)絡(luò) 閱讀:678 作者:willis_sun 欄目:網(wǎng)絡(luò)安全
一。學(xué)習(xí)配置 bond 網(wǎng)絡(luò)接口

Red Hat Enterprise Linux 允許管理員使用bonding 內(nèi)核模塊和稱為通道綁定接口的特殊網(wǎng)絡(luò)接口將多個(gè)網(wǎng)絡(luò)接口綁定到一個(gè)通道。根據(jù)選擇的綁定模式 , 通道綁定使兩個(gè)或更多個(gè)網(wǎng)絡(luò)接口作為一個(gè)網(wǎng)絡(luò)接口 , 從而增加帶寬和 / 提供冗余性
1.利用 nmcli 命令管理 bond
     nm-connection-editor
           刪除所有網(wǎng)絡(luò)接口
     nmcli connection add type bond con-name bond0 ifname bond0 mode active-backup ip4 172.25.254.199/24
     ifconfig
     watch -n 1 cat /proc/net/bonding/bond0
   
     nmcli connection add type bond-slave con-name eth0 ifname eth0 master bond0
     nmcli connection add type bond-slave con-name eth2 ifname eth2 master bond0
     ifconfig eth0 down
2.選擇 Linux 以太網(wǎng)綁定模式
    模式 0 ( 平衡輪循 balance-rr) - 輪循策略 , 所有接口都使用采用輪循方式在所有 Slave 中傳輸封包 ; 任何Slave 都可以接收
    模式 1 ( 主動(dòng)備份 active-backup ) - 容錯(cuò)。一次只能使用一個(gè)Slave 接口 , 但是如果該接口出現(xiàn)故障 , 另一個(gè)Slave 將 接替它
    模式 3 ( 廣播 broadcast) - 容錯(cuò)。所有封包都通過所有Slave 接口廣播
3.主動(dòng)備份配置示例
   3-1 建立綁定接口 bond0 配置文件 :
/etc/sysconfig/network-scripts/ifcfg-bond0

– BOOTPROTO="none"
– IPADDR="10.1.1.250"
– PREFIX=”24”
– ONBOOT="yes"
– BONDING_OPTS=”mode=1 miimon=50”
   3-2 建立 Slave 接口 eth0 配置文件 :
/etc/sysconfig/network-scripts/ifcfg-eth0
– DEVICE="eth0"         ####硬件網(wǎng)卡名
– BOOTPROTO="none"
– ONBOOT="yes"
– MASTER="bond0"
– SLAVE="yes“
   3-3 建立 Slave 接口 eth2 配置文件 :
/etc/sysconfig/network-scripts/ifcfg-eth2
– DEVICE="eth2"
– BOOTPROTO="none"
– ONBOOT="yes"
– MASTER="bond0"
– SLAVE="yes“
   3-4 配置系統(tǒng)加載 binding 模塊 :
/etc/modprobe.d/bonding.conf
– alias bond0 bonding
ifenslave bond0 eth0 eth2

systemctl stop NetworkManager
systemctl restart network

查看 bonding 狀態(tài)
– cat /proc/net/bonding/bond0

二。學(xué)習(xí)配置 team 網(wǎng)絡(luò)接口
1.Team 接口
Team 和 bond0 功能類似
Team 不需要手動(dòng)加載相應(yīng)內(nèi)核模塊
Team 有更強(qiáng)的拓展性
– 支持 8 快網(wǎng)卡

2.Team 的種類

broadcast     廣播容錯(cuò)
roundrobin    輪詢
activebackup  主備
loadbalance   負(fù)載均衡

3.通過 nmcli 設(shè)定 team
nmcli connection add type team con-name team0 ifname team0 config '{"runner"{"name":"loadbalance"}}' ip4 172.25.254.198/24
nmcli connection add con-name eth0   ifname eth0 type team-slave master team0
nmcli connection add con-name eth2   ifname eth2 type team-slave master team0

4.監(jiān)控team0,并測(cè)試
teamctl team0 stat      
ifconfig eth0 down
ifconfig eth0 up
ifconfig eth2 down
ifconfig eth2 up

三。學(xué)習(xí)配置網(wǎng)絡(luò)橋接
1.網(wǎng)絡(luò)橋接
網(wǎng)絡(luò)橋接用網(wǎng)絡(luò)橋?qū)崿F(xiàn)共享上網(wǎng)主機(jī)和客戶機(jī)除了利用軟件外,還可以用系統(tǒng)自帶的網(wǎng)絡(luò)橋建立連接用雙網(wǎng)卡的機(jī)器做主機(jī)

2.網(wǎng)絡(luò)橋接的配置
vim /etc/sysconfig/network-scripts/ifcfg-eth0
   DEVICE=eth0       ###設(shè)備名,可能不同
   ONBOOT=yes
   BOOTPROTO=none
   BRIDGE=br0      ###重點(diǎn),必須說明
vim /etc/sysconfig/network-scripts/ifcfg-br0
   DEVICE=eth0      
   ONBOOT=yes
   BOOTPROTO=none
   TYPE=Bridge      ###重點(diǎn),必須說明
   IPADDR=172.25.254.198

3.網(wǎng)絡(luò)橋接的管理命令
brctl
### 橋接管理命令
– show ### 顯示
– addbr ### 添加網(wǎng)橋
– delbr ### 刪除網(wǎng)橋
– addif ### 添加網(wǎng)橋連接
– delif ### 刪除網(wǎng)橋連接

  卸載橋接接口過程
  brctl show
  brctl delif br0 eth0
  brctl show
  brctl delbr br0
  ifconfig br0 down
  brctl show

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI