第九周

第九周

1、總結ip分類以及每個分類可以分配的IP數(shù)量

IP地址由兩部分組成

  • 網(wǎng)絡ID:標識網(wǎng)絡,每個網(wǎng)段分配一個網(wǎng)絡ID,處于高位
  • 主機 ID:標識單個主機,由組織分配給各設備,處于低位
類型 網(wǎng)絡ID位數(shù) 網(wǎng)絡數(shù) 每個網(wǎng)絡中的主機數(shù)
A類 8(最高一位0開頭) 126=2^7 2^24-2=16777214
B類 16(最高二位10開頭) 2^14=16384 2^16-2=65534
C類 24(最高三位110開頭) 2^21=2097152 2^8-2=254
IP地址分類.png

2、總結IP配置方法

使用掩碼將IP地址分成,網(wǎng)絡ID和主機ID。

劃分子網(wǎng):將一個大的網(wǎng)絡(主機數(shù)多)劃分成多個小的網(wǎng)絡(主機數(shù)少),主機ID位數(shù)變少,網(wǎng)絡ID位數(shù)變多,網(wǎng)絡ID位向主機ID位借位

合并超網(wǎng):將多個小網(wǎng)絡合并成一個大網(wǎng),主機ID位向網(wǎng)絡ID位借位

3、使用nmcli實現(xiàn)bonding

共7種模式:0-6 Mode,主要使用Mod1 ,和Mode4.

  • 第?種模式:Mode=1,即: (active-backup) Active-backup policy(主-備份策略)
    特點:只有?個設備處于活動狀態(tài),當?個宕掉另?個?上由備份轉換為主設備。mac地址是外部可?得,從外?看來,bond的MAC地址是唯?的,以避免switch(交換機)發(fā)?混亂。此模式只提供了容錯能?;由此可?此算法的優(yōu)點是可以提供??絡連接的可?性,但是它的資源利?率較低,只有?個接?處于?作狀態(tài),在有 N 個?絡接?的情況下,資源利?率為1/N。
  • 第五種模式:mod=4,即:(802.3ad) IEEE 802.3adDynamic link aggregation(IEEE 802.3ad 動態(tài)鏈接聚合)
    特點:創(chuàng)建?個聚合組,它們共享同樣的速率和雙?設定。根據(jù)802.3ad規(guī)范將多個slave?作在同?個激活的聚合體下。
    必要條件:
    條件1:ethtool?持獲取每個slave的速率和雙?設定。
    條件2:switch(交換機)?持IEEE 802.3ad Dynamic link aggregation。
    條件3:?多數(shù)switch(交換機)需要經(jīng)過特定配置才能?持802.3ad模式。

mode4需要交換機支持,下面以Mode=1做演示。

#新增加兩塊網(wǎng)卡eth1和eth2,將這兩塊網(wǎng)卡做綁定
NAME                UUID                                  TYPE      DEVICE 
eth0                fed95e28-f18c-4d8c-8f33-cdad1c41eb48  ethernet  eth0   
Wired connection 1  6b9ef669-fa55-350e-9d77-e6796abddfae  ethernet  eth1   
Wired connection 2  d6631399-4c3b-3b62-9706-280623374e99  ethernet  eth2 
# 添加一個bond接口為bond0
nmcli connection add type bond con-name bond0 ifname bond0 bond.options "mode=active-backup,miimon=1000"
root@centos8 ~]$nmcli device status
DEVICE  TYPE      STATE                                  CONNECTION         
eth0    ethernet  connected                              eth0               
eth1    ethernet  connected                              Wired connection 1 
eth2    ethernet  connected                              Wired connection 2 
bond0   bond      connecting (getting IP configuration)  bond0              
lo      loopback  unmanaged  
#給bond0添加接口
[root@centos8 ~]$nmcli connection add type ethernet slave-type bond con-name bond0-port1 ifname eth1 master bond0
Connection 'bond0-port1' (09b090c2-7952-434a-ae19-d2305ab5db69) successfully added.
[root@centos8 ~]$nmcli connection add type ethernet slave-type bond con-name bond0-port2 ifname eth2 master bond0
Connection 'bond0-port2' (961f2fd4-66f4-4343-95c3-6a42bfe9149a) successfully added.
#給bond0 添加ip地址,網(wǎng)關,dns
[root@centos8 ~]$nmcli connection modify bond0 ipv4.addresses '192.168.1.48' ipv4.gateway 192.168.1.252 ipv4.dns 223.5.5.5
# 激活connection:
[root@centos8 ~]$nmcli connection up bond0-port1
[root@centos8 ~]$nmcli connection up bond0-port2
[root@centos8 ~]$nmcli connection up bond0
#使bond0開機有效
[root@centos8 ~]$nmcli connection modify bond0 connection.autoconnect-slaves 1
# 再次激活connection:
[root@centos8 ~]$nmcli connection up bond0
# 驗證
[root@centos8 ~]$nmcli connection show 
NAME                UUID                                  TYPE      DEVICE 
eth0                fed95e28-f18c-4d8c-8f33-cdad1c41eb48  ethernet  eth0   
bond0               33380509-8f1e-4747-8a8a-f13caa786b7b  bond      bond0  
bond0-port1         09b090c2-7952-434a-ae19-d2305ab5db69  ethernet  eth1   
bond0-port2         961f2fd4-66f4-4343-95c3-6a42bfe9149a  ethernet  eth2   
bond0               6c059a6a-9cde-4ced-a13e-78fd7c69655d  bond      --     
bond0               7d8a2468-754e-4dbb-80b6-73fef65bbfaf  bond      --     
Wired connection 1  6b9ef669-fa55-350e-9d77-e6796abddfae  ethernet  --     
Wired connection 2  d6631399-4c3b-3b62-9706-280623374e99  ethernet  --    
[root@centos8 ~]$cat /proc/net/bonding/bond0 
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

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: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:93:21:27
Slave queue ID: 0

Slave Interface: eth2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:93:21:31
Slave queue ID: 0
[root@centos8 ~]$


參考:https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/configuring-network-bonding_configuring-and-managing-networking#configuring-a-network-bond-using-nmcli-commands_configuring-network-bonding

?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容