【无标题】

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
相关推荐
女神下凡11 分钟前
芯参谋(87):Linux 系统(SPI NOR)驱动开发指南
linux·运维·arm开发·驱动开发·嵌入式硬件·设计规范
海宇AI7 小时前
零信任架构实战:基于海宇个人风险报告构建自动化分期商城信用额度初审网关
运维·人工智能·架构·自动化
IMPYLH7 小时前
Linux 的时间为什么会被拨回去
linux·运维·服务器
2601_963282778 小时前
寒地窄带通信工程实践:黑龙江哈尔滨对讲机选型、组网与合规运维总结
运维·服务器·网络
叼烟扛炮9 小时前
[Git 实战] 学习笔记:从生成 SSH 密钥到解决 TortoiseGit 推送报错全指南
linux·运维·笔记·git·学习
是真的小外套9 小时前
网络安全实战第14期:Week2周末闯关
网络·安全·web安全
xbzb9 小时前
OpenStack 网络管理(理论):Linux 网络虚拟化是 Neutron 的地基
linux·服务器·网络·openstack·network·neutron
我要见SA姐110 小时前
GitHub Actions 自动化:5 个真实运维提效案例
运维·数据库·机器学习·oracle·回归
Android系统攻城狮11 小时前
Linux FFmpeg深度解析之avcodec_flush_buffers调用流程与实战(十九)
linux·运维·服务器·ffmpeg·车载音视频·ffmpeg音视频进阶
QXWZ_IA11 小时前
边坡监测预算有限时的建设顺序:虚拟基准站与成本账
网络·数据库