7.3 接続の確認

ネットワークへの接続確認
 ネットワーク上の他のコンピュータとの通信ができるかを確認するためには pingコマンドがよく利用されます. コマンドには相手のコンピュータの IP アドレスまたはドメインネームを指定します.

[student]$ /bin/ping 192.168.0.101
PING 192.168.0.1 (192.168.0.1) from 192.168.0.101 : 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=0 ttl=255 time=306 usec
64 bytes from 192.168.0.1: icmp_seq=1 ttl=255 time=299 usec
64 bytes from 192.168.0.1: icmp_seq=2 ttl=255 time=270 usec
64 bytes from 192.168.0.1: icmp_seq=3 ttl=255 time=288 usec
64 bytes from 192.168.0.1: icmp_seq=4 ttl=255 time=264 usec

--- 192.168.0.1 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/mdev = 0.264/0.285/0.306/0.022 ms
[student]$
				

このコマンドを終了するには [Ctrl] + C で終了します.

ネットワーク経路
 ネットワーク上をデータが目的のコンピュータまで到達する経路を確認するには tracerouteコマンドを使います.引数として相手先の IP アドレスまたはドメインネームを指定します.

[student]# /usr/sbin/traceroute 192.168.2.1
traceroute to 192.168.2.1 (192.168.2.1), 30 hops max, 38 byte packets
 1  192.168.0.1 (192.168.0.1)  2.596 ms  0.539 ms  0.531 ms
 2  192.168.1.1 (192.168.1.1)  2.084 ms  1.688 ms  1.817 ms
 3  192.168.2.1 (192.168.2.0)  4.210 ms  1.128 ms  11.376 ms
[student]#
				

このコマンドによって到達経路がわかり, また経路の問題がどこにあるかを確認することができます.

ネットワークの再起動
ネットワーク全体に関する起動は /etc/init.d/network というスクリプトで行うことができます. 引数として start (起動), stop (停止), restart (再起動) などがあります. 次の例では再起動を行っています.

[root]# /etc/rc.d/init.d/network restart
Shutting down interface eth0:                                [  OK  ]
Setting network parameters:                                  [  OK  ]
Bringing up interface lo:                                    [  OK  ]
Bringing up interface eth0:                                  [  OK  ]
[root]#