Wiresharkを使用してパケットをリモートでキャプチャする必要があるため、対応するrpcapdサービスをリモートホストにインストールする必要があります。
WinPcapソフトウェアがWindowsにインストールされている限り、起動されている限り、rpcapdサービスがすでに含まれています。しかし、Linuxでは、自分でコンパイルする必要があります。
注:Wiresharkは、対応するrpcapdサービスルーチンがリモートホストにインストールされている限り、リモートでパケットをキャプチャするリモートパケットキャプチャプロトコルをサポートしています。
インストールコマンドは次のとおりです。
yum install glibc-static flex
wget http://www.winpcap.org/install/bin/WpcapSrc_4_1_2.zip
unzip WpcapSrc_4_1_2.zip
cd winpcap/wpcap/libpcap
chmod +x configure runlex.sh
CFLAGS=-static ./configure
make
cd rpcapd
make
その後
./rpcapd -n
rpcapサービスを実行します。
ただし、。/ rpcapd -nを実行すると、次のエラーが報告されます
[root@iZ23gx7o02aZ rpcapd]# ./rpcapd -n
Press CTRL + C to stop the server...
socket(): Address family not supported by protocol (code 97)
理由:Linuxでは、ポートが開いていない可能性があります。この場合、iptablesサービスの構成を変更して、2002ポートを開く必要があります。
解決策:
1. CentOSで/ etc / sysconfig /の下にiptablesファイルが見つからない
2. Linuxでのiptablesの詳細構成(転送)Linuxでのiptablesの詳細構成を
参照(転送) iptablesサービスの構成を変更して2002ポートを開く
最初に行うことは、直接接続しないように、SSHのACCEPTを構成することです。
1. SSHポートが22の場合(ここではデフォルトのポートはお勧めしません。SSHポートを変更することをお勧めします)
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
/etc/rc.d/init.d/iptables saveに注意してください。以下のステップごとにこのステートメントを再度実行することをお勧めします。以下では繰り返されません。
[root@iZ23gx7o02aZ sysconfig]# iptables -A INPUT -p tcp --dport 22 -j ACCEPT
[root@iZ23gx7o02aZ sysconfig]# iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
[root@iZ23gx7o02aZ sysconfig]# /etc/rc.d/init.d/iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
[root@iZ23gx7o02aZ sysconfig]#
2. iptablesを変更してポート2002を開く
iptables -A INPUT -p tcp --dport 2002 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 2002 -j ACCEPT
最後に、/ etc / init.d / iptables saveを再度実行する必要があることに注意してください。これにより、これら2つのステートメントは/ etc / sysconfig / iptablesファイルに今保存されます。
[root@iZ23gx7o02aZ sysconfig]# iptables -A INPUT -p tcp --dport 2002 -j ACCEPT
[root@iZ23gx7o02aZ sysconfig]# iptables -A OUTPUT -p tcp --sport 2002 -j ACCEPT
[root@iZ23gx7o02aZ sysconfig]# /etc/init.d/iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
[root@iZ23gx7o02aZ sysconfig]#
3. iptablesの内容を表示する
[root@iZ23gx7o02aZ sysconfig]# vi iptables
1 # Generated by iptables-save v1.4.7 on Wed Dec 10 21:20:39 2014
2 *filter
3 :INPUT ACCEPT [4602:266675]
4 :FORWARD ACCEPT [0:0]
5 :OUTPUT ACCEPT [5004:417513]
6 -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
7 -A INPUT -p tcp -m tcp --dport 2002 -j ACCEPT
8 -A OUTPUT -p tcp -m tcp --sport 22 -j ACCEPT
9 -A OUTPUT -p tcp -m tcp --sport 2002 -j ACCEPT
10 COMMIT
11 # Completed on Wed Dec 10 21:20:39 2014
4. iptables
restartコマンドを再起動します。
service iptables restart
[root@iZ23gx7o02aZ sysconfig]# service iptables restart
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]
[root@iZ23gx7o02aZ sysconfig]#
5. ./rpcapd -nを実行します
[root@iZ23gx7o02aZ rpcapd]# ./rpcapd -n
Press CTRL + C to stop the server...
socket(): Address family supported by protocol (code 98)
変更が成功しました!