LoginSignup
3
3

More than 5 years have passed since last update.

ネットワークの状態を確認するコマンド

Posted at

ネットワークの状態を確認するコマンド。
問題の切り分けに使用できる。

■ tcpdump

ネットワークの通信の生データをキャプチャするツール。


・tcoダンプのインストール
tcpdump
yum install tcpdump

・実行
sudo tcpdump

・ファイル出力
sudo tcpdump -w $(uname -n)_$(date +%Y%m%d%H%M%S).pcap 
wiresharkでキャプチャが可能。

複数ファイル1Mバイトごとに出力する。
# tcpdump -C 1 -w $(uname -n)_$(date +%Y%m%d%H%M%S).pcap 

・ターゲットを絞る
ホストアドレスで絞る
tcpdump host 192.168.11.1

ポートで絞る
tcpdump dst port 80

両方で絞る
tcpdump dst port 80 and host dst 192.168.11.1

■ nmap

nmap (“Network Mapper”)は、指定したホストに対してスキャンを行い、
ポートの開閉状況や、ホストの利用可能状況など様々な情報を取得できるオープンソースツール。


・インストール
yum install nmap

・実行
nmap 192.168.1.100

・ポートを絞る
nmap -p 22-1024 192.168.1.100

・開いているポートのサービスのバージョンを推測
nmap -sV -p 22 192.168.1.100

■ nc

netcatとは、引数で指定したホストに、引数で指定したデータを送信し、応答を出力するツール。


・インストール
yum install nc

・実行
nc 192.168.1.100 1024
>>標準入力 : HEAD / HTTP/1.0←送るデータ

・ファイルの内容を実行
cat request.txt
HEAD / HTTP/1.0

nc 192.168.1.100 1024 < request.txt

・パイプ
echo -en "GET / HTTP/1.1\n\n" | nc 192.168.1.100 1024

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3