「ネットワークデバッグ」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(英語版よりコピー)
 
(→‎Ping & Tracepath/Traceroute: タイトル修正)
 
(同じ利用者による、間の5版が非表示)
6行目: 6行目:
 
{{Related articles end}}
 
{{Related articles end}}
   
==Link status==
+
==リンク状態==
   
  +
{{ic|ip a}} の概要には、リンク状態がすでに表示されています。ただし、以下のコマンドを実行することでも表示することができます。
In the overview of {{ic|ip a}}, the link status will already be displayed. But it can also be displayed by running:
 
   
 
$ ip link show dev eth0
 
$ ip link show dev eth0
   
  +
これにより、次のような出力が得られます。
This will provide an output along the lines of:
 
   
 
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
 
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
 
link/ether 70:5a:b6:8a:a0:87 brd ff:ff:ff:ff:ff:ff
 
link/ether 70:5a:b6:8a:a0:87 brd ff:ff:ff:ff:ff:ff
   
  +
インターフェースを起動するには、次のコマンドを入力します。
Bringing up an interface can be done by issuing:
 
   
 
# ip link set dev eth0 up
 
# ip link set dev eth0 up
23行目: 23行目:
 
=== RTNETLINK answers: Cannot assign requested address ===
 
=== RTNETLINK answers: Cannot assign requested address ===
   
  +
インターフェースを起動しようとしたときにこのエラーが表示された場合、MAC アドレスが無効である可能性があります。有効な MAC アドレスを設定するには、[[MAC アドレス偽装]]を参照してください。
If you get this error when trying to set an interface up, its most probably because you have an invalid MAC address. To set a working MAC, see [[MAC address spoofing]].
 
   
== IP address ==
+
== IP アドレス ==
{{Merge|Network configuration#IP addresses|duplicate}}
 
   
  +
{{ic|ip a}} で提供される概要には、IP アドレスがすでに表示されています。ただし、以下のコマンドを実行することでも表示することができます。
In the overview provided by {{ic|ip a}}, the ip address will already be displayed. But it can also be displayed by running:
 
   
 
$ ip addr show dev eth0
 
$ ip addr show dev eth0
   
  +
これにより、次のような出力が得られます。
This will provide an output along the lines of:
 
   
 
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
 
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
40行目: 39行目:
 
valid_lft forever preferred_lft forever
 
valid_lft forever preferred_lft forever
   
  +
一時的な IP アドレスを追加するには:
Adding a temporary ip address:
 
   
 
# ip addr add 192.168.1.143/24 dev eth0
 
# ip addr add 192.168.1.143/24 dev eth0
   
  +
IP アドレスを削除するには:
Removing an ip address:
 
   
 
# ip addr del 192.168.1.143/24 dev eth0
 
# ip addr del 192.168.1.143/24 dev eth0
   
==Ping & Tracepath/Traceroute==
+
==Ping Tracepath/Traceroute==
{{Merge|Network configuration#Ping|duplicate}}
 
   
  +
ping コマンドは、特定のホストへの接続性をテストするのに役立ちます。
The ping command can help test connectivity towards a specific host.
 
   
  +
最初のステップは、デフォルトゲートウェイへの接続性を確認することです(IP アドレスを自分のデフォルトゲートウェイに置き換えてください):
The first step would be verifying connectivity towards the default gateway (replace the ip address with your own default gateway):
 
   
 
$ ping -c4 192.168.1.1
 
$ ping -c4 192.168.1.1
   
  +
"-c4" パラメータを削除すると、ping は終了しなくなります。"Control-C" を押して中止することができます。
When erasing the "-c4" parameter, the ping will continue endlessly. It can be aborted by hitting "Control-C".
 
   
 
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
 
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
69行目: 67行目:
 
rtt min/avg/max/mdev = 0.165/0.184/0.193/0.014 ms
 
rtt min/avg/max/mdev = 0.165/0.184/0.193/0.014 ms
   
  +
上記の出力は、デフォルトゲートウェイに到達できることを示しています。代わりに "{{ic|Destination Host Unreachable}}" メッセージが表示された場合は、IP アドレス、ネットマスク、デフォルトゲートウェイの設定を再確認してください。このメッセージは、ICMP トラフィックがデフォルトゲートウェイに対して許可されていない場合(ファイアウォール、ルーターなどによってブロックされている場合)にも表示される場合があります。
The output above indicated the default gateway is reachable. When instead a "{{ic|Destination Host Unreachable}}" message is displayed, doublecheck the ip address, netmask and default gateway config. This message can also be displayed when ICMP traffic is not permitted towards the default gateway (blocked by a firewall, router,...).
 
   
  +
次のステップは、設定された DNS サーバーへの接続性を確認することです。応答がない場合は、{{ic|tracepath}} または {{ic|traceroute}} を使用して、サーバーへのルーティングを確認し、問題の原因を特定できます。
The next step is verifying connectivity towards the configured dns server(s). When no reply is received, {{ic|tracepath}} or {{ic|traceroute}} can be used to verify the routing towards said server and get an idea of where the issue lies.
 
   
 
$ traceroute 8.8.4.4
 
$ traceroute 8.8.4.4
   
  +
Traceroute は ICMP を使用してパスを決定するため、ICMP トラフィックがブロックされている場合、応答が "no reply" になる場合があります。
Traceroute also used ICMP to determine the path and hence there can be "no reply" answers as well when ICMP traffic is blocked.
 
   
 
== Tcpdump ==
 
== Tcpdump ==
  +
{{pkg|tcpdump}} とその基盤となるライブラリ {{pkg|libpcap}} は、ネットワーク上のパケットに対するマルチプラットフォームのユーザースペースインタフェースです。重要な点として、彼らは到達する入力パケットを見ることができます。これは、ローカルソフトウェアの[[ファイアウォール]]がパケットをブロックしている場合でも同様です。一方、彼らはファイアウォールが通過させた出力パケットしか見ることができません。[https://superuser.com/questions/925286/does-tcpdump-bypass-iptables]
{{pkg|tcpdump}}, and its underlying library {{pkg|libpcap}}, are multi-platform user space interfaces to the packets on the network. It should be emphasized they do see, they can capture, any inbound packets that reach the local NIC. No matter if the local software [[firewall]] is blocking those packets, or not. On the other hand, they can only see outbound packets the firewall passes through: [https://superuser.com/questions/925286/does-tcpdump-bypass-iptables]
 
   
A short, unintimidating introduction to tcpdump, with examples, is at: [https://wizardzines.com/zines/tcpdump/]
+
例を交えた、簡潔な tcpdump の紹介は、こちらのウェブページにあります。[https://wizardzines.com/zines/tcpdump/]

2023年8月19日 (土) 18:55時点における最新版

関連記事

リンク状態

ip a の概要には、リンク状態がすでに表示されています。ただし、以下のコマンドを実行することでも表示することができます。

$ ip link show dev eth0

これにより、次のような出力が得られます。

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
   link/ether 70:5a:b6:8a:a0:87 brd ff:ff:ff:ff:ff:ff

インターフェースを起動するには、次のコマンドを入力します。

# ip link set dev eth0 up

RTNETLINK answers: Cannot assign requested address

インターフェースを起動しようとしたときにこのエラーが表示された場合、MAC アドレスが無効である可能性があります。有効な MAC アドレスを設定するには、MAC アドレス偽装を参照してください。

IP アドレス

ip a で提供される概要には、IP アドレスがすでに表示されています。ただし、以下のコマンドを実行することでも表示することができます。

$ ip addr show dev eth0

これにより、次のような出力が得られます。

 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
   link/ether 70:5a:b6:8a:a0:87 brd ff:ff:ff:ff:ff:ff
   inet 192.168.1.143/24 brd 192.168.1.255 scope global eth0
   inet6 fe80::725a:b6ff:fe8a:a087/64 scope link 
      valid_lft forever preferred_lft forever

一時的な IP アドレスを追加するには:

# ip addr add 192.168.1.143/24 dev eth0

IP アドレスを削除するには:

# ip addr del 192.168.1.143/24 dev eth0

Ping と Tracepath/Traceroute

ping コマンドは、特定のホストへの接続性をテストするのに役立ちます。

最初のステップは、デフォルトゲートウェイへの接続性を確認することです(IP アドレスを自分のデフォルトゲートウェイに置き換えてください):

$ ping -c4 192.168.1.1

"-c4" パラメータを削除すると、ping は終了しなくなります。"Control-C" を押して中止することができます。

PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_req=1 ttl=64 time=0.193 ms
64 bytes from 192.168.1.1: icmp_req=2 ttl=64 time=0.190 ms
64 bytes from 192.168.1.1: icmp_req=3 ttl=64 time=0.192 ms
64 bytes from 192.168.1.1: icmp_req=4 ttl=64 time=0.189 ms

--- 192.168.1.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2999ms
rtt min/avg/max/mdev = 0.165/0.184/0.193/0.014 ms

上記の出力は、デフォルトゲートウェイに到達できることを示しています。代わりに "Destination Host Unreachable" メッセージが表示された場合は、IP アドレス、ネットマスク、デフォルトゲートウェイの設定を再確認してください。このメッセージは、ICMP トラフィックがデフォルトゲートウェイに対して許可されていない場合(ファイアウォール、ルーターなどによってブロックされている場合)にも表示される場合があります。

次のステップは、設定された DNS サーバーへの接続性を確認することです。応答がない場合は、tracepath または traceroute を使用して、サーバーへのルーティングを確認し、問題の原因を特定できます。

$ traceroute 8.8.4.4

Traceroute は ICMP を使用してパスを決定するため、ICMP トラフィックがブロックされている場合、応答が "no reply" になる場合があります。

Tcpdump

tcpdump とその基盤となるライブラリ libpcap は、ネットワーク上のパケットに対するマルチプラットフォームのユーザースペースインタフェースです。重要な点として、彼らは到達する入力パケットを見ることができます。これは、ローカルソフトウェアのファイアウォールがパケットをブロックしている場合でも同様です。一方、彼らはファイアウォールが通過させた出力パケットしか見ることができません。[1]

例を交えた、簡潔な tcpdump の紹介は、こちらのウェブページにあります。[2]