配置聚合网口
配置聚合网口
要求
完成 OS 层面安装,进入到终端界面执行如下命令
修改配置文件
vim /etc/netplan/01-netcfg.yaml
在文件末尾中增加内容,结果如下
network:
version: 2
renderer: networkd
ethernets:
eno1: {} # eno1代表网口名称,可以使用ifconfig -a查出网口名称,如果需要确认是哪个网口,可以使用ethtool -p [网口名称],可以在点亮物理机上网口的灯
eno2: {}
bonds:
bond0:
addresses: [xx.xx.xx.xx/24] # 这里的xx.xx.xx.xx代表服务器IP,24代表掩码位,例如掩码位24对应子网掩码255.255.255.0
gateway4: xx.xx.xx.xx # 这里的xx.xx.xx.xx代表网关IP
interfaces: # interfaces代表bond绑定的网口,填写的网口名称与ethernets中所填写的网口名称相同即可
- eno1
- eno2
parameters:
mode: balance-rr # bond模式,模式种类如下章描述,根据需求调整参数即可
mii-monitor-interval: 100
bond 模式
mode | 参数 | 名称 |
---|---|---|
mode=0 | balance-rr | 轮询均衡模式 |
mode=1 | active-backup | 主备模式 |
mode=2 | balance-xor | 平衡策略 |
mode=3 | broadcast | 广播策略 |
mode=4 | 802.3ad | |
mode=5 | balance-tlb | |
mode=6 | balance-alb |
Leave a comment