|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
QUOTE
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MiniFW0.3发布
作者:FlyDragon(PKkingSon)
mail: cnfreeos@163.com
web : Http://www.cnfreeos.org
OICQ: 42560779
TEL : 13904270742
你可以自由修改并使用本系统,但不可以作为商业目的而二次发布本系统的
任何部分,如未特别说明,本系统内所有程序版权均为软件的发布组织所有
如系统大大部分程序为FREEBSD工作组拥有版权等。
欢迎大家共同交流各种BSD平台下的服务器/网络/系统/安全技术。
===========================================================================
架构你自己的防火墙系统,本系统构建在32M电子盘上属于标准的BSD系统,使用和BSD基本一样的结构和引导程序,引导脚本,
并包含基本的网络管理组件,及其他标准管理程序,包含一个TCPDUMP协议分析工具和一个基本的编辑器VI,IPV4协议和应用
支持,PKG方式程序安装支持。
初始化电子硬盘
FlyDragon# dd if=/dev/zero of=/dev/rad2 bs=1k count=1
1+0 records in
1+0 records out
1024 bytes transferred in 0.001160 secs (882830 bytes/sec)
[说明]
bs=n Set both input and output block size to n bytes, superseding the
ibs and obs operands. If no conversion values other than
noerror, notrunc or sync are specified, then each input block is
copied to the output as a single block without any aggregation
of short blocks.
count=n Copy only n input blocks.
建立BSD分区
FlyDragon# fdisk -BI ad2
******* Working on device /dev/ad2 *******
fdisk: invalid fdisk partition table found
[说明]
-I Initialize the contents of sector 0 for one FreeBSD slice cover-
ing the entire disk.
-B Reinitialize the boot code contained in sector 0 of the disk.
Ignored if -f is given.
建立BSD文件系统
FlyDragon# disklabel -B -w -r ad2s1 auto
[说明]
disk represents the raw disk in question, and may be in the form da0 or
/dev/da0c. It will display all of the parameters associated with the
drive and its partition layout. Unless the -r flag is given, the ker-
nel's in-core copy of the label is displayed; if the disk has no label,
or the partition types on the disk are incorrect, the kernel may have
constructed or modified the label. If the -r flag is given, disklabel
reads the label from the raw disk and displays it. Both versions are
usually identical except in the case where a label has not yet been ini-
tialized or is corrupt.
建立逻辑分区
FlyDragon# disklabel -e ad2s1
在下面建立一个分区a(表示bsd根分区)
size和 分区c的一样大
offset为0
fstype为4.2BSD
ffsize为2048
bsize为16384
bps/cpg为90
然后存盘退出。
编辑器最终显示如下:
# /dev/ad2s1c:
type: unknown
disk: amnesiac
label:
flags:
bytes/sector: 512
sectors/track: 32
tracks/cylinder: 4
sectors/cylinder: 128
cylinders: 497
sectors/unit: 63712
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # milliseconds
track-to-track seek: 0 # milliseconds
drivedata: 0
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
c: 63712 0 unused 0 0 # (Cyl. 0 - 497*)
a: 63712 0 4.2BSD 2048 16384 90 # (Cyl. 0 - 497*)
建立freebsd的ffs文件系统
FlyDragon# newfs ad2s1 auto
Warning: Block size restricts cylinders per group to 104.
Warning: 1824 sector(s) in last cylinder unallocated
/dev/ad2s1: 63712 sectors in 16 cylinders of 1 tracks, 4096 sectors
31.1MB in 1 cyl groups (104 c/g, 208.00MB/g, 4096 i/g)
super-block backups (for fsck -b #) at:
32
到现在为止,我们的电子盘已经支持引导了,只是由于没有/boot/loader及init等程序,无法继
续装载操作系统。我们现在要做的就是把标准的BSD系统结构复制过去。
把电子盘挂载到/mnt
FlyDragon# mount /dev/ad2s1 /mnt
建立基本目录:
FlyDragon# cd /mnt
FlyDragon# mkdir -p {bin,dev,home,modules,sbin,usr/bin,usr/sbin,usr/lib/aout,usr/lib/compat/aout,
usr/libexec,usr/local/bin,usr/local/etc/rc.d,usr/local/include,usr/local/info,usr/local/lib,
usr/local/libdata,usr/local/libexec,usr/local/man,usr/local/sbin,usr/local/share,usr/share/misc,
boot/defaults,etc/defaults,etc/mtree,etc/namedb,etc/ppp,etc/ssh,etc/ssl,root,tmp,var/at/jobs,
var/cron/tabs,var/db/pkg,var/empty,var/log,var/run,var/spool/lock,var/tmp/vi.recover}
往电子盘上复制文件
FlyDragon# cp -p /bin/{cat,cp,dd,echo,gnuls,ln,mv,rm,sleep,chio,csh,df,ed,hostname,ls,ps,rmdir,stty,
chmod,date,domainname,expr,kill,mkdir,pwd,sh,sync} bin
FlyDragon# cp -rfp /boot/* boot
FlyDragon# cp -rfp /etc/{auth.conf,crontab,csh.cshrc,csh.login,csh.logout,disktab,fbtab,fstab,ftpusers,
gettytab,group,host.conf,hosts,hosts.allow,hosts.equiv,inetd.conf,login.access,login.conf,login.conf.db,master.
passwd,motd,netstart,networks,newsyslog.conf,objformat,opiekeys,pam.conf,passwd,profile,protocols,pwd.db,rc,
rc.conf,rc.firewall,rc.network,rc.serial,rc.shutdown,rc.syscons,remote,resolv.conf,rpc,services,shells,skeykeys,
spwd.db,sysctl.conf,syslog.conf,ttys} etc
FlyDragon# cp -rfp /etc/defaults/ etc/defaults/
FlyDragon# cp -rfp /etc/mtree/ etc/mtree/
FlyDragon# cp -rfp /etc/namedb/ etc/namedb/
FlyDragon# cp -rfp /etc/ppp/ etc/ppp/
FlyDragon# cp -rfp /etc/ssh etc/ssh/
FlyDragon# cp -rfp /etc/ssl/ etc/ssl/
FlyDragon# cp -p /sbin/{adjkerntz,dhclient,dhclient-script,disklabel,dmesg,fsck,halt,ifconfig,init,ipf,
ipfs,ipfstat,ipfw,ipmon,ipnat,kldconfig,kldload,kldstat,kldunload,ldconfig,md5,mknod,mount,mount_mfs,
mount_null,mount_procfs,mount_union,natd,newfs,nologin,ping,reboot,restore,route,routed,savecore,
shutdown,sysctl,umount} sbin
FlyDragon# cp -p /usr/bin/{at,atq,atrm,awk,bg,cap_mkdb,cd,chflags,chgrp,chsh,clear,cmp,cu,diff,dig,du,ee,
env,ex,fetch,fg,find,fstat,ftp,grep,gunzip,gzip,head,id,jobs,join,killall,last,less,login,mail,mktemp,more,
netstat,nohup,objcopy,objdump,objformat,passwd,printenv,sed,sort,split,ssh,ssh-keygen,su,tail,tar,telnet,top,
touch,tput,tty,umask,uname,uptime,vi,vmstat,w,wait,wall,wc,who,whoami,whois} usr/bin
FlyDragon# cp -p /usr/sbin/{arp,chown,chroot,cron,daemon,dev_mkdb,inetd,iostat,makemap,mtree,named,
named.reload,named.restart,ndc,newsyslog,ntpdate,pkg_add,pkg_delete,pkg_info,ppp,pppctl,pppd,pppstats,
pw,pwd_mkdb,sshd,syslogd,tcpdump,vidcontrol,vipw,nslookup} usr/sbin
FlyDragon# cp -p /usr/lib/{libssl.so.3,libssh.so.2,libz.so.2,libalias.so.4,libgnuregex.so.2,libncurses.so.5,
librpcsvc.so.2,libc.so.4,libipsec.so.1,libnetgraph.so.1,libskey.so.2,libcrypt.so.2,libipx.so.2,libopie.so.2,
libutil.so.3,libcrypto.so.3,libkvm.so.2,libpam.so.1,libwrap.so.3,libdevstat.so.2,libmd.so.2,libposix1e.so.2,
libfetch.so.3,libmp.so.3,libradius.so.1,pam_cleartext_pass_ok.so,pam_deny.so,pam_opie.so,pam_opieaccess.so,
pam_permit.so,pam_radius.so,pam_skey.so,pam_ssh.so,pam_tacplus.so,pam_unix.so} usr/lib
ln -s libalias.so.4 libalias.so
ln -s libgnuregex.so.2 libgnuregex.so
ln -s libncurses.so.5 libncureses.so
ln -s librpcsvc.so.2 librpcsvc.so
ln -s libc.so.4 libc.so
ln -s libipsec.so.1 libipsec.so
ln -s libnetgraph.so.1 libnetgraph.so
ln -s libskey.so.2 libskey.so
ln -s libcrypt.so.2 libcrypt.so
ln -s libipx.so.2 libipx.so
ln -s libopie.so.2 libopie.so
ln -s libutil.so.3 libutil.so
ln -s libcrypto.so.3 libcrypto.so
ln -s libkvm.so.2 libkvm.so
ln -s libpam.so.1 libpam.so
ln -s libwrap.so.3 libwrap.so
ln -s libdevstat.so.2 libdevstat.so
ln -s libmd.so.2 libmd.so
ln -s libposix1e.so.2 libposix1e.so
ln -s libfetch.so.3 libfetch.so
ln -s libmp.so.3 libmp.so
ln -s libradius.so.1 libradius.so
ln -s libssh.so.2 libssh.so
ln -s libz.so.2 libz.so
ln -s libssl.so.3 libssl.so
FlyDragon# cp /usr/libexec/{atrun,ftpd,getty,ld-elf.so.1,pppoed,tcpd,telnetd,tftpd} usr/libexec/
FlyDragon# cp -p /usr/share/misc/{termcap,termcap.db} usr/share/misc
FlyDragon# touch var/log/{auth.log,lastlog,maillog,ppp.log,slip.log,wtmp,cron,lpd-errs,messages,security,userlog}
FlyDragon# chmod 600 var/log/{auth.log,cron,security}
FlyDragon# chmod 640 var/log/{maillog,ppp.log,slip.log}
FlyDragon# chmod 1777 tmp
复制设备文件生成脚本
FlyDragon# cp -p /dev/MA* dev
FlyDragon# cd dev
FlyDragon# ./MAKEDEV std
FlyDragon# ./MAKEDEV ad0 ad1 ad2 ad3
FlyDragon# ./MAKEDEV bpf0 bpf1 bpf2 bpf3
FlyDragon# ./MAKEDEV tun0 tun1 tun2 tun3
FlyDragon# ./MAKEDEV ipl ipnat
FlyDragon# ./MAKEDEV vty{0,1,2,3,4,5,6,7,8,9}
FlyDragon# ./MAKEDEV pty0
FlyDragon# rm ttyp[b-z]
FlyDragon# ./MAKEDEV ttyd0 ttyd1
termcap -> /usr/share/misc/termcap |
|