1.安裝ifenslave
sudo apt-get install ifenslave
具體步驟:
sudo su
root@iqbal: mysql -u root -p
Enter password:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '<your password>';
如果出現(xiàn)錯誤(1819),執(zhí)行如下命令:
mysql> uninstall plugin validate_password;
Then restart mysql: systemctl restart mysql
修復(fù)依賴關(guān)系
apt install -f
繼續(xù)安裝sudo apt install ifenslave
2.加載內(nèi)核支持
sudo vi /etc/modules
寫入
loop
lp
rtc
bonding
3.停止網(wǎng)絡(luò)
sudo systemctl stop networking.service
4.加載內(nèi)核綁定
sudo modprobe bonding
5.修改接口配置文件
sudo vi /etc/network/interfaces
內(nèi)容如下:切記寫入文件時將備注刪除
文件具體可參考如下:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto enp129s0f0 #enp129s0f0 為網(wǎng)卡名稱,ifconfig可以看到
iface enp129s0f0 inet manual
pre-up ifconfig enp129s0f0 hw ether [ac:1f:6b:28:bb:b0](http://ac:1f:6b:28:bb:b0/) #網(wǎng)卡0mac 地址
bond-master bond0
bond-primary enp129s0f0 enp129s0f1
auto enp129s0f1
iface enp129s0f1 inet manual
pre-up ifconfig enp129s0f1 hw ether [ac:1f:6b:28:bb:b1](http://ac:1f:6b:28:bb:b1/) #網(wǎng)卡1 mac物理地址
bond-master bond0
bond-primary enp129s0f0 enp129s0f1
auto bond0
iface bond0 inet static
pre-up ifconfig bond0 hw ether [ac:1f:6b:28:bb:b0](http://ac:1f:6b:28:bb:b0/) #網(wǎng)卡0mac 物理地址
address 192.168.102.31
gateway 192.168.102.1
netmask 255.255.255.0
bond-mode active-backup #主備模式,也可以使用負(fù)載模式balance-rr,或者其它:balance-xor,broadcast,802.3ad,
bond-miimon 100
bond-slaves none
dns-nameserver 8.8.8.8 #dns-nameserver
6.重啟網(wǎng)卡2種方式
sudo /etc/init.d/networking restart
sudo systemctl restart networking.service
7.查看ip addr
如果bond0網(wǎng)卡狀態(tài)為state down,此時需要重啟服務(wù)器,然后再執(zhí)行命令啟動網(wǎng)卡(步驟6)
再查看狀態(tài)bond0為state up就可以了
單一啟動網(wǎng)卡命令:ifconfig enp129s0f1 up 或者 ifup enp129s0f1