Linux下双网卡帮定
By:Roy.LiuLast updated:2012-09-06
一、在/etc/modprobe.conf中添加
install bond0 /sbin/modprobe -a eth0 eth1 && /sbin/modprobe bonding
alias bond0 bonding
install bond1 /sbin/modprobe -a eth2 eth3 && /sbin/modprobe bonding
alias bond1 bonding
options bonding miimon=100 mode=1 max_bonds=2
对外网络虚拟接口为bond0、bond1.
相关参数含义,可参考:/usr/share/doc/kernel-doc-2.6.9/Documentation/networking/bonding.txt
二、创建ifcfg-bond0、ifcfg-bond1:
/etc/sysconfig/network-scrpts/ifcfg-bond0:
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.0.41
NETMASK=255.255.255.0
NETWORK=192.168.0.1
BROADCAST=192.168.0.11
USERCTL=no
/etc/sysconfig/network-scrpts/ifcfg-bond1:
DEVICE=bond1
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.0.40
NETMASK=255.255.255.0
NETWORK=192.168.1.1
BROADCAST=192.168.1.11
USERCTL=no
三、分别更改目录/etc/sysconfig/network-scripts/下的ifcfg-eth0、ifcfg-eth1、ifcfg-eth2、ifcfg-eth3。编辑物理
网络接口配置文件,并指向虚拟网络接口bond0、bond1。物理网络接口配置文件位于/etc/sysconfig/network-scripts
/下,ifcfg-eth0对应第一个网口,ifcfg-eth1对应第二个网口
ifcfg-eth0:
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:04:23:C5:3D:A8
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
MASTER=bond0
SLAVE=yes
ifcfg-eth1:
DEVICE=eth1
BOOTPROTO=none
HWADDR=00:04:23:C5:3D:A9
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
MASTER=bond0
SLAVE=yes
ifcfg-eth2:
DEVICE=eth2
BOOTPROTO=none
HWADDR=00:14:22:22:A2:A6
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
MASTER=bond1
SLAVE=yes
ifcfg-eth3:
DEVICE=eth3
BOOTPROTO=none
HWADDR=00:04:23:C5:3D:A7
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
MASTER=bond1
SLAVE=yes
From:一号门
Previous:李宁filenet文档文档管理平台ce安全性考虑之二(流程相关)
Next:程序员语录精华版-值得收藏
COMMENTS