【无标题】

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
相关推荐
予昊34 分钟前
从零实现“在线五子棋对战“:WebSocket 实时通信 + 段位匹配
java·开发语言·网络·websocket
一池秋_1 小时前
arm低配linux设备,桌面应用冷启动提速方法
linux·运维·arm开发
上海云盾-小余3 小时前
流量攻击复盘:为什么 WAF 完好,业务依旧瘫痪
运维·服务器·网络
IT大白鼠3 小时前
Docker 私有仓库管理:Harbor 企业级仓库搭建与镜像全生命周期管理
运维·docker·容器
戴西软件3 小时前
戴西iDWS.3DViz Suite数据轻量化可视化软件,从传统桌面软件向云端协同的重大突破
大数据·运维·网络·人工智能·机器学习·3d
芯盾时代3 小时前
《金融业网络安全管理办法(征求意见稿)》全条款深度拆解(三)
网络·安全·网络安全
米饭不加菜3 小时前
ESP-01S通过TCP直接与手机建立通信
网络·tcp/ip·智能手机
闲云野鹤在人间3 小时前
OpenStack架构介绍和安装流程
linux·网络·架构·openstack
我命由我123454 小时前
Linux - Linux/POSIX 路径斜杠折叠规则
linux·运维·服务器·android studio·android jetpack·android-studio·android runtime