|
大部分企业会选择直接拉专线,但专线的费用比较高,如果仅仅是为了上网没有其它更多的业务,其实多个ADSL并行不仅上网速度一点不慢,而且费用确实节省了不少。
具体配置如下:
1、正确安装freebsd,我使用的环境是vmware sphere 5.1,需要虚拟多个网卡,我现在的网络连接的是4个ADSL,共虚拟了5个网卡,如果是一台主机那么就要一个网卡配置5个IP了。
2、freebsd 9.0 默认安装是已经有pf了,关于双线的安装网上已经很多了。
3、配置/etc/rc.conf如下:
hostname="gateway.test.com"
defaultrouter="192.168.1.1"
ifconfig_em0="inet 172.20.1.254 netmask 255.255.255.0"
ifconfig_em1="inet 192.168.1.20 netmask 255.255.255.0"
ifconfig_em2="inet 192.168.2.20 netmask 255.255.255.0"
ifconfig_em3="inet 192.168.3.20 netmask 255.255.255.0"
ifconfig_em4="inet 192.168.4.20 netmask 255.255.255.0"
sshd_enable="YES"
pf_enable="YES"
pf_rules="/etc/pf.conf"
pflog_enable="YES"
pflog_logfile="/var/log/pflog"
4、配置/etc/pf.conf如下:
ext_if1="em1"
ext_if2="em2"
ext_if3="em3"
ext_if4="em4"
int_if="em0"
ext_gw1="192.168.1.1"
ext_gw2="192.168.2.1"
ext_gw3="192.168.3.1"
ext_gw4="192.168.4.1"
routerip="172.20.1.254"
internal_net="172.20.1.0/24"
loop="lo0"
nat on $ext_if1 from $internal_net to any -> ($ext_if1)
nat on $ext_if2 from $internal_net to any -> ($ext_if2)
nat on $ext_if3 from $internal_net to any -> ($ext_if3)
nat on $ext_if4 from $internal_net to any -> ($ext_if4)
block in from any to any
block out from any to any
pass out on $int_if from any to $internal_net
pass in quick on $int_if from $internal_net to $int_if
pass in on $int_if route-to \
{ ($ext_if1 $ext_gw1), ($ext_if2 $ext_gw2), ($ext_if3 $ext_gw3), ($ext_if4 $ext_
gw4) } round-robin \
proto tcp from $internal_net to any flags S/SA modulate state
pass in on $int_if route-to \
{ ($ext_if1 $ext_gw1), ($ext_if2 $ext_gw2), ($ext_if3 $ext_gw3), ($ext_if4 $ext_
gw4) } round-robin \
proto { udp, icmp } from $internal_net to any keep state
pass out on $ext_if1 proto tcp from any to any flags S/SA modulate state
pass out on $ext_if2 proto tcp from any to any flags S/SA modulate state
pass out on $ext_if3 proto tcp from any to any flags S/SA modulate state
pass out on $ext_if4 proto tcp from any to any flags S/SA modulate state
pass out on $ext_if1 proto { udp, icmp } from any to any keep state
pass out on $ext_if2 proto { udp, icmp } from any to any keep state
pass out on $ext_if3 proto { udp, icmp } from any to any keep state
pass out on $ext_if4 proto { udp, icmp } from any to any keep state
pass out on $ext_if1 route-to ($ext_if2 $ext_gw2) from $ext_if2 to any
pass out on $ext_if1 route-to ($ext_if3 $ext_gw3) from $ext_if3 to any
pass out on $ext_if1 route-to ($ext_if4 $ext_gw4) from $ext_if4 to any
pass out on $ext_if2 route-to ($ext_if1 $ext_gw1) from $ext_if1 to any
pass out on $ext_if2 route-to ($ext_if3 $ext_gw3) from $ext_if3 to any
pass out on $ext_if2 route-to ($ext_if4 $ext_gw4) from $ext_if4 to any
pass out on $ext_if3 route-to ($ext_if1 $ext_gw1) from $ext_if1 to any
pass out on $ext_if3 route-to ($ext_if2 $ext_gw2) from $ext_if2 to any
pass out on $ext_if3 route-to ($ext_if4 $ext_gw4) from $ext_if4 to any
pass out on $ext_if4 route-to ($ext_if1 $ext_gw1) from $ext_if1 to any
pass out on $ext_if4 route-to ($ext_if2 $ext_gw2) from $ext_if2 to any
pass out on $ext_if4 route-to ($ext_if3 $ext_gw3) from $ext_if3 to any
5、em0为内网,em1\em2\em3\em4分别接4个ADSL,4个ADSL均使用电信那种自动拨号的,本配置不支持PPOE的拨号连接。
以上配置已经成功运行半年没有故障,但对于个别网银或者https的网站访问可能会出现频繁的重新登陆现象,4个ADSL下载速度基本在3.2M左右,几乎达到了5M光纤的速度,但费用还不到5M光纤的一半。
|
|