凤凰的饲养方法下载:最新分享

来源:百度文库 编辑:偶看新闻 时间:2024/05/04 14:10:49
liunx下双网卡绑定

配置思路:

1、设置虚拟网卡BOND0

[root@F1RPT01 network-scripts]# pwd

/etc/sysconfig/network-scripts

[root@F1RPT01 network-scripts]#cp –r ifcfg-eth0 ifcfg-bond0

[root@F1RPT01 network-scripts]# more ifcfg-bond0

# Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet

DEVICE=bond0

BOOTPROTO=none

ONBOOT=yes

NETMASK=255.255.255.0

IPADDR=172.16.50.21

GATEWAY=172.16.5.254

TYPE=Ethernet

USERCTL=no

IPV6INIT=no

PEERDNS=yes

2、修改eth0网口

more ifcfg-eth0

# Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet

DEVICE=eth0

BOOTPROTO=none

HWADDR=00:21:5E:70:A8:34

ONBOOT=yes

TYPE=Ethernet

USERCTL=no

IPV6INIT=no

PEERDNS=yes

MASTER=bond0

SLAVE=yes

# NETMASK=255.255.255.0

# IPADDR=172.16.50.21

# GATEWAY=172.16.5.254

3、修改eth1

[root@F1RPT01 network-scripts]# more ifcfg-eth1

# Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet

DEVICE=eth1

BOOTPROTO=none

HWADDR=00:21:5E:70:A8:36

ONBOOT=yes

TYPE=Ethernet

MASTER=bond0

SLAVE=yes

PEERDNS=yes

USERCTL=no

IPV6INIT=no

4、修改其他配置

[root@F1RPT01 network-scripts]# vi /etc/modprobe.conf

alias eth0 bnx2

alias eth1 bnx2

alias scsi_hostadapter aacraid

alias scsi_hostadapter1 ata_piix

alias scsi_hostadapter2 qla2xxx

alias eth0 bnx2

alias eth1 bnx2

alias scsi_hostadapter aacraid

alias scsi_hostadapter1 ata_piix

alias bond0 bonding

options bond0 mode=1 miimon=100 use_carrier=0

"/etc/modprobe.conf" 7L, 194C written

5、双网卡的测试效果:

在终端笔记本上一直ping主机IP地址;将一个网口从机器中拔掉,然后机器会出现一定延时的“time out";然后将这个网口插好,将另外一个网口拔掉,这样交替切换,都会有一定延时。

6、对应用影响:

我在集群实施中,发现双网卡绑定对应用有一定影响。我做的是LINUX自带的HA功能,发现当拔掉第一个网口,资源发现有切换的情况,将第一个网口复位,将第二个网口拔掉,资源不会切换。这个问题,成我的一个疑惑,难道绑定后的网口,分主从之分?