0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ネットワーク系コマンド(Windows)

Last updated at Posted at 2020-03-02

Windowsネットワーク系調査コマンド

Windows OSでネットワーク関連のトラブルシューティングをする際に有用なコマンドをまとめる。

1.自身のIPアドレス表示

基本的な情報が分かる忘れてはいけないコマンド。

  • IPアドレス
  • サブネットマスク
  • デフォルトGW
  • DNS Suffix
簡易コマンド
ipconfig
詳細コマンド
ipconfig /all

2.開いているポートを確認

自サーバで解放されているポートが判別可能。
TCP・UDP、TCPはLISTENINGやESTABLISHステータスまで包括的に確認可能

ポート確認
C:\Users\Administrator>netstat -qn

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING
  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING
  TCP    0.0.0.0:3389           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:5357           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:5985           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:47001          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:49664          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:49665          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:49666          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:49667          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:49673          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:49886          0.0.0.0:0              LISTENING
  TCP    10.10.1.18:139         0.0.0.0:0              LISTENING
  TCP    10.10.1.18:3389        27.0.3.145:15792       ESTABLISHED
  TCP    10.10.1.18:49680       52.119.220.97:443      ESTABLISHED
  TCP    10.10.1.18:49966       54.240.225.173:443     ESTABLISHED
  TCP    172.24.48.1:53         0.0.0.0:0              LISTENING
  TCP    172.24.48.1:139        0.0.0.0:0              LISTENING
  TCP    0.0.0.0:49680          0.0.0.0:0              BOUND
  TCP    0.0.0.0:49966          0.0.0.0:0              BOUND
  TCP    [::]:135               [::]:0                 LISTENING
  TCP    [::]:445               [::]:0                 LISTENING
  TCP    [::]:3389              [::]:0                 LISTENING
  TCP    [::]:5357              [::]:0                 LISTENING
  TCP    [::]:5985              [::]:0                 LISTENING
  TCP    [::]:47001             [::]:0                 LISTENING
  TCP    [::]:49664             [::]:0                 LISTENING
  TCP    [::]:49665             [::]:0                 LISTENING
  TCP    [::]:49666             [::]:0                 LISTENING
  TCP    [::]:49667             [::]:0                 LISTENING
  TCP    [::]:49673             [::]:0                 LISTENING
  TCP    [::]:49886             [::]:0                 LISTENING
  UDP    0.0.0.0:123            *:*
  UDP    0.0.0.0:3389           *:*
  UDP    0.0.0.0:3702           *:*
  UDP    0.0.0.0:3702           *:*
  UDP    0.0.0.0:5353           *:*
  UDP    0.0.0.0:5355           *:*
  UDP    0.0.0.0:49703          *:*
  UDP    10.10.1.18:137         *:*
  UDP    10.10.1.18:138         *:*
  UDP    127.0.0.1:49702        *:*
  UDP    172.24.48.1:53         *:*
  UDP    172.24.48.1:137        *:*
  UDP    172.24.48.1:138        *:*
  UDP    [::]:123               *:*
  UDP    [::]:3389              *:*
  UDP    [::]:3702              *:*
  UDP    [::]:3702              *:*
  UDP    [::]:5353              *:*
  UDP    [::]:5355              *:*
  UDP    [::]:49704             *:*

3.ルーティングテーブル確認

通信が通らない時に、まずはここから調査しておかしいルーティングがないか調べる。

ルーティングテーブル
netstat -rn

4. ICMP疎通

簡単な動作確認として多用する。

ルーティングテーブル

# 止めるまで永続的にping
ping -t [宛先]

# ping間隔指定
ping -w [間隔()] [宛先]

# ping回数指定
ping -n [回数] [宛先]

# pingパケットサイズ指定
ping -l [サイズ(byte)] [宛先]

5.DNS名前解決

DNSサーバを指定する方法はぜひ活用していきたい。

名前解決
# 簡易
C:\Users\Administrator>nslookup yahoo.co.jp
Server:  ip-10-10-0-2.ap-northeast-1.compute.internal
Address:  10.10.0.2

Non-authoritative answer:
Name:    yahoo.co.jp
Addresses:  182.22.59.229
          183.79.135.206

# DNSサーバ指定
C:\Users\Administrator>nslookup yahoo.co.jp 8.8.8.8
Server:  dns.google
Address:  8.8.8.8

Non-authoritative answer:
Name:    yahoo.co.jp
Addresses:  183.79.135.206
          182.22.59.229

6. 宛先までの利用経路調査

ICMP ECHOパケットを流すことで宛先までのネットワーク経路を判定する。TTLの初期値=1、それ以降1ずつ増やしていくことでICMP Time Exceededエラーパケットを宛先までの各ルータから受け取ることで最終的な宛先経路を表示する。Windowsだとtracertになるが、TCPやUDPはオプションを見る限り指定できない。。。

宛先ネットワーク経路
# -d 名前解決無効, -w パケット送信間隔, -h 最大ホップ数(上限255), -j 必ず経路上通るルータ指定
tracert -d -w 2 -h 255 -j [必須ルータ] yahoo.co.jp

参考
https://support.microsoft.com/ja-jp/help/314868/how-to-use-tracert-to-troubleshoot-tcp-ip-problems-in-windows

   -d 
      Specifies to not resolve addresses to host names

   -h maximum_hops
      Specifies the maximum number of hops to search for the target

   -j host-list
      Specifies loose source route along the host-list

   -w timeout
      Waits the number of milliseconds specified by timeout for each
      reply

   target_host
      Specifies the name or IP address of the target host
0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?