Fedora8 PPC
バタバタと年末が過ぎていき、田舎に帰ったりすると早くも2日。何をするかを考えながらなんとなく手慰みにLinuxを触ってみました。余っている初代macmini(PowerPC)にFedora8をインストール。CentOSを入れたかったけどPPCのCentOS5はないし4はβのようなので。
Apacheの設定
# yum -y install httpd-devel
fedoraのapacheにはapxsがなかったのでなんかインスコ
# vim /etc/httpd/conf/httpd.conf # /etc/rc.d/init.d/httpd start
confは適当になにかやったので省略。mod_phpのloadと拡張子設定とServerNameとAllowOverRideくらい。どうでもいい。
SE Linuxの設定
取りあえずSE LinuxをOFFにw
# getenforce 設定確認 Enforcing # setenforce 0 OFFに # getenforce Permissive
# vi /etc/sysconfig/selinux
SELINUX=disabled システム起動時にSELinuxを無効化
SNMPのインストール
# yum install net-snmp # yum install net-snmp-utils # vim /etc/snmp/snmpd.conf com2sec local localhost PUBLIC com2sec mynetwork 192.168.0.0/24 PUBLIC group MyRWGroup any local group MyROGroup any mynetwork view all included .1 80 access MyROGroup "" any noauth 0 all none none access MyRWGroup "" any noauth 0 all all all syslocation Unknown (edit /etc/snmp/snmpd.conf) syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf) proc mountd proc ntalkd 4 proc sendmail 10 1 disk / 10000 load 12 14 14
適当に。
# vim /etc/snmp/snmpd.options OPTIONS="-Lf /var/log/snmpd.log"
snmpdのログ出力設定をかいておく。ここにオプションを書いておくと起動時に読み込まれるようになってました。
# /etc/rc.d/init.d/snmpd start
起動
# snmpwalk -v1 -c PUBLIC localhost
これでずらずら〜っと長い表示がでればsnmpdが話してるのでOK。
iptablesの設定
# snmpwalk -v1 -c PUBLIC 192.168.0.100 Timeout: No Response from 192.168.0.100
同一ローカルエリアネットワークの別サーバから叩くとこんな感じでした。タイムアウト。調べてみたところFedoraはデフォルトでiptablesが有効みたいなので設定することに。
# /sbin/iptables -F # /sbin/iptables -P INPUT ACCEPT # /sbin/iptables -P FORWARD DROP # /sbin/iptables -P OUTPUT ACCEPT # /sbin/iptables -A INPUT -p icmp -j ACCEPT # /sbin/iptables -A INPUT -i lo -j ACCEPT # /sbin/iptables -A INPUT -p tcp --dport 80 -j ACCEPT # /sbin/iptables -A INPUT -p tcp --dport 21 -j ACCEPT # /sbin/iptables -A INPUT -p tcp --dport 110 -j ACCEPT # /sbin/iptables -A INPUT -p tcp --dport 25 -j ACCEPT # /sbin/iptables -A INPUT -p tcp --dport 22 -j ACCEPT # /sbin/iptables -A INPUT -p tcp --dport 161:162 -j ACCEPT # /sbin/iptables -A INPUT -p udp --dport 161:162 -j ACCEPT # /sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # /sbin/iptables -P INPUT DROP
超適当です。必要なものだけ開けておけばいいかなと。
# /sbin/service iptables save # /sbin/service iptables restart
セーブして再起動
MRTG設定
書き足しておく。内容はcfgmaker PUBLIC@192.168.0.100で表示されたものをそのまま使いました。
# vim /usr/local/etc/mrtg/mrtg.cfg
Target[192.168.0.100_2]: 2:PUBLIC@192.168.0.100:
SetEnv[192.168.0.100_2]: MRTG_INT_IP="192.168.0.100" MRTG_INT_DESCR="eth0"
MaxBytes[192.168.0.100_2]: 12500000
Title[192.168.0.100_2]: Traffic Analysis for 2 -- macmini
PageTop[192.168.0.100_2]: <h1>Traffic Analysis for 2 -- macmini</h1>
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>macmini in Unknown (edit /etc/snmp/snmpd.conf)</td>
</tr>
<tr>
<td>Maintainer:</td>
<td>Root <root@localhost> (configure /etc/snmp/snmp.local.conf)</td>
</tr>
<tr>
<td>Description:</td>
<td>eth0 </td>
</tr>
<tr>
<td>ifType:</td>
<td>ethernetCsmacd (6)</td>
</tr>
<tr>
<td>ifName:</td>
<td>eth0</td>
</tr>
<tr>
<td>Max Speed:</td>
<td>12.5 MBytes/s</td>
</tr>
<tr>
<td>Ip:</td>
<td>192.168.0.100 ()</td>
</tr>
</table>
</div>
# env LANG=C /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg
テスト。
# indexmaker /usr/local/etc/mrtg/mrtg.cfg > /usr/local/www/apache22/data/mrtg/index.html
index.htmlを更新しておく、と。
目的が何もないのもつまらないのでがっくしメニューに参加してトラフィックを集めてみることにしました。どのくらいアクセスがくるのか楽しみです。わくわく。
参考
- http://penguin.nakayosi.jp/linux/iptables.html
- http://gakkun.blog.drecom.jp/archive/70
