Send a link

network

How to bundle two NICs in FreeBSD

#!/bin/bash

IP_GW="10.0.0.1"
IP_A="10.0.0.10"
IP_B="10.0.0.11"
IP_C="10.0.0.12"
IP_D="10.0.0.13"

ifconfig em0 up
ifconfig em1 up

kldload -v ng_ether.ko

ngctl mkpeer em0: one2many upper one
ngctl connect em0: em0:upper lower many0
ngctl connect em1: em0:upper lower many1

ngctl msg em1: setpromisc 1
ngctl msg em1: setautosrc 0

ngctl msg em0:upper setconfig "{ xmitAlg=1 failAlg=1 enabledLinks=[ 1 1 ] }"

ifconfig em0 $IP_A netmask 255.255.255.0
ifconfig em0 alias $IP_B netmask 255.255.255.255
ifconfig em0 alias $IP_C netmask 255.255.255.255
ifconfig em0 alias $IP_D netmask 255.255.255.255

route add default -net $IP_GW


  • + : A leading plus sign indicates that this word must be present in every object returned.
  • - : A leading minus sign indicates that this word must not be present in any row returned.
  • By default (when neither plus nor minus is specified) the word is optional, but the object that contain it will be rated higher.
  • < > : These two operators are used to change a word's contribution to the relevance value that is assigned to a row.
  • ( ) : Parentheses are used to group words into subexpressions.
  • ~ : A leading tilde acts as a negation operator, causing the word's contribution to the object relevance to be negative. It's useful for marking noise words. An object that contains such a word will be rated lower than others, but will not be excluded altogether, as it would be with the - operator.
  • * : An asterisk is the truncation operator. Unlike the other operators, it should be appended to the word, not prepended.
  • " : The phrase, that is enclosed in double quotes ", matches only objects that contain this phrase literally, as it was typed.

Menu