FreeBSDに係わる構築や維持など

FreeBSD

tracerouteにASNの表示オプション

これでntraceroute(ports collection)やprtraceroute(IRRToolSet)を使わなくてもすむようになるかも。

%uname -a
FreeBSD bsd.local 7.1-RELEASE-p1 FreeBSD 7.1-RELEASE-p1 #0: Thu Jan  8 14:03:38 JST 2009                             tiesto@bsd.local:/usr/obj/usr/src/sys/GENERIC  i386

%traceroute -h
Version 1.4a12+FreeBSD
Usage: traceroute [-adDeFInrSvx] [-f first_ttl] [-g gateway] [-i iface]
        [-m max_ttl] [-p port] [-P proto] [-q nqueries] [-s src_addr]
        [-t tos] [-w waittime] [-A as_server] [-z pausemsecs] host [packetlen]

%traceroute -a ftp2.ru.FreeBSD.org
traceroute to mirror.macomnet.net (195.128.64.25), 64 hops max, 40 byte packets
 1  [AS64520]  (192.168.11.1)  0.358 ms  0.260 ms  0.213 ms
 2  [AS4713] 122.28.23.99 (122.28.23.99)  4.339 ms  4.677 ms  3.476 ms
 3  [AS4713] 122.28.23.97 (122.28.23.97)  4.106 ms  4.650 ms  5.352 ms
 4  [AS4713] 122.1.164.201 (122.1.164.201)  7.972 ms  6.499 ms  6.724 ms
 5  [AS4713] 60.37.55.165 (60.37.55.165)  4.349 ms  4.928 ms  5.103 ms
 6  [AS4713] 60.37.54.213 (60.37.54.213)  4.977 ms  4.409 ms  5.112 ms
 7  [AS4713] 122.1.245.9 (122.1.245.9)  11.585 ms  5.300 ms  8.099 ms
 8  [AS4713] 122.1.245.18 (122.1.245.18)  10.599 ms  10.307 ms  10.345 ms
 9  [AS4713] 125.170.96.54 (125.170.96.54)  12.224 ms  12.675 ms  11.848 ms
10  [AS4713] 210.163.253.38 (210.163.253.38)  13.099 ms  12.799 ms  12.850 ms
11  [AS4713] 60.37.18.38 (60.37.18.38)  12.967 ms  12.800 ms  12.595 ms
12  [AS2914] ae-0-1.a20.osakjp01.jp.ra.gin.ntt.net (61.200.82.145)  13.086 ms  13.352 ms  13.098 ms
13  [AS2914] xe-9-3.a14.tokyjp01.jp.ra.gin.ntt.net (61.213.162.201)  11.971 ms  13.428 ms
    [AS2914] xe-7-0-0.a20.tokyjp01.jp.ra.gin.ntt.net (61.213.169.137)  15.470 ms
14  [AS2914] as-2.r22.londen03.uk.bb.gin.ntt.net (129.250.17.66)  263.942 ms  264.270 ms
    [AS2914] xe-4-0-0.a21.tokyjp01.jp.ra.gin.ntt.net (61.120.145.189)  12.594 ms
15  [AS2914] as-1.r22.amstnl02.nl.bb.gin.ntt.net (129.250.17.62)  301.617 ms  241.208 ms  241.713 ms
16  * * [AS2914] ae-1.r23.amstnl02.nl.bb.gin.ntt.net (129.250.4.222)  239.981 ms
17  [AS702] so-1-0-0.XR2.FFT1.ALTER.NET (146.188.15.198)  243.477 ms * *
18  * * *
19  [AS702] so-0-0-0.XR1.FFT1.ALTER.NET (146.188.15.186)  240.801 ms  243.010 ms  245.894 ms
20  [AS702] pos0-0.GW9.FFT4.ALTER.NET (149.227.48.26)  239.831 ms
    [AS8470] mirror.macomnet.net (195.128.64.25)  283.939 ms  286.889 ms

%geoiplookup ftp2.ru.FreeBSD.org
GeoIP Country Edition: RU, Russian Federation

MFC r176428:

	Add AS lookup functionality. On each hop we query a whois server to
	find the corresponding AS for that IP (-a switch).
	We can also choose a different whois server with the -A switch. The
	default is whois.radb.net.

	Obtained from:	       NetBSD

freebsd-updateによるセキュリティアップデート

freebsd# uname -rsm
FreeBSD 7.0-RELEASE i386

freebsd# freebsd-update fetch
Looking up update.FreeBSD.org mirrors... 1 mirrors found.
Fetching metadata signature for 7.0-RELEASE from update1.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 2 metadata files... done.
Inspecting system... done.
Preparing to download files... done.
Fetching 3 patches.. done.
Applying patches... done.

The following files will be updated as part of updating to 7.0-RELEASE-p2:
/boot/kernel/kernel
/boot/kernel/kernel.symbols
/usr/include/netinet/tcp.h

freebsd# freebsd-update install
Installing updates... done.

freebsd# reboot

freebsd# uname -rsm
FreeBSD 7.0-RELEASE-p2 i386

なんですか、この楽チンさは…

freebsd-updateによるメジャーアップグレード

bsd# uname -a
FreeBSD bsd.local 6.3-RELEASE-p2 FreeBSD 6.3-RELEASE-p2 #1: Wed Jun 11 14:33:16 JST 2008     tiesto@bsd.local:/usr/obj/usr/src/sys/GENERIC  i386

差分の入手

bsd# freebsd-update -r 7.0-RELEASE upgrade
Looking up update.FreeBSD.org mirrors... 1 mirrors found.
Fetching public key from update1.FreeBSD.org... done.
Fetching metadata signature for 6.3-RELEASE from update1.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.

The following components of FreeBSD seem to be installed:
kernel/generic world/base world/dict world/games world/info
world/manpages world/proflibs

The following components of FreeBSD do not seem to be installed:
kernel/smp src/base src/bin src/contrib src/crypto src/etc src/games
src/gnu src/include src/krb5 src/lib src/libexec src/release src/rescue
src/sbin src/secure src/share src/sys src/tools src/ubin src/usbin
world/catpages world/doc

Does this look reasonable (y/n)? y

Fetching metadata signature for 7.0-RELEASE from update1.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system... done.
Fetching files from 6.3-RELEASE for merging... done.
Preparing to download files... done.
Fetching 3952 patches.....10....20....30....40....50....60....70....80....90....100....110
..3940....3950. done.
Applying patches... done.
Fetching 3113 files... done.
Attempting to automatically merge changes in files... done.

The following file could not be merged automatically: /etc/inetd.conf
Press Enter to edit this file in vi and resolve the conflicts
manually...

カーネルの入れ替え

bsd# freebsd-update -r 7.0-RELEASE install
Installing updates...
Kernel updates have been installed.  Please reboot and run
"/usr/sbin/freebsd-update install" again to finish installing updates.

ここでreboot

ユーザランドのインストール

# freebsd-update install
Completing this upgrade requires removing old shared object files.
Please rebuild all installed 3rd party software (e.g., programs
installed from the ports tree) and then run "/usr/sbin/freebsd-update install"
again to finish installing updates.
# portupgrade -arRy
bsd# uname -a
FreeBSD bsd.local 7.0-RELEASE-p2 FreeBSD 7.0-RELEASE-p2 #0: Wed Jun 18 07:33:20 UTC 2008     root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386

FreeBSD 6.3-RELEASEへマイナーアップグレード

# uname -rsm
FreeBSD 6.2-RELEASE-p11 i386

# vi /etc/stable-supfile
*default release=cvs tag=RELENG_6_3

# /usr/local/bin/cvsup -g -L 2 /etc/stable-supfile &
# cd /usr/obj
# chflags -R noschg *
# rm -rf *

# cd /usr/src
# make -j4 buildworld
# make -j4 buildkernel
# make -j4 installkernel
# reboot

シングルユーザーで起動

# mount -u /
# mount -a -t ufs
# swapon -a
# adjkerntz -i
# cp -Rpi /etc /etc.orig

# mergemaster -p
# cd /usr/src
# make installworld
# mergemaster
# reboot

# uname -rsm FreeBSD 6.3-RELEASE-p2

FreeBSD 6.2にしてみました

 FreeBSD 6.1-RELEASE-p11からFreeBSD 6.2-RELEASEにアップグレードしました。

make.confの設定

# cat /var/run/dmesg.boot
CPU: Intel(R) Pentium(R) 4 CPU 2.40GHz (2391.14-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0xf27  Stepping = 7
  Features=0xbfebfbff
  Features2=0x400
real memory  = 535236608 (510 MB)
avail memory = 514408448 (490 MB)

次のページを参考しCPUTYPEを設定します。
http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/i386-and-x86_002d64-Options.html
# cat /etc/make.conf
CPUTYPE=pentium4
# added by use.perl 2006-11-08 01:48:21
PERL_VER=5.8.8
PERL_VERSION=5.8.8

Read more »