• 用nmcli命令进行网卡绑定配置

    发布时间:2019-10-08 09:11:48
    作者:ynkulusi
  • # nmcli connection add type bond con-name bond0 ifname bond0 bond.options "mode=active-backup"
    # nmcli connection add type bond con-name bond0 ifname bond0 bond.options "mode=active-backup,miimon=1000"
    ipv4配置方式
    # nmcli connection modify bond0 ipv4.addresses '192.0.2.1/24'
    # nmcli connection modify bond0 ipv4.gateway '192.0.2.254'
    # nmcli connection modify bond0 ipv4.dns '192.0.2.253'
    # nmcli connection modify bond0 ipv4.method manual
    ipv6配置方式
    # nmcli connection modify bond0 ipv6.addresses '2001:db8::1/32
    # nmcli connection modify bond0 ipv6.gateway '2001:db8::fffe'
    # nmcli connection modify bond0 ipv6.dns '2001:db8::fffd'
    # nmcli connection modify bond0 ipv6.method manual
    查看可用于绑定的接口
    # nmcli device
    DEVICE  TYPE      STATE         CONNECTION
    enp1s0  ethernet  connected     enp1s0
    enp7s0  ethernet  disconnected  --
    enp8s0  ethernet  disconnected  --
    lo      loopback  unmanaged     --
    enp7s0enp8s0两个接口绑定
    # nmcli connection add type ethernet slave-type bond con-name bond0-port1 ifname enp7s0
    master bond0
    # nmcli connection add type ethernet slave-type bond con-name bond0-port2 ifname enp8s0
    master bond0
    激活绑定的接口
    # nmcli connection up bond0
    查看绑定情况
    # nmcli device
    DEVICE   TYPE      STATE      CONNECTION
    ...
    enp7s0   ethernet  connected  bond0-port1
    enp8s0   ethernet  connected  bond0-port2
    启用激活从设备命令
    # nmcli connection modify bond0 connection.autoconnect-slaves 1
    重新激活绑定网卡
    # nmcli connection up bond0
    查看绑定状态信息
    # cat /proc/net/bonding/bond0
    Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
    Bonding Mode: fault-tolerance (active-backup)
    Primary Slave: None
    Currently Active Slave: enp7s0
    MII Status: up
    MII Polling Interval (ms): 100
    Up Delay (ms): 0
    Down Delay (ms): 0
    Slave Interface: enp7s0
    MII Status: up
    Speed: Unknown
    Duplex: Unknown
    Link Failure Count: 0
    Permanent HW addr: 52:54:00:d5:e0:fb
    Slave queue ID: 0
    Slave Interface: enp8s0
    MII Status: up
    Speed: Unknown
    Duplex: Unknown
    Link Failure Count: 0
    Permanent HW addr: 52:54:00:b2:e2:63
    Slave queue ID: 0
    创建绑定参考文档:
    https://www.kernel.org/doc/Documentation/networking/bonding.txt
     
  • 分类:network
    标签: rhel8 centos8
    评论数:0 阅读数:874