2007-05-18

FreeBSD上双网卡绑定提高带宽的做法

来源: 本站收集整理 作者:佚名 评论 0 条
  环境:服务器一台(双Intel 100M网卡),Cisco4006交换机

1、在Cisco4006二层设置portchannel:

set port channel 2/12-13 189 //189为随便设置的一个数字,代表一个admin_group
set port channel 2/12-13 mode on

2、在FreeBSD4上用ng_one2many实现双网卡绑定

编写脚本/etc/one2many.sh:
#!/bin/sh
# Configure NICs as up and load kernel module
/sbin/ifconfig fxp0 up
/sbin/ifconfig fxp1 up
/sbin/kldload /modules/ng_ether.ko
/usr/sbin/ngctl mkpeer fxp0: one2many upper one
/usr/sbin/ngctl connect fxp0: fxp0:upper lower many0
/usr/sbin/ngctl connect fxp1: fxp0:upper lower many1
# Allow fxp1 to xmit/recv fxp0 frames
/usr/sbin/ngctl msg fxp1: setpromisc 1
/usr/sbin/ngctl msg fxp1: setautosrc 0
# Configure all links as up
/usr/sbin/ngctl msg fxp0:upper setconfig "{ xmitAlg=1 failAlg=1 enabledLinks=[ 1 1 ] }"
# Bring up interface
/sbin/ifconfig fxp0 inet 192.168.1.10 netmask 255.255.255.0
/sbin/route add default 192.168.1.1

编辑/etc/rc.conf,注释掉ifconfig_fxp0和defaultroute两行:
#defaultrouter="192.168.1.1"
#ifconfig_fxp0="inet 192.168.1.10 netmask 255.255.255.0"

编辑/etc/rc.local,将one2many.sh加入:
/etc/one2many.sh

重启。

3、在FreeBSD5上用ng_fec实现双网卡绑定

编写脚本/etc/fec.sh:
#load kernel module
/sbin/kldload ng_fec
/usr/sbin/ngctl mkpeer fec dummy fec
/usr/sbin/ngctl msg fec0: add_iface '"fxp0"'
/usr/sbin/ngctl msg fec0: add_iface '"fxp1"'
#Forwarding decisions will be made on destination IP addresses
/usr/sbin/ngctl msg fec0: set_mode_inet
/sbin/ifconfig fec0 promisc
/sbin/ifconfig fxp0 promisc
/sbin/ifconfig fxp1 promisc
# Bring up interface
/sbin/ifconfig fec0 inet 192.168.1.10 netmask 255.255.255.0
/sbin/route add default 192.168.1.1

编辑/etc/rc.conf,注释掉ifconfig_fxp0和defaultroute两行:
#defaultrouter="192.168.1.1"
#ifconfig_fxp0="inet 192.168.1.10 netmask 255.255.255.0"

编辑/etc/rc.local,将/etc/fec.sh加入:
/etc/fec.sh

重启。

以上在FreeBSD4.11和FreeBSD5.3上测试通过。

(本文仅表明作者个人观点,不代表本站及其管理员立场.) 推荐 收藏 投稿 打印 返回 关闭
上一篇:基于IP,基于port和基于域名的三种虚拟主机的配置方法  
下一篇:菜鸟入门:FreeBSD 新软件安装
    评论加载中…
 推荐文章
     

网站首页  -  网站地图 -   站长论坛  -  网站投稿  -    -  网站管理
Copyright © 2008 芜湖站长站 All Rights Reserved 皖ICP备07500611号