首页 > 其他分享 >网卡绑定bond0的实现

网卡绑定bond0的实现

时间:2022-12-02 18:00:56浏览次数:52  
标签:bond0 绑定 网卡 rocky8 slave eth0 root eth1 bond

1、虚拟机添加一张网卡

 

 

2、通过ip a可以看到多了一张eth1网卡

 

 3、创建bond0

[root@rocky8-1 ~]#nmcli connection add type bond con-name mybond0 ifname bond0 mode active-backup ipv4.method manual ipv4.address 192.168.177.100/24   #添加bonding接口,模式为主备模式并设置ip
Connection 'mybond0' (f081fbd6-f844-4bcd-99cf-3d9d9d47c063) successfully added.
[root@rocky8-1 ~]#nmcli connection add type bond-slave ifname eth0 master bond0       #添加从属接口eth0
Connection 'bond-slave-eth0' (3b9dcf40-da25-4045-8f67-03b93d3dabce) successfully added.
[root@rocky8-1 ~]#nmcli connection add type bond-slave ifname eth1 master bond0       #添加从属接口eth1
Connection 'bond-slave-eth1' (efd8ed09-bbd9-4500-8a3b-11d0f9afaf14) successfully added.
[root@rocky8-1 ~]#nmcli connection 
NAME             UUID                                  TYPE      DEVICE 
eth0             5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03  ethernet  eth0   
mybond0          f081fbd6-f844-4bcd-99cf-3d9d9d47c063  bond      bond0  
virbr0           7d51fad9-62e3-4890-848d-464a8f8001b0  bridge    virbr0 
bond-slave-eth1  efd8ed09-bbd9-4500-8a3b-11d0f9afaf14  ethernet  eth1   
bond-slave-eth0  3b9dcf40-da25-4045-8f67-03b93d3dabce  ethernet  --     
[root@rocky8-1 ~]#ls /etc/sysconfig/network-scripts/
ifcfg-bond-slave-eth0  ifcfg-bond-slave-eth1  ifcfg-eth0  ifcfg-mybond0

 [root@rocky8-1 ~]#nmcli connection up bond-slave-eth0   #先启动从属接口eth0
 Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
 [root@rocky8-1 ~]#nmcli connection up bond-slave-eth1   #启动从属接口eth1
 Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)

 [root@rocky8-1 ~]#nmcli conn up mybond0                 #启动绑定
 Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)



通过ip a命令可以看到eth0 eth1网卡已经没有ip地址,mac地址相同

 

 

[root@rocky8-1 ~]#cat /proc/net/bonding/bond0         #查看此文件看到当前主网卡是eth0,eth1为备用
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:49:e3:f9
Slave queue ID: 0

Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:49:e3:03
Slave queue ID: 0

断开eth0接口可看到网络丢了一个包重新连上

 

 将eth0启用,断开eth1,可看到网络丢一个包后重连正常

 

 将2个网卡都断开后网络中断

 

标签:bond0,绑定,网卡,rocky8,slave,eth0,root,eth1,bond
From: https://www.cnblogs.com/sunhl/p/16945231.html

相关文章

  • [DPDK] 多队列同时从网卡接收数据
    [DPDK]多队列同时从网卡接收数据在DPDK中,如何让多个核/多个接收队列同时从一个网卡接收数据呢?其实很简单,在port_conf里开启一个mq_mode选项就行了。structrte_eth_c......
  • 获取参数,把方法上的参数绑定到注解的变量中
    packagecom.geekmore.modules.device.aop;importjava.lang.reflect.Method;importorg.aspectj.lang.JoinPoint;importorg.aspectj.lang.reflect.MethodSignature;/***......
  • MAUI新生2.4-数据绑定和MVVM:MVVM的消息机制
    当两个对象之间需要建立松耦合关系时,特别适合使用消息机制。如ViewModel需要控制View进行某些操作时,如弹出对话框、播放动画,由于ViewModel对View是无感的,我们不能在ViewMod......
  • Vue2(笔记08) - Vue核心 - 绑定Class样式、绑定Style样式
    绑定Class样式Vue里引入 ​​:class="xxx"​​ 来绑定样式,"xxx" 即可以是样式名,也可以是表达式,原有class 不动;​字符串写法适用于样式的类名不确定,需要动态指定​需求:......
  • BLE配对与绑定(二)
    前言:前篇博客对配对绑定的流程进行了讲解,接下来针对CH582芯片的加密操作进行讲解。 一、手机连接peripheral加密处理用户为了安全一般会在蓝牙连接的时候进行加密的处......
  • 不使用数据绑定,分层显得更加清晰
    ASPX文件<tableid="list"><thead><tr><td>ID</td><td>......
  • 交换机arp转ip-mac绑定命令工具-免费版
    一、简介为了防止ARP破坏,我们经常需要在三层交换机上做IP地址与MAC地址的绑定操作。先要进入System-View系统视图模式,输入"sys"即可。system-view:[huawei]arpstatic192.1......
  • [Vue3-10]表单数据绑定
    1.输入框2.单选多选3.下拉选择......
  • Java进阶学习之反射与动态绑定(5)
    目录1.反射1.1.概述1.2.实现方式1.2.1.获取Class1.2.2.通过反射获取属性、设置属性1.2.3.通过反射获取方法、执行方法1.2.4.通过反射获取构造器并调用2.动态代理2.1.代理模......
  • wpf Datagrid绑定 Dictionary
    原文网址: https://www.cnblogs.com/zany-hui/articles/7623874.html数据源格式:Dictionary<int,List<string>>1.通过xaml设置<DataGridx:Name="dg"ItemsSource="{Bi......