【无标题】

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
相关推荐
虎头金猫9 小时前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
AI职业加油站11 小时前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展
wuyk55511 小时前
《WiFi 嵌入式物联网开发全套实战》| 第 16 章 ESP32 AP+STA 双模共存原理与工程坑点
网络·stm32·物联网
此冬歌咏12 小时前
K8s 节点故障实战:优雅驱逐 31 秒,硬故障 331 秒,以及那个永远 Pending 的 Pod
运维·k8s
-梅12 小时前
linux(8) 软硬链接
linux·运维·服务器
Wang's Blog12 小时前
Java 项目实战: 外卖平台-文件下载与ServletOutputStream回写浏览器
服务器·项目开发
张洛闻Eren13 小时前
k8s云原生【第十课】:水平 Pod 自动扩缩容
运维·数据库·云原生·kubernetes·github
琥珀色糖13 小时前
SimlpeHttp
linux·服务器
其实防守也摸鱼13 小时前
内网穿透与反向代理:原理、工具与实战指南
android·大数据·运维·安全·网络安全·自动化·渗透
第十人i13 小时前
Linux 日志管理系统:journald 配置与优化
linux·服务器