Centos7 使用 nmcli 命令行工具配置 bond 之章节一

本贴最后更新于 1935 天前,其中的信息可能已经事过景迁

创建 bond 接口配置文件

  • systemctl status NetworkManager && systemctl start NetworkManage
  • nmcli con add type bond ifname bond0 mode active-backup
  • nmcli con add type bond-slave ifname enp2s0f0 master bond0
  • nmcli con add type bond-slave ifname enp2s0f1 master bond0

将原来的网卡配置文件备份并删除

  • cd /etc/sysconfig/network-scripts/
  • mkdir bk && mv ifcfg-enp2s0f* bk/

对 bond0 配置网络信息并启动网络进行测试

  • sed -i 's/dhcp/static/g' /etc/sysconfig/network-scripts/ifcfg-bond-bond0
  • echo "IPADDR=192.168.2.110" >> /etc/sysconfig/network-scripts/ifcfg-bond-bond0
  • echo "NETMASK=255.255.255.0" >> /etc/sysconfig/network-scripts/ifcfg-bond-bond0
  • echo "GATEWAY=192.168.2.1" >> /etc/sysconfig/network-scripts/ifcfg-bond-bond0
  • echo "DNS1=127.0.0.1" >> /etc/sysconfig/network-scripts/ifcfg-bond-bond0
  • nmcli con up bond-slave-enp2s0f0
  • nmcli con up bond-slave-enp2s0f1
  • nmcli con up bond-bond0
  • systemctl restart network
  • ip a | grep bond0
  • cat /proc/net/bonding/bond0
  • cat /sys/class/net/bond0/
说明:
   不支持对不使用网络交换机的直接线缆连接进行绑定操作。笔者做个测试,使用hub进行bonding测试,当断掉其中一个从属接口是是不会自动进行切换的,拔了网线(down)才可以。
   bond0 其实就是主接口、enp2s0f0enp2s0f1 就是所谓的从属接口
   如果bond启动异常,可以尝试停止NetworkManager服务
   下面是官方的一些介绍,有意思的童鞋可以查阅下:

# Root Cause
- The Linux bonding driver is not developed or tested with crossover in mind, either by Red Hat or the upstream Linux community.
- Such a configuration is at odds with accepted industry recommendations for redundancy and reliability.
- The Bonding module in MII monitoring mode concerns itself with the state of the "link" as reported by the PHY'1 in the NIC, so with the state the hardware and the electrical signalling is reported.
- If an interface is administratively disabled in such a configuration, the `PHY` may still maintain electrical connectivity to the peer and failover will not work as expected, leading to a lack of bond communication.
- This is a hardware/PHY/firmware design point, and not something to be fixed in software. As this is very hardware dependant, it is best to simulate all failure scenarios prior deployment.
- Whilst the ARP monitoring mode could be used, there are few configurations where it would theoretically work, and it is easily possible to get such systems into a state where link appears up but communication does not work.

未完待续内容预告......

Centos7 使用 nmcli 命令行工具配置 bond 之章节二

  • fail_over_mac=0/1
  • miimon=time_in_milliseconds

Centos7 配置 bond 的 VLAN 子接口之章节三

  • CentOS

    CentOS(Community Enterprise Operating System)是 Linux 发行版之一,它是来自于 Red Hat Enterprise Linux 依照开放源代码规定释出的源代码所编译而成。由于出自同样的源代码,因此有些要求高度稳定的服务器以 CentOS 替代商业版的 Red Hat Enterprise Linux 使用。两者的不同在于 CentOS 并不包含封闭源代码软件。

    238 引用 • 224 回帖 • 1 关注
  • nmcli
    2 引用

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...