freebsd 9.0 多个ADSL并行配置

本文介绍了一种通过正确安装FreeBSD系统,并配置虚拟多个网卡,利用四个ADSL线路实现高速网络接入的方法,同时保持成本低廉。详细步骤包括安装环境、配置系统参数及网络规则,确保网络稳定高效。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

      大部分企业会选择直接拉专线,但专线的费用比较高,如果仅仅是为了上网没有其它更多的业务,其实多个ADSL并行不仅上网速度一点不慢,而且费用确实节省了不少。

具体配置如下:

1、正确安装freebsd,我使用的环境是vmware sphere 5.1,需要虚拟多个网卡,我现在的网络连接的是4个ADSL,共虚拟了5个网卡,如果是一台主机那么就要买4块网卡了,就要看你的主机支不支持那么多插槽了。

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的拨号连接。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值