银河麒麟服务器操作系统【双网卡绑定之bond0】操作方法
一、【使用场景】
银河麒麟服务器操作系统支持双网卡绑定。双网卡绑定可以实现将两块网卡虚拟成一块网卡,当其中一个网卡坏掉后网络通信仍然可以正常使用。在使用银河麒麟服务器操作系统时存在需要配置双网卡绑定的情况,例如为了保证系统中业务能够正常运行,需要配置双网卡绑定。
二、【操作方法】
以使用网卡名为enp3s0 、enp4s2的这两张网卡进行双网卡绑定为例,打开终端依次执行以下操作步骤:
步骤1:创建bond,并设置相应模式
nmcli connection add type bond ifname bond0 con-name bond0 mode active-backup //其中type为类型,ifname为设备名称(bond0为虚拟设备), con-name为自定义配置连接名称,mode为模式。
步骤2:网卡的IP地址若为自动获取,则可以忽略该步骤;若为手动获取,则执行以下命令为bond配置ip地址
nmcli connection modify bond-bond0 ipv4.method manual ipv4.addresses [IP地址/子网掩码的网络位数] ipv4.gateway [网关地址] ipv6.method ignore //配置完成后,bond0为本机IP。
步骤3:将需要绑定的子网卡加入到bond
nmcli connection add type bond-slave ifname enpxxxx(网卡名称) con-name enpxxxx(网卡名称) master bond0
例如:将enp3s0网卡和enp4s2网卡加入到bond。
nmcil con add type bond -slave ifname enp3s0 master bond0
nmcil con add type bond -slave ifname enp4s2 master bond0
步骤4:激活bond子网卡
nmcli connection up enpxxxxx //启用enpxxxxx网卡
例如:激活enp3s0网卡和enp4s2网卡。
nmcli connection up enp3s0
nmcli connection up enp4s2
步骤5:激活bond
nmcli connection up bond0 //启用bond0
步骤6:查看bond配置
nmcli connection show //查看配置信息