2013年5月29日水曜日

tcpdumpしてWiresharkで確認しようと思ったらエラーがでて困ったんす。

サーバー上でtcpdumpして、FTPでダンプファイルを落としてwiresharkで見ようとしたら
<code>sudo tcpdump host hoge.com and port 80 -s 0 -w dumpfile</code>

The capture file appears to be damaged or corrupt.
(pcap: File has 1702194273-byte packet, bigger than maximum of 65535

とかいうエラーがでて見れませんでした。
グーグル先生に聞いたら
wireshark Q&A
The usual cause of this error is the file being mangled by transferring it over FTP in ASCII mode instead of BINARY mode. If you did transfer the file by FTP, please transfer the file again, now using BINARY mode.
と仰られていたので、バイナリモードで落としてみたら見れました。
Filezillaの場合は転送→転送の種類で変更できます。(デフォルトは自動)

それって気にしたことなかったけど重要だったんですね!

2013年5月7日火曜日

プロキシサーバー構築(squid)

ServerQueenのVPSを数年使用しております。

OSはCentOS5.7
sudo yum install squid
sudo vi /etc/squid/squid.conf
acl [aclname] src [ipアドレス]/255.255.255.255 ← 追加([ipアドレス]/255.255.255.255からのプロキシサーバーへのアクセスを許可(1/2))

http_access allow localhost
http_access allow [aclname]← 追加([ipアドレス]/255.255.255.255からのプロキシサーバーへのアクセスを許可(2/2))
http_access deny all

# forwarded_for on
forwarded_for off ←追加(プロキシサーバーを使用している端末のローカルIPアドレスを隠蔽化)
:wq

sudo iptables -I INPUT 10 -s [ipアドレス] -d [鯖アドレス] -p tcp --dport 3128 -j ACCEPT
sudo service iptables save
sudo service iptables restart
sudo service squid start
sudo chkconfig squid on

という感じで終了

参考:プロキシサーバー構築(Squid)