bond的主备模式

您所在的位置:网站首页 Linux配置网卡绑定 bond的主备模式

bond的主备模式

2023-12-25 20:17| 来源: 网络整理| 查看: 265

【学习笔记】Linux操作系统bond配置主/备网卡绑定与测试案例

时间:2016-10-17 15:35   来源:Oracle研究中心   作者:网络   点击:

天萃荷净

分享一篇关于Linux操作系统bond的7种模式中最常用的主/备模式配置方法案例,是测试rhel 5这个版本下配置网卡的多个bond。

linux bond的模式只持7种,常常使用的是1(主备)这个模式,不需要交换机上做任何操作,当主网卡出现故障的时候自己切换到备用网卡。此没有只能在rhel5下面有效,rhel4肯定是不支持的,rhel6还没有玩过。rhel下面配置网卡绑定一点不人性化,没有suse,aix那么简单。

1,查看网卡与网线连接情况

[root@localhost ~]# mii-tool

eth0: negotiated 100baseTx-FD, link ok

eth1: negotiated 100baseTx-FD, link ok

eth2: negotiated 100baseTx-FD, link ok

eth3: negotiated 100baseTx-FD, link ok

eth4: negotiated 100baseTx-FD, link ok

[root@localhost ~]# ifconfig -a|grep addr

eth0      Link encap:Ethernet  HWaddr 00:0C:29:87:3B:8D

inet addr:192.168.111.6  Bcast:192.168.111.255  Mask:255.255.255.0

eth1      Link encap:Ethernet  HWaddr 00:0C:29:87:3B:97

eth2      Link encap:Ethernet  HWaddr 00:0C:29:87:3B:A1

eth3      Link encap:Ethernet  HWaddr 00:0C:29:87:3B:AB

eth4      Link encap:Ethernet  HWaddr 00:0C:29:87:3B:B5

inet addr:127.0.0.1  Mask:255.0.0.0

2,修改/etc/modprobe.conf文件

[root@localhost log]# tail -2 /etc/modprobe.conf

alias bond0 bonding

alias bond1 bonding

[root@localhost ~]# set -o vi

[root@localhost ~]# modprobe bonding

[root@localhost ~]# modprobe bond1

[root@localhost ~]# modprobe bond0

modprobe是手动加载模块,我们还可以会用到关于模块的其它几个命令,lsmod查看系统上已经加载的模块,modinfo查看模块的详细信息,rmmod,删除已经加载的模块。

3,配置IP地址信息

这里是eth1与eth2绑定成bond0,eth3与eth4绑定成bond1,bond0与bond1的IP如下面配置

[root@localhost network-scripts]# cat ifcfg-bond0

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)

DEVICE=bond0

BOOTPROTO=none

ONBOOT=yes

MASTER=yes

TYPE=Ethernet

NETMASK=255.255.255.0

IPADDR=192.168.112.6

GATEWAY=192.168.111.1

BONDING_OPTS="mode=1 miimon=100"

[root@localhost network-scripts]# cat ifcfg-bond1

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)

DEVICE=bond1

BOOTPROTO=none

ONBOOT=yes

MASTER=yes

TYPE=Ethernet

NETMASK=255.255.255.0

IPADDR=192.168.113.6

GATEWAY=192.168.111.1

BONDING_OPTS="mode=1 miimon=100"

[root@localhost network-scripts]# cat ifcfg-eth1

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)

DEVICE=eth1

BOOTPROTO=none

ONBOOT=yes

TYPE=Ethernet

MASTER=bond0

SLAVE=yes

[root@localhost network-scripts]# cat ifcfg-eth2

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)

DEVICE=eth2

BOOTPROTO=none

ONBOOT=yes

TYPE=Ethernet

MASTER=bond0

SLAVE=yes

[root@localhost network-scripts]# cat ifcfg-eth3

# Intel Corporation 82545EM Gigabit Ethernet Contro



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3