linux

さくらVPS リニューアルで1Gに乗り換えたのでCentOS 6.2 初期設定 memo

http://vps.sakura.ad.jp/ 512Mプランだったけど、乗り換え優遇プランの案内が来たので乗り換えた。とりあえずやったこと。 OS カスタムインストールでパーティション設定 defaultで用意されているCentOS 6.2 64bit版のパーティション構成は以下。 partition…

traceroute で使っている UDP port 番号

firewallの設定をガチムチにしていたら、icmp版traceroute (traceroute -I) は通るけど、defaultのtracerouteが通らなかったのでport番号調べた。RFCは読んでない。 netscreenのpredefined の設定 ICMP type:8,code:0 UDP src port 0-65535, dst port:33400-…

rsyslogでsyslogを受信した時刻でlogに出力する

remote hostの時刻がずれている(or UTC) の場合などに、syslogの時刻がずれて嫌な感じなので修正できるか調べた。(ex: vyattaのsyslogがUTCで飛んでくる) formatを変えれば出来たっぽい。 http://www.rsyslog.com/doc/rsyslog_conf_templates.html man rsysl…

RHEL系OSでipv6を無効にする

確認したのはRHEL, CentOS, SL の5.8と6.2modprobe.d 以下に適当な名前の設定ファイルを作成 (or /etc/modprobe.conf に直接書く) # vi /etc/modprobe.d/ipv6.conf options ipv6 disable=1設定したあとOS再起動。 昔のRHEL5系 (5.0, 5.1などの古いOS # いつ…

vyatta のsyslog をTCPでremote のsyslog serverに転送する

http://www.vyatta.com/download/docdl Basic System -(Using the CLI, Management, Logging, SNMP, Flow Acctg) vyattaのdocumentをチラ見してもsyslog をtcpで転送するということが載ってなかったぽいんだけど、configure, commit, saveしたあとに生成され…

rsyslogでremote host(or network)ごとにlogをわける

2012年にもなってsyslogdを使い続けるのはいかがなものかということと、RHEL6系がrsyslogを採用しているので、今更になってrsyslogdを真面目に調べています。 http://www.rsyslog.com/storing-messages-from-a-remote-system-into-a-specific-file/ http://w…

linux nic bonding の/proc/net/bonding の表示の謎

SL6.2: eth0, eth1 ともに1Gbpsなのに、bondingのstatusを見たらなぜか100Mbpsになっている。 # ethtool eth0 (略) Settings for eth0: Speed: 1000Mb/s Duplex: Full # ethtool eth1 (略) Settings for eth1: Speed: 1000Mb/s Duplex: Full # more /proc/ne…

RHEL系のmdadmのraid-check を調べてみた

毎週日曜日にcron.weekly で実行されるraid-checkの中を真面目に調べてみた。raid-checkは/etc/sysconfig/raid-check がENABLED=yes になっていると、全mdのsync_actionをidleからcheckに変更し、verifyをかけているようだ。 # echo check > /sys/block/md0/…

RHEL6系でpamを有効にしているとldapユーザだけsshdから拒否られる件

/var/log/secure fatal: Access denied for user hogem by PAM account configurationおそらくどこかの設定がおかしいだけで、他にまともな解決法があるはずだけど、ちょっち時間がないのでとりあえず/etc/ssh/sshd_config の"UsePAM no" に設定している。

upstart でserial コンソールから接続する設定

参考: http://mo.kerosoft.com/0179 /etc/init/以下のファイルと色々にらめっこしていたけど、grubの設定を変えるだけで良かったらしい。 /boot/grub/grub.conf kernel パラメータに "console=tty0 console=ttyS0,115200n8" 等を追加。これでinit/serial.con…

net-snmp snmpd の Connection From UDP をlogに出力させない

/etc/snmp/snmpd.conf # We do not want annoying "Connection from UDP: " messages in syslog. # If the following option is commented out, snmpd will print each incoming # connection, which can be useful for debugging. dontLogTCPWrappersConnec…

Scientific Linux 6 だとremiリポジトリの参照でエラーになる件

# cat /etc/redhat-release Scientific Linux release 6.2 (Carbon) # yum search --enablerepo=remi php Loaded plugins: security Could not retrieve mirrorlist http://rpms.famillecollet.com/enterprise/6.2/remi/mirror error was 14: PYCURL ERROR 2…

RHEL6系へのcobbler install メモ

Scientific Linux 6.2で。 2011/2/29 時点ではRHEL6系のepelにはdebmirrorがなかった。 http://dl.fedoraproject.org/pub/epel/5/x86_64/ http://dl.fedoraproject.org/pub/epel/6/x86_64/ CentOS 5.7にepelからinstallしたdebmirrorを見ると # file `which …

ntop linux serverのトラフィック統計確認

webUIで結果を確認できる。 libpcap、rrdtool、GeoIP等が必要。 http://www.ntop.org/products/ntop/ install # wget http://sourceforge.net/projects/ntop/files/ntop/Stable/ntop-4.1.0.tar.gz/download # tar zxvf ntop-4.1.0.tar.gz # cd ntop-4.1.0 # …

xinetdを使わずproftpdをtcp wrapper (like)でアクセス制御する

http://www.proftpd.org/docs/contrib/mod_wrap.html http://www.proftpd.org/docs/contrib/mod_wrap2.html http://www.proftpd.org/docs/contrib/mod_wrap2_file.html 今までproftpd単体ではtcpwrapper使えない思い込んでいたけどのでxinetdかましてたんだ…

extファイルシステムの拡張属性

man chattr man lsattr 例えば rootでも変更・削除できないファイルを作成するには、chatt +i で'i' immutable属性を設定すればいい、ということは知ってたんだけど、気になったので他の属性も見てみた。互換性があるので、ext2, ext3, ext4でも可能。ext 固…

p2v 物理サーバのHDDイメージを仮想マシンのイメージに変換

最近もっぱら奴隷のように仮想化を調べていて、物理サーバの引越しがお題目。仮想化!仮想化ァ! virt-p2v を使う方法 http://libguestfs.org/virt-v2v/ http://docs.redhat.com/docs/ja-JP/Red_Hat_Enterprise_Virtualization_for_Desktops/2.2/html/Admini…

guestfish (libguestfs)で仮想マシンのディスクイメージにアクセスしてイメージ中のファイルを読み書きする

http://libguestfs.org/ libguestfs is a set of tools for accessing and modifying virtual machine (VM) disk images. libguestfsは仮想マシンのディスクイメージにアクセスするライブラリ。で、guestfishはそのフロントエンドのCLIツール。man, guestfis…

cobbler 利用時のdefault install modeをgraphicalにする

RHEL6からtextモードではパーティションをカスタマイズできなくなった関係の対策。/etc/cobbler/settings のkernel_options から"text: ~" を削除してcobber 再起動。defaultはtextのままで、graphicalにprofileにだけkernel optionsに"!text" を設定しても…

SL6.1で2.6.32-220.2.1 にあげたらkernelがwarningのtrace吐いてた

RHEL6 互換のOSで起きている現象? https://access.redhat.com/kb/docs/DOC-68014 https://bugzilla.redhat.com/show_bug.cgi?id=770228 https://www.centos.org/modules/newbb/viewtopic.php?topic_id=34872 # cat /etc/redhat-release Scientific Linux re…

RHEL6 系のLDAP認証 - clientの設定

CentOS, Scientifix Linuxも同じ。redhatのmanualをちょろっと読んで動かしている限り、認証したいclient側でnslcd を起動させておく必要がある? # yum install openldap-clients pam_ldap nss-pam-ldapd # authconfig --enableldap --enableldapauth --upd…

64bit RHEL5・CentOS5 で32bitのパッケージが標準でインストールされないようにする

http://docs.redhat.com/docs/ja-JP/Red_Hat_Enterprise_Linux/6/html/Migration_Planning_Guide/ch09s05.html http://www.redhat.com/archives/rhl-devel-list/2008-February/msg00168.html CentOS5のdefaultでは、例えばyum install subversion とすると以…

仮想MacアドレスのベンダーID

catalystのshow mac address-table をかき集めたもの(Net::Telnetとarp tableをかき集めたもの(Net::Ping, Net::Libdnet::Arp) から 半自動でswitchのportに接続してるhostのIPを引っ張ってくるperl書いてたんだけど、仮想マシンがあると同一Portに複数のMac…

rtmpdump/flvstreamer で rtmp(flash ストリーミング) のファイルを保存する

fmsの死活監視をしようとしてrtmp clientを(perlのKamaitachi等を使って)書こうとしたけど、そもそもrtmpが良くわからないし面倒になったので既製品使うことにした。それっぽい単語でぐぐるとrtmpdumpとflvstreamerというのが見つかった。flvstreamerはrtmpd…

linuxでバイナリダンプ

optionは適当(なくてもいい)。他にも有りそう。 xxd xxd -g 1 file od odは-t format で出力形式の指定が可能。 od -t x1z file od -t xCz file hexdump hexdump -C file

linuxでintel NIC driver e1000eを最新に更新する

intelの公式からとってくる。 http://downloadcenter.intel.com/SearchResult.aspx?lang=jpn&keyword=%22e1000e%22# linux - driver 2012/01/11時点で最新は1.9.5。 kernelのsourceが必要なので、なければinstallしておく。 # apt-get install linux-headers…

libvirtのnwfilterで仮想マシン(のNIC)に割り当てるIPを制限する

参考: http://libvirt.org/firewall.html http://libvirt.org/formatnwfilter.html openvswitch installと設定 で挫折したようにopenvswitchは仮想OS再起動ごとにidが変わるから面倒だ〜思ってlibvirtをもう1回調べていたら見つけた。(というか前から/etc/li…

haproxy 試した

http://haproxy.1wt.eu/ L7ロードバランサプロキシ。cookie insertによるpersistenceなんかも出来るとのこと。 install debianで。 # apt-get insatll haproxy /etc/default/haproxy ENABLED=1RHEL系の場合はepelから入れる。 # yum install --enablerepo=ep…

openvswitch installと設定

参考: http://openvswitch.org/ http://tomocha.net/diary/?20110928 (flow ruleとか) git clone git://openvswitch.org/openvswitch source最新版にopenvswitch-1.2.2.tar.gz があるけど、redhat用の起動スクリプトにBRCOMPAT(linux互換のブリッジモード)の…

bridge接続している仮想マシンのnetworkをホストOSのiptablesで制御

man iptables あんましやることないだろうけど、出来たのでメモ。設定はホストOSで。eth0をbr0でbridgeしている場合の例。まずprocの値を変更 # echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables # echo 1 > /proc/sys/net/bridge/bridge-nf-call-arp…