#!/bin/bash
cat >/etc/sysconfig/network-scripts/ifcfg-bond0<<EOF1
BOOTPROTO=static
DEVICE=bond0
IPADDR=bond对外服务IP地址
PREFIX=27子网掩码位数
GATEWAY=10.91.225.97
USERCTL=no
ONBOOT=yes
EOF1
cat >/etc/sysconfig/network-scripts/ifcfg-eth4<<EOF2
DEVICE=eth4 eth4表示绑定网卡中的一块网卡
PREFIX=27 子网掩码位数
BOOTPROTO=static
MASTER=bond0
SLAVE=yes
ONBOOT=yes
EOF2
cat >/etc/sysconfig/network-scripts/ifcfg-eth5<<EOF3
DEVICE=eth5 eth5表示绑定网卡中的另一块网卡
PREFIX=27 子网掩码位数
BOOTPROTO=static
MASTER=bond0
SLAVE=yes
ONBOOT=yes
EOF3
BOOTPROTO=static
DEVICE=bond0
IPADDR=bond对外服务IP地址
PREFIX=27子网掩码位数
GATEWAY=10.91.225.97
USERCTL=no
ONBOOT=yes
EOF1
cat >/etc/sysconfig/network-scripts/ifcfg-eth4<<EOF2
DEVICE=eth4 eth4表示绑定网卡中的一块网卡
PREFIX=27 子网掩码位数
BOOTPROTO=static
MASTER=bond0
SLAVE=yes
ONBOOT=yes
EOF2
cat >/etc/sysconfig/network-scripts/ifcfg-eth5<<EOF3
DEVICE=eth5 eth5表示绑定网卡中的另一块网卡
PREFIX=27 子网掩码位数
BOOTPROTO=static
MASTER=bond0
SLAVE=yes
ONBOOT=yes
EOF3
#配置bond模式1主备方式
cat >/etc/modprobe.d/bonding.conf<<EOF4
alias bond0 bonding
options bond0 miimon=100 mode=1 primary=eth4
EOF4
echo "ifenslave bond0 eth4 eth5">>/etc/rc.d/rc.local
echo "/etc/init.d/network restart">>/etc/rc.d/rc.local
chmod 550 /etc/rc.d/rc.local
chmod 550 /etc/rc.local
reboot
#如果bond0无效建议重启,多组bond修改以上参数(此例为bond mod0配置)
cat >/etc/modprobe.d/bonding.conf<<EOF4
alias bond0 bonding
options bond0 miimon=100 mode=1 primary=eth4
EOF4
echo "ifenslave bond0 eth4 eth5">>/etc/rc.d/rc.local
echo "/etc/init.d/network restart">>/etc/rc.d/rc.local
chmod 550 /etc/rc.d/rc.local
chmod 550 /etc/rc.local
reboot
#如果bond0无效建议重启,多组bond修改以上参数(此例为bond mod0配置)
本文提供了一种在Linux系统上配置Bonding网络的方法,详细介绍了如何设置bond0接口为主备模式,并通过eth4和eth5两个网卡实现负载均衡与故障转移。文中包括具体的Shell脚本命令及配置文件。
1049

被折叠的 条评论
为什么被折叠?



