# vi /etc/rc.conf
================+==============+=================
defaultrouter="221.33.88.254"
ifconfig_fxp0="inet 192.168.0.1 netmask 255.255.255.0"
ifconfig_rl0="inet 221.33.88.2 netmask 255.255.255.0"
ifconfig_rl1="inet 202.0.57.1 netmask 255.255.255.0"
pf_enable="yes"
================+==============+=================
# vi /etc/pf.conf
================+==============+=================
##anchors
lan_net = "192.168.0.0/24"
int_if = "fxp0"
ext_if1 = "rl0"
ext_if2 = "rl1"
ext_gw1 = "221.33.88.254"
ext_gw2 = "61.0.57.254"
##nat outgoing connections on each internet interface
nat on $ext_if1 from $lan_net to any -> ($ext_if1)
nat on $ext_if2 from $lan_net to any -> ($ext_if2)
##default deny
block in from any to any
block out from any to any
##pass all outgoing packets on internal interface
pass out on $int_if from any to $lan_net
##pass in quick any packets destined for the gateway itself
pass in quick on $int_if from $lan_net to $int_if
##load balance outgoing tcp traffic from internal network.
pass in on $int_if route-to \
{ ($ext_if1 $ext_gw1), ($ext_if2 $ext_gw2) } round-robin \
proto tcp from $lan_net to any flags s/sa modulate state
##load balance outgoing udp and icmp traffic from internal network
pass in on $int_if route-to \
{ ($ext_if1 $ext_gw1), ($ext_if2 $ext_gw2) } round-robin \
proto { udp, icmp } from $lan_net to any keep state
##general "pass out" rules for external interfaces
pass out on $ext_if1 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 tcp from any to any flags s/sa modulate state
pass out on $ext_if2 proto { udp, icmp } from any to any keep state
##route packets from any ips on $ext_if1 to $ext_gw1 and the same for
##$ext_if2 and $ext_gw2
pass out on $ext_if1 route-to ($ext_if2 $ext_gw2) from $ext_if2 to any
pass out on $ext_if2 route-to ($ext_if1 $ext_gw1) from $ext_if1 to any
================+==============+=================
# vi /etc/sysctl.conf
net.inet.ip.forwarding=1
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
FreeBSD 远程存取
0. 前言
若以服务器管理而言,我们不能够老是待在主机旁边,必须要有远程访问系统 (telnet 、 ftp) 的需要。 但因为这两个协议并不很安全,所以...
[阅读全文]
-
-
FREEBSD手工配置网络
在FreeBSD系统中,网络能力十分重要,对于一个标准的FreeBSD系统,至少要有一个网络界面以便与其他计算机通信。最常见的网络界面为以太网卡。此外FreeB...
[阅读全文]
-
-
-
删除 FreeBSD 账号
0. 前言 新增了使用者之后,就必须要了解如何删除使用者。
1. 删除账号 请以 root 的身分,执行这个 rmuser 这个命令。
系统询...
[阅读全文]
-
新增 FreeBSD 账号
0. 前言
因为 root 这个账号为系统管理者,所以请尽量养成好习惯。 如非必要请采用其它账号进行工作。 再加上,通常我们都是采用远程登入系统,所以要有...
[阅读全文]
-
-
网友评论