ftp://ftp.iij.ad.jp/pub/NetBSD/iso/3.1/i386pkg-3.1.iso のCDイメージからインストール
ftp://ftp.iij.ad.jp/pub/NetBSD/NetBSD-3.1/source/sets/syssrc.tgz を/に展開
cd /usr/src/sys/arch/i386/conf cp GENERIC confname vi confname confの編集:↓の変更 options RTC_OFFSET=-540 # hardware clock is this many mins. west of GMT config confname cd ../compile/confname make depend make mv /netbsd /netbsd.old mv netbsd /. cd /etc rm localtime ln -s /usr/share/zoneinfo/Japan localtime
ftp://ftp.iij.ad.jp/pub/NetBSD/packages/pkgsrc-current.tar.gz を/usr/に展開
/etc/mk.conf
ACCEPTABLE_LICENSES+=fee-based-commercial-use PKG_OPTIONS.postfix=sasl bdb tls pcre
cd /usr/pkgsrc/shells/tcsh ; make ; make install cd /usr/pkgsrc/inputmethod/ja-freewnn-server ; make ; make install cd /usr/pkgsrc/www/apache2/ ; make ; make install cd /usr/pkgsrc/misc/ja-less ; make ; make install cd /usr/pkgsrc/misc/ja-man ; make ; make install cd /usr/pkgsrc/misc/screen ; make ; make install cd /usr/pkgsrc/lang/perl5 ; make ; make install cd /usr/pkgsrc/lang/php5 ; make ; make install cd /usr/pkgsrc/archivers/lha ; make ; make install cd /usr/pkgsrc/archivers/zip ; make ; make install cd /usr/pkgsrc/archivers/unzip ; make ; make install cd /usr/pkgsrc/converters/ish ; make ; make install cd /usr/pkgsrc/converters/p5-nkf ; make ; make install cd /usr/pkgsrc/net/ja-samba ; make ; make install cd /usr/pkgsrc/net/mirror ; make ; make install cd /usr/pkgsrc/net/rsync ; make ; make install cd /usr/pkgsrc/net/wget ; make ; make install cd /usr/pkgsrc/graphics/netpbm ; make ; make install cd /usr/pkgsrc/www/ap-php ; make ; make install cd /usr/pkgsrc/misc/php-mbstring ; make ; make install cd /usr/pkgsrc/www/php-curl ; make ; make install cd /usr/pkgsrc/mail/fetchmail ; make ; make install cd /usr/pkgsrc/mail/procmail ; make ; make install cd /usr/pkgsrc/mail/imap-uw ; make ; make install cd /usr/pkgsrc/www/lynx ; make ; make install
cd /usr/pkgsrc/devel/apel ; make ; make install cd /usr/pkgsrc/devel/flim ; make ; make install cd /usr/pkgsrc/devel/semi ; make ; make install
defkanji jis escape ^z^z bind '-' prev bind '^g' bind '?' help bind '^a' other bind 'a' other bind 'Z' suspend bind 'z' suspend bind 'G' vbell bind 'R' reset
/usr/pkg/etc/httpd/httpd.conf
LoadModule php5_module lib/php/mod_php5.so AddType application/x-httpd-php .php
/usr/pkg/etc/php.ini
extension=mbstring.so extension=curl.so
動作チェック
/usr/pkg/share/httpd/httpdocs/phptest.php
<?php phpinfo();?>
/etc/inetd.conf
netbios-ssn stream tcp nowait root /usr/pkg/sbin/smbd smbd netbios-ns dgram udp wait root /usr/pkg/sbin/nmbd nmbd
/etc/c-client.cf
I accept the risk for IMAP toolkit 4.1. set mail-subdirectory imap-uw set new-folder-format mbx
/etc/inetd.conf
imap4 stream tcp nowait root /usr/pkg/libexec/imapd imapd imaps stream tcp nowait root /usr/pkg/libexec/imapd imapd pop2 stream tcp nowait root /usr/pkg/libexec/ipop2d ipop2d pop3 stream tcp nowait root /usr/pkg/libexec/ipop3d ipop3d pop3s stream tcp nowait root /usr/pkg/libexec/ipop3d ipop3d
/etc/hosts.deny
ALL: ALL
/etc/hosts.allow
ALL: .localnet telnetd: ftpd: ALL httpd: ALL sshd: ALL sendmail: ALL postfix: ALL imapd: ALL
PPPoEがサポートされてるか確認
chitose# ifconfig -C bridge vlan gif gre tun tap strip sl pppoe ppp lo
pppoeが無い場合カーネルコンフィグに以下を追加して作り直す
pseudo-device pppoe # PPP over Ethernet (RFC 2516)
接続テスト
chitose# ifconfig pppoe0 create
chitose# ifconfig pppoe0 inet 0.0.0.0 0.0.0.1 down
chitose# ifconfig ex0 up
chitose# pppoectl -e ex0 pppoe0 <-- ex0はADSLモデムの継ってるNIC
chitose# pppoectl pppoe0 myauthproto=認証方式(pap or chap) 'myauthname=接続ID' 'mysuthsecret=接続パスワード' hisauthproto=none
chitose# ifconfig pppoe0 up
chitose# pppoectl -d pppoe0
pppoe0: state = session
Session ID: 0x1234
PADI retries: 0
PADR retries: 0
chitose#
state = sessionならセッション確立。
接続出来ていれば以下のようにIPの確認が出来る。
chitose# ifconfig pppoe0
pppoe0: flags=8851 mtu 1492
inet 218.228.157.12 -> 218.228.156.1 netmask 0xffffff00
chitose#
以下起動時に自動接続する設定
/etc/ifconfig.pppoe0
create ! /sbin/ifconfig ex0 up ! /sbin/pppoectl -e ex0 pppoe0 ! /sbin/pppoectl pppoe0 myauthproto=chap myauthname=USERNAME myauthsecret=PASSWORD hisauthproto=none ! /sbin/pppoectl pppoe0 max-auth-failure=0 inet 0.0.0.0 0.0.0.1 up
/etc/ppp/ip-up:
#!/bin/sh /sbin/route add default $5
/etc/ppp/ip-down:
#!/bin/sh /sbin/route delete default
上の2つのファイルを作成し、/etc/rc.confに
ifwatchd=YES ifwatchd_flags="-u /etc/ppp/ip-up -d /etc/ppp/ip-down pppoe0"
経路上にICMPをすべて落す防火壁がある場合MTU Path discovery blackhole問題が発生する。
この場合MTUとMSSを調整することで解決出来る。
以下設定方法
sysctl変数net.inet.tcp.mss_ifmtuを1に設定。
sysctl -w net.inet.tcp.mss_ifmtu=1
PPPoEのMTUを設定
ifconfig pppoe0 mtu 1454
/etc/ifconfig.pppoe0
create ! /sbin/ifconfig ex0 up ! /sbin/pppoectl -e ex0 pppoe0 ! /sbin/pppoectl pppoe0 myauthproto=chap myauthname=USERNAME myauthsecret=PASSWORD hisauthproto=none ! /sbin/pppoectl pppoe0 max-auth-failure=0 inet 0.0.0.0 0.0.0.1 mtu 1454 up
/etc/ipnat.confのpppoeの項目の最後にmssclampを追加。
値はMTUで設定した値-40
/etc/ipnat.conf
map pppoe0 192.168.1.0/24 -> 0/32 mssclamp 1414 <--mtuの値-40
1.カーネルコンフィグで以下の2項目を有効になっているカーネルを作る(GENERICでは有効になっている)
options PFIL_HOOKS # pfil(9) packet filter hooks pseudo-device ipfilter # IP filter (firewall) and NAT
2./etc/sysctl.confに以下を追加。
net.inet.ip.forwarding=1
3.IP Filterの設定
以下の例ではすべて透過。
log onにしておくとipmonでログが取れる
ログも取らずすべて透過でいいなら空ファイルを用意するだけでもいい。
/etc/ipf.conf
pass in log on pppoe0 proto tcp from any to any flags S/SA
4.IP NATの設定
ローカルネットワークが192.168.1.0/24の場合。
/etc/ipnat.conf
#!/sbin/ipnat -f - map pppoe0 192.168.1.0/24 -> 0/32 proxy port ftp ftp/tcp map pppoe0 192.168.1.0/24 -> 0/32 portmap tcp/udp 40000:60000 map pppoe0 192.168.1.0/24 -> 0/32
5./etc/rc.confに以下を追加。
ログを取らない場合はipmonの行はいらない。
ipfilter=YES ipnat=YES ipmon=YES ipmon_flags="-ns" # syslog ipfilter messages