CentOS双网卡绑定bond0,centos双网卡bond0
CentOS双网卡绑定bond0,centos双网卡bond0
a)拷⻉并配置vim /etc/sysconfig/network-scripts/ifcfg-bond0配置⽂件(会自动创建文件)
DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=xxx.xxx.xxx.xxx
NETMASK=xxx.xxx.xxx.xxx
GATEWAY=xxx.xxx.xxx.xxx
USERCTL=no
b)编辑em1,em2/eth0、eth1⽂件
vim /etc/sysconfig/network-scripts/ifcfg-em1
DEVICE=em1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
vim /etc/sysconfig/network-scripts/ifcfg-em2
DEVICE=em2
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
c)配置vim /etc/modprobe.d/bonding.conf (CentOS 6.4)
vim /etc/modprobe.conf (CentOS 5.9)
添加:
alias bond0 bonding
options bond0 miimon=100 mode=0
d)重启网络即可
service network restart
echo "alias bond0 bonding" >> /etc/modprobe.d/dist.confecho "options bond0 mode=1 miimon=100 " >> /etc/modprobe.d/dist.conf cd /etc/sysconfig/network-scriptsvi ifcfg-bond0 #内容如下:DEVICE=bond0BOOTPROTO=none ONBOOT=yesNETWORK=x.x.x.0 #网络NETMASK=255.255.255.0IPADDR=x.x.x.x #IP地址USERCTL=novi ifcfg-eth0 #网卡1,内容如下:DEVICE=eth0BOOTPROTO=none ONBOOT=yesTYPE=Ethernet MASTER=bond0 SLAVE=yesUSERCTL=novi ifcfg-eth1 #网卡2,内容如下:DEVICE=eth1BOOTPROTO=none ONBOOT=yes TYPE=Ethernet MASTER=bond0 SLAVE=yesUSERCTL=novi /etc/sysconfig/network #内容如下:NETWORKING=yesHOSTNAME=MYHOSTNAME #主机名IPV6INIT=noGATEWAY=xxx.xxx.xxx.xxx #缺省网关IPservice network restart 或 reboot
建议用第一种方法 第一种才能更好的区分到不同的业务~ bond0 走什么数据 bond1 走什么数据这样
评论暂时关闭