lscm163 发表于 2009-10-14 10:57:19

FreeBSD是个宝库

这段时间我使用freebsd6.3有很多体会:
1.完全开源,完全可以放心使用。
2.无论是m0n0wall等等都是基于freebsd建立的。
3.pf,ipfw等等工具,功能强大。
4.运行稳定,我做的freebsd pppoed服务器稳定运行半年多,没有任何问题

建议大家看看tinybsd,在安装freebsd6.3的时候选择src->tinybsd就可以,最好把src都安装上。
这期间我也试验使用了nanobsd没有tinybsd直接有效。

其实弄懂了tinybsd,自己diy一个高效稳定的router根本不是问题。

lscm163 发表于 2009-10-14 11:16:34

这是tinybsd的一些基础知识:
http://web.zyline.com.cn/ShowArticle/?Show_5075.html

心想事成 发表于 2009-10-15 16:01:11

支持一下

lscm163 发表于 2009-10-16 16:02:19

我刚刚把我的freebsd pppoe验证服务器+nat+pf改成了tinybsd运行的仅仅有24m的bsd,系统全部在内存中运行,效率非常高。

本来想上传一个做好的,但各人的环境不一样,网卡也各不相同,我做好的是基于一个路由器专用主板的,发给大家没有意义。

有些心得如下:
/etc/mtree/BSD.var.dist应该放在tinybsd.basefiles文件里,否则/var下不会建立临时目录,有些程序会出错。

如果做pppoe验证服务器千万不要忘了在tinybsd.basefiles加入/usr/sbin/ppp,否则客户端会报619错误。关于pppoe验证服务器不好用的情况,可以使用/usr/libexec/pppoed -Fd "网卡设备名" 来跟踪调试。

lscm163 发表于 2009-10-16 16:04:23

核心文件必须加入 options NETGRAPH
options NETGRAPH_ETHER
options NETGRAPH_PPP
options NETGRAPH_PPPOE
options NETGRAPH_SOCKET

lscm163 发表于 2009-10-16 16:05:58

/etc/rc.conf:


# -- sysinstall generated deltas -- # Sat Aug9 13:27:23 2008
# Created: Sat Aug9 13:27:23 2008
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
keymap="no"
update_motd="no"
syslogd_enable="no"
# -- sysinstall generated deltas -- # Sat Aug9 14:30:22 2008
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
ifconfig_fxp0="inet x.x.x.xnetmask 255.255.255.240"
defaultrouter="x.x.x.x"
ifconfig_fxp1="inet 192.168.1.205netmask 255.255.255.0"
ifconfig_fxp2="inet x.x.x.xnetmask 255.255.255.0"
sshd_enable="YES"
pppoed_enable="YES"
pppoed_flags="-d -P /var/run/pppoed.pid -a "server" -l "default" "
pppoed_interface="fxp1"
gateway_enable="YES"
inetd_enable="YES"
pf_enable="YES"
pf_rules="/etc/pf.conf"
pf_flags=""

lscm163 发表于 2009-10-16 16:07:25

/etc/pf.conf:开nat,限速,还可以做一些防火墙脚本
scrub in all

altq on fxp0 cbq bandwidth 2Mb queue{std_out}
queue std_out bandwidth 2Mb cbq(default)
altq on fxp1 cbq bandwidth 2Mb queue{std_in}
queue std_in bandwidth 2Mb cbq(default)

nat on fxp0 from 10.0.1.0/24 to any -> fxp0

pass in all
pass out all

block quick on fxp0 inet proto{tcp,udp} from any to x.x.x.x port 22
block quick on fxp0 inet proto icmp from any to x.x.x.x
pass out on fxp0 proto tcp from any to any queue std_out
pass in on fxp1 proto tcp from any to any queue std_in

lscm163 发表于 2009-10-16 16:08:04

/etc/sysctl.conf:
# $FreeBSD: src/etc/sysctl.conf,v 1.8 2003/03/13 18:43:50 mux Exp $
#
#This file is read when going to multi-user and its contents piped thru
#``sysctl'' to adjust kernel values.``man 5 sysctl.conf'' for details.
#

# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
#security.bsd.see_other_uids=0
net.inet.ip.forwarding=1

lscm163 发表于 2009-10-16 16:08:36

/etc/ppp/ppp.conf:
#################################################################
# PPPSample Configuration File
# Originally written by Toshiharu OHNO
# Simplified 5/14/1999 by wself@cdrom.com
#
# See /usr/share/examples/ppp/ for some examples
#
# $FreeBSD: src/etc/ppp/ppp.conf,v 1.10 2004/11/19 17:12:56 obrien Exp $
#################################################################

default:
set log Phase Chat LCP IPCP CCP tun command
ident user-ppp VERSION (built COMPILATIONDATE)

# Ensure that "device" references the correct serial port
# for your modem. (cuad0 = COM1, cuad1 = COM2)
#
set device pppoe:fxp1
set log Chat Command Phase
enable chat pap passwdauth
allow mode direct
enable proxy
enable MSCHAPv2
disable deflate pred1
deny deflate pred1
disalbe ipv6cp
set mru 1492
set mtu 1492
set ifaddr 10.0.0.1 10.0.1.2-10.0.1.254
set dns 202.98.5.68 202.98.1.11
set speed sync
set timeout 1800
set login
enable lqr
accept dns

set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \
         \"\" AT OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 40 CONNECT"
enable dns                                # request DNS info (for resolv.conf)

papchap:
#
# edit the next three lines and replace the items in caps with
# the values which have been assigned by your ISP.
#

set phone PHONE_NUM
set authname USERNAME
set authkey PASSWORD

set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
add default HISADDR                        # Add a (sticky) default route

lscm163 发表于 2009-10-16 16:09:21

/etc/ppp/ppp.secret:

abcd    1234

lscm163 发表于 2009-10-16 16:14:39

关键的地方就这么多
/usr/src/tools/tools/tinybsd
然后就可以做了,这我就不多说了,自己看吧。
呵呵,做完后启动路由器登陆。
$mount -u -o rw /
设置密码,还可以改/boot/defaults/load.conf等等,根据个人发挥了。
然后
$mount -u -o ro /
$reboot

就完成了。

其实freebsd的东西做的好了,呵呵,比m0n0wall等等都灵活,你想怎么做就怎么做。关键前提是看懂。

lscm163 发表于 2009-10-16 16:20:32

另外freebsd还有个功能我还没有研究的,但我确认有这个功能:
它可以支持802.1q vlan 这是一些高档路由器才可以有的功能(当然需要交换机的支持),
可以识别802.1q tagged数据包,实现不同vlan之间的3层交换,这个功能也非常不错。

kushuye 发表于 2009-10-26 16:10:23

这段时间我使用freebsd6.3有很多体会:
1.完全开源,完全可以放心使用。
2.无论是m0n0wall等等都是基于fr ...
lscm163 发表于 2009-10-14 10:57 http://bbs.routerclub.com/images/common/back.gif

刚刚把这个看完。累。

wgl21 发表于 2010-3-31 00:54:49

sendmail_enable="NONE"

...........
页: [1]
查看完整版本: FreeBSD是个宝库