CnetOS双网卡绑定

  1. 确认关闭NetworkManger
    [root@QN-Transit network-scripts]# systemctl stop NetworkManager
    [root@QN-Transit network-scripts]# systemctl disable NetworkManager
  2. 内核加载bonding
    [root@QN-Transit network-scripts]# lsmod | grep bond
    bonding               152979  0 
  3. 如果没有加载,手动加载
    [root@QN-Transit network-scripts]# modprobe --first-time bonding
  4. 配置bond模式
    [root@QN-Transit network-scripts]# cat /etc/modprobe.d/bonding.conf 
    alias bond0 binding
    options bond0 miimon=100 mode=0
  5. 配置bond
    [root@QN-Transit network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 
    TYPE=Bond
    BOOTPROTO=none
    ONBOOT=yes   
    USERCTL=no
    DEVICE=bond0
    IPADDR=192.168.10.3
    PREFIX=24
    NM_CONTROLLED=no
    BONDING_MASTER=yes
  6. 配置slaver接口
    [root@QN-Transit network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-em1
    TYPE=Ethernet
    BOOTPROTO=none
    DEFROUTE=yes
    PEERDNS=yes
    PEERROUTES=yes
    NAME=em1
    DEVICE=em1
    ONBOOT=yes
    MASTER=bond0
    SLAVE=yes
    USERCTL=no
    [root@QN-Transit network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-p2p1
    TYPE=Ethernet
    BOOTPROTO=none
    DEFROUTE=yes
    PEERDNS=yes
    PEERROUTES=yes
    NAME=p2p1
    DEVICE=p2p1
    ONBOOT=yes
    MASTER=bond0
    SLAVE=yes
    USERCTL=no
  7. 重启网络服务
    [root@QN-Transit network-scripts]# systemctl restart network
    [root@QN-Transit network-scripts]# cat /proc/net/bonding/bond0 
    Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
    
    Bonding Mode: load balancing (round-robin)
    MII Status: up
    MII Polling Interval (ms): 0
    Up Delay (ms): 0
    Down Delay (ms): 0
    
    Slave Interface: em1
    MII Status: up
    Speed: 100 Mbps
    Duplex: full
    Link Failure Count: 0
    Permanent HW addr: 2c:ea:7f:aa:be:26
    Slave queue ID: 0
    
    Slave Interface: p2p1
    MII Status: up
    Speed: 100 Mbps
    Duplex: full
    Link Failure Count: 0
    Permanent HW addr: e8:61:1f:14:35:98
    Slave queue ID: 0
posted @ 2021-10-19 17:26  MacoPlus  阅读(49)  评论(0编辑  收藏  举报