环境:服务器一台(双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上测试通过。 |
|