第二十章linux~高階網路配置
一 ,網路橋接brod bond網路
什麼是Bond
簡單的說,bonding就是把多個物理網路介面繫結到一起,使它們就像一個網路介面那樣執行。 通過Bonding技術,可以實現網口冗餘,負載均衡,從而達到高可用高可靠的目的 bond的主要三種策略模式 平衡掄迴圈策略 主-備份策略 平衡策略
1.一臺虛擬機器共需要兩個網絡卡。首先新增網絡卡(NIC) nm-connection-editor 清除裡面的網絡卡資訊 nmcli connection add con-name bond0 ifname bond0 type bond mode active-backupip4 ip/24 建立bond0並指定ip
nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0 nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0 上述時給bond0新增eth0和eth1網絡卡 watch -n 1 cat /proc/net/bonding/bond0 監控變化 新增網絡卡之後就可以網路ping通自己真機ip ifconfig eth0 down 停止這個網絡卡 ifconfig eth0 up 啟用這個網絡卡 2.用配置檔案配備bond nm-connection-editor 清除裡面的網絡卡資訊
可以使虛擬機器的網絡卡直接連線到真機的真實網絡卡,使上網速度更快 備份ifcfg-br0,ifcfg-enp3s0
清除網絡卡多餘資訊 reboot 重啟 新建網路檔案 重新啟動網路 在虛擬機器中 brctl show 檢視橋接
brctl addbr br0 新增br0 brctl show 檢視橋接 ifconfig br0 ip 新增ip 此時未新增網絡卡還ping不通真機 給br0新增網絡卡就可ping通真機了 刪除橋接