CentOS 7.6 bond mode4 配置

小鱼儿 2023-01-23 10:52 83阅读 0赞

CentOS 7.6 bond mode4 配置

  • CentOS 7.6 bond mode4 配置
  • 双网卡配置 bond mode4 配置
  • 创建配置文件 ifcfg-bond0
  • 如果bond0接口已经配置,不再需要配置
  • 备份网卡配置文件
  • ens3f0
  • ens3f1
  • 查看bond0信息
  • 查看bond0 速率
  • 交换机配置 lacp
  • 防火墙
  • 网速测试
    • 服务端
  • 参考

CentOS 7.6 bond mode4 配置

双万兆网口配置 bond mode4 layer3+4

双网卡配置 bond mode4 配置

  1. # cat /etc/redhat-release
  2. CentOS Linux release 7.6.1810 (Core)
  3. yum search ifconfig
  4. yum install net-tools.x86_64
  • 查看网线是否插入

    cat /sys/class/net/ens3f0/carrier

    1

    cat /sys/class/net/ens3f1/carrier

    1

  • 关闭 NetworkManager 服务

    systemctl status NetworkManager.service
    systemctl stop NetworkManager.service
    systemctl disable NetworkManager.service

  • 内核加载 bonding

    modprobe —first-time bonding

    lsmod | grep bonding

    bonding 152656 0

创建配置文件 ifcfg-bond0

  1. vim /etc/sysconfig/network-scripts/ifcfg-bond0
  2. DEVICE=bond0
  3. TYPE=Bond
  4. IPADDR=192.168.2.11
  5. NETMASK=255.255.255.0
  6. GATEWAY=192.168.2.1
  7. DNS1=114.114.114.114
  8. USERCTL=no
  9. BOOTPROTO=none
  10. ONBOOT=yes
  11. BONDING_MASTER=yes
  12. BONDING_OPTS="miimon=100 mode=4 xmit_hash_policy=layer3+4"

如果bond0接口已经配置,不再需要配置

  1. vim /etc/modprobe.d/bond.conf
  2. alias bond0 bonding
  3. options bond0 miimon=100 mode=4 xmit_hash_policy=layer3+4

备份网卡配置文件

  1. cd /etc/sysconfig/network-scripts
  2. cp ifcfg-ens3f0 ifcfg-ens3f0_backup
  3. cp ifcfg-ens3f1 ifcfg-ens3f1_backup

ens3f0

  1. vim /etc/sysconfig/network-scripts/ifcfg-ens3f0
  2. TYPE=Ethernet
  3. PROXY_METHOD=none
  4. BROWSER_ONLY=no
  5. BOOTPROTO=none
  6. DEFROUTE=yes
  7. IPV4_FAILURE_FATAL=no
  8. IPV6INIT=yes
  9. IPV6_AUTOCONF=yes
  10. IPV6_DEFROUTE=yes
  11. IPV6_FAILURE_FATAL=no
  12. IPV6_ADDR_GEN_MODE=stable-privacy
  13. NAME=ens3f0
  14. UUID=39aa32a1-acb3-4cd3-a806-be5c041a2310
  15. DEVICE=ens3f0
  16. ONBOOT=yes
  17. MASTER=bond0
  18. SLAVE=yes

ens3f1

  1. vim /etc/sysconfig/network-scripts/ifcfg-ens3f1
  2. TYPE=Ethernet
  3. PROXY_METHOD=none
  4. BROWSER_ONLY=no
  5. BOOTPROTO=none
  6. DEFROUTE=yes
  7. IPV4_FAILURE_FATAL=no
  8. IPV6INIT=yes
  9. IPV6_AUTOCONF=yes
  10. IPV6_DEFROUTE=yes
  11. IPV6_FAILURE_FATAL=no
  12. IPV6_ADDR_GEN_MODE=stable-privacy
  13. NAME=ens3f1
  14. UUID=4b5c8908-3e83-40b2-a9db-d0713135f4c2
  15. DEVICE=ens3f1
  16. ONBOOT=yes
  17. MASTER=bond0
  18. SLAVE=yes
  • 重启网络服务

    systemctl restart network

    ifconfig

    bond0: flags=5187 mtu 1500

    1. inet 192.168.2.11 netmask 255.255.255.0 broadcast 192.168.2.255

查看bond0信息

  1. cat /proc/net/bonding/bond0
  2. Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
  3. Bonding Mode: IEEE 802.3ad Dynamic link aggregation
  4. Transmit Hash Policy: layer3+4 (1)
  5. MII Status: up
  6. MII Polling Interval (ms): 100
  7. Up Delay (ms): 0
  8. Down Delay (ms): 0
  9. 802.3ad info
  10. LACP rate: slow
  11. Min links: 0
  12. Aggregator selection policy (ad_select): stable
  13. System priority: 65535
  14. System MAC address: bc:16:95:07:97:b0
  15. Active Aggregator Info:
  16. Aggregator ID: 1
  17. Number of ports: 1
  18. Actor Key: 15
  19. Partner Key: 1
  20. Partner Mac Address: 00:00:00:00:00:00
  21. Slave Interface: ens3f0
  22. MII Status: up
  23. Speed: 10000 Mbps
  24. Duplex: full
  25. Link Failure Count: 1
  26. Permanent HW addr: bc:16:95:07:97:b0
  27. Slave queue ID: 0
  28. Aggregator ID: 1
  29. Actor Churn State: none
  30. Partner Churn State: churned
  31. Actor Churned Count: 0
  32. Partner Churned Count: 1
  33. details actor lacp pdu:
  34. system priority: 65535
  35. system mac address: bc:16:95:07:97:b0
  36. port key: 15
  37. port priority: 255
  38. port number: 1
  39. port state: 77
  40. details partner lacp pdu:
  41. system priority: 65535
  42. system mac address: 00:00:00:00:00:00
  43. oper key: 1
  44. port priority: 255
  45. port number: 1
  46. port state: 1
  47. Slave Interface: ens3f1
  48. MII Status: up
  49. Speed: 10000 Mbps
  50. Duplex: full
  51. Link Failure Count: 1
  52. Permanent HW addr: bc:16:95:07:97:b1
  53. Slave queue ID: 0
  54. Aggregator ID: 2
  55. Actor Churn State: churned
  56. Partner Churn State: churned
  57. Actor Churned Count: 1
  58. Partner Churned Count: 1
  59. details actor lacp pdu:
  60. system priority: 65535
  61. system mac address: bc:16:95:07:97:b0
  62. port key: 15
  63. port priority: 255
  64. port number: 2
  65. port state: 69
  66. details partner lacp pdu:
  67. system priority: 65535
  68. system mac address: 00:00:00:00:00:00
  69. oper key: 1
  70. port priority: 255
  71. port number: 1
  72. port state: 1

查看bond0 速率

  1. ethtool bond0
  2. Settings for bond0:
  3. Supported ports: [ ]
  4. Supported link modes: Not reported
  5. Supported pause frame use: No
  6. Supports auto-negotiation: No
  7. Supported FEC modes: Not reported
  8. Advertised link modes: Not reported
  9. Advertised pause frame use: No
  10. Advertised auto-negotiation: No
  11. Advertised FEC modes: Not reported
  12. Speed: 10000Mb/s
  13. Duplex: Full
  14. Port: Other
  15. PHYAD: 0
  16. Transceiver: internal
  17. Auto-negotiation: off
  18. Link detected: yes

交换机配置 lacp

  1. Speed: 20000Mb/s 速率
  2. # ethtool bond0
  3. Settings for bond0:
  4. Supported ports: [ ]
  5. Supported link modes: Not reported
  6. Supported pause frame use: No
  7. Supports auto-negotiation: No
  8. Supported FEC modes: Not reported
  9. Advertised link modes: Not reported
  10. Advertised pause frame use: No
  11. Advertised auto-negotiation: No
  12. Advertised FEC modes: Not reported
  13. Speed: 20000Mb/s
  14. Duplex: Full
  15. Port: Other
  16. PHYAD: 0
  17. Transceiver: internal
  18. Auto-negotiation: off
  19. Link detected: yes

防火墙

  1. # firewall-cmd --state
  2. running
  3. systemctl stop firewalld.service

网速测试

  1. yum install -y iperf3

服务端

  1. iperf3 -s
  2. iperf3 -c 192.168.0.1服务端IP

参考


Centos7双网卡绑定配置 bonding
centos 链路捆绑(聚合)bonding配置举例
Centos 7 安装 iperf和服务器之间测速

发表评论

表情:
评论列表 (有 0 条评论,83人围观)

还没有评论,来说两句吧...

相关阅读

    相关 CentOS配置bond

    [CentOS配置bond][CentOS_bond] 一、什么是网卡绑定及简单原理      网卡绑定也称作"网卡捆绑",就是使用多块物理网卡虚拟成为一块网卡,以提供