【无标题】

bonding广播模式

#创建测试环境

bash 复制代码
# 创建网络命名空间
 ip netns add bond-ns1
 ip netns add bond-ns2

# 创建三对 veth 接口(使用三对以演示主备模式)
 ip link add veth0-ns2 type veth peer name veth0-ns1
 ip link add veth1-ns2 type veth peer name veth1-ns1

# 将 veth-ns 端移到命名空/
 ip link set veth0-ns1 netns bond-ns1
 ip link set veth1-ns1 netns bond-ns1

 ip link set veth0-ns2 netns bond-ns2
 ip link set veth1-ns2 netns bond-ns2

# 创建 bond1 接口
#ip netns exec bond-ns1 ip link add bond1 type bond mode 3 miimon 100
ip netns exec bond-ns1 ip link add bond1 type bond mode 3 

# 将 veth 接口添加到 bond
ip netns exec bond-ns1 ip link set veth0-ns1 master bond1
ip netns exec bond-ns1 ip link set veth1-ns1 master bond1

# 激活所有接口
ip netns exec bond-ns1 ip link set veth0-ns1 up
ip netns exec bond-ns1 ip link set veth1-ns1 up
ip netns exec bond-ns1 ip link set bond1 up
ip netns exec bond-ns1 ip link set lo up

# 为 bond1 分配 IP 地址
ip netns exec bond-ns1 ip addr add 192.168.10.1/24 dev bond1

#检查 bond0 状态(在命名空间)
ip netns exec bond-ns1 cat /proc/net/bonding/bond1




# 创建 bond2 接口
#ip netns exec bond-ns2 ip link add bond2 type bond mode 3 miimon 100
ip netns exec bond-ns2 ip link add bond2 type bond mode 3 

# 将 veth 接口添加到 bond
ip netns exec bond-ns2 ip link set veth0-ns2 master bond2
ip netns exec bond-ns2 ip link set veth1-ns2 master bond2

# 激活所有接口
ip netns exec bond-ns2 ip link set veth0-ns2 up
ip netns exec bond-ns2 ip link set veth1-ns2 up
ip netns exec bond-ns2 ip link set bond2 up
ip netns exec bond-ns2 ip link set lo up

# 为 bond2 分配 IP 地址
ip netns exec bond-ns2 ip addr add 192.168.10.2/24 dev bond2

#检查 bond0 状态(在命名空间)
ip netns exec bond-ns2 cat /proc/net/bonding/bond2
相关推荐
_itgo8 小时前
意图识别落地方案
运维·docker·容器
mengge.cloud8 小时前
0909华为云计算类综合服务小白实验教程
linux·运维·服务器·网络·华为云·云计算
fpcc9 小时前
c++编程实践—统一初始化
服务器·c++
QYR-分析10 小时前
蓝海赛道高速扩容!全球小型观察ROV市场格局、细分场景与发展趋势分析
大数据·运维·云计算
陈皮糖..10 小时前
从零搭建一个简易 AI 运维问答机器人(RAG + LangChain + Streamlit)
运维·人工智能·ai·langchain·机器人
制造业的搬运工11 小时前
AI服务器背板与传统背板差异:三大设计升级解析
运维·服务器·人工智能·科技·制造·pcb工艺
制冷技术咨询与服务11 小时前
某纯电牵引车整车CAN网络
网络·汽车·can·某纯电牵引车整车can网络
zhengqweasd11 小时前
Linux网络(一):服务器数据包从网卡到应用程序,完整收包流程详解
linux·服务器·网络
顶点多余11 小时前
仿muduo库实现高并发服务器项目
运维·服务器
脚踏实地,坚持不懈!11 小时前
Linux 6.18.7 内存分配与回收 —— 代码梳理
linux·运维·网络