ping
-
ping send ICMP ECHO_REQUEST to network hosts
better than traceroute and ping combined
ICMP ICMP是(Internet Control Message Protocol)Internet控制報文協(xié)議。它是TCP/IP協(xié)議族的一個子協(xié)議,用于在IP主機躬拢、路由器之間傳遞控制消息做个。控制消息是指網(wǎng)絡通不通秋茫、主機是否可達史简、路由是否可用等網(wǎng)絡本身的消息。這些控制消息雖然并不傳輸用戶數(shù)據(jù)肛著,但是對于用戶數(shù)據(jù)的傳遞起著重要的作用圆兵。
ICMP
- ping 本機
如果ping不通的話則表明網(wǎng)卡安裝或配置有問題。將網(wǎng)線斷開再次執(zhí)行此命令枢贿,如果顯示正常殉农,則說明本機使用的IP地址可能與另一臺正在使用的機器IP地址重復了。如果仍然不正常局荚,則表明本機網(wǎng)卡安裝或配置有問題超凳,需繼續(xù)檢查相關網(wǎng)絡配置愈污。
[posp@hadoop02 log]$ ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.024 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.008 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.008 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.023 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.009 ms
^C
--- 127.0.0.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4301ms
rtt min/avg/max/mdev = 0.008/0.014/0.024/0.008 ms
- ping 網(wǎng)關
?能正常ping通,則表明局域網(wǎng)中的網(wǎng)關路由器正在正常運行轮傍。反之暂雹,則說明網(wǎng)關有問題
[posp@hadoop02 log]$ ping 192.168.3.1
PING 192.168.3.1 (192.168.3.1) 56(84) bytes of data.
64 bytes from 192.168.3.1: icmp_seq=1 ttl=128 time=0.446 ms
64 bytes from 192.168.3.1: icmp_seq=2 ttl=128 time=0.418 ms
64 bytes from 192.168.3.1: icmp_seq=3 ttl=128 time=0.417 ms
^C
--- 192.168.3.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2126ms
rtt min/avg/max/mdev = 0.417/0.427/0.446/0.013 ms
注:網(wǎng)關:route -- default 里面的GETWAY --就是網(wǎng)關
[posp@hadoop02 log]$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.3.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
default 192.168.3.1 0.0.0.0 UG 0 0 0 eth0
- ping 遠程IP
檢測本機是否能正常訪問Internet
[posp@hadoop02 log]$ ping www.baidu.com
PING www.a.shifen.com (115.239.210.27) 56(84) bytes of data.
64 bytes from 115.239.210.27: icmp_seq=1 ttl=53 time=6.36 ms
64 bytes from 115.239.210.27: icmp_seq=2 ttl=53 time=6.60 ms
64 bytes from 115.239.210.27: icmp_seq=3 ttl=53 time=6.44 ms
64 bytes from 115.239.210.27: icmp_seq=4 ttl=53 time=5.91 ms
^C
--- www.a.shifen.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 7413ms
rtt min/avg/max/mdev = 5.914/6.331/6.602/0.268 ms
- 使用Ping檢查連通性有六個步驟:
- 使用ifconfig觀察本地網(wǎng)絡設置是否正確;
- Ping127.0.0.1,127.0.0.1回送地址Ping回送地址是為了檢查本地的TCP/IP協(xié)議有沒有設置好;
- Ping本機IP地址金麸,這樣是為了檢查本機的IP地址是否設置有誤;
- Ping本網(wǎng)網(wǎng)關或本網(wǎng)IP地址擎析,這樣的是為了檢查硬件設備是否有問題,也可以檢查本機與本地網(wǎng)絡連接是否正常;(在非局域網(wǎng)中這一步驟可以忽略)
- Ping本地DNS地址挥下,這樣做是為了檢查DNS是否能夠?qū)P正確解析揍魂。
注:/etc/resolv.conf
文件,“nameserver 10.0.0.211”指定了dns服務器的地址 - Ping遠程IP地址棚瘟,這主要是檢查本網(wǎng)或本機與外部的連接是否正常现斋。
mtr
- mtr - a network diagnostic tool
cc@MyLinux:~$ mtr -n -i 1 -c 100 www.baidu.com
- -n 不解析主機
--no-dns Use this option to force mtr to display numeric IP numbers and not try to resolve the host names. - -i 時間間隔
--interval SECONDS Use this option to specify the positive number of seconds between ICMP ECHO requests. The default value for this parameter is one second. The root user may choose values between zero and one. - -c 發(fā)送的次數(shù)
--report-cycles COUNT Use this option to set the number of pings sent to determine both the machines on the network and the reliability of those machines. Each cycle lasts one second.
每列顯示信息:
Host 主機IP或主機名
Loss 丟包率
Snt 發(fā)送的次數(shù)
Last 最近一次的返回時延
Avg 平均值
Best 最短的一次時間
Wrst 最長的一次時間
StDev 標準偏差
不動態(tài)顯示,直接顯示最后報告 -r
mtr -rw www.baidu.com
cc@MyLinux:~$ mtr -rw www.baidu.com
Start: Mon Mar 20 08:17:08 2017
HOST: MyLinux Loss% Snt Last Avg Best Wrst StDev
1.|-- 192.168.0.1 0.0% 10 1.7 2.6 1.6 5.8 1.2
2.|-- 192.168.1.1 0.0% 10 2.1 3.1 2.0 9.3 2.2
3.|-- 100.66.0.1 0.0% 10 6.5 6.8 3.2 12.8 2.8
4.|-- 139.226.204.189 0.0% 10 6.7 6.6 5.3 8.7 0.9
5.|-- 139.226.225.157 20.0% 10 5.3 6.7 4.3 9.1 1.4
6.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
7.|-- 124.65.194.158 0.0% 10 31.4 31.0 28.9 33.3 1.4
8.|-- 124.65.58.54 0.0% 10 27.7 64.4 26.2 175.2 44.8
9.|-- 123.125.248.46 0.0% 10 27.6 29.3 27.2 33.1 2.0
10.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
11.|-- ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
12.|-- 61.135.169.121 0.0% 10 26.4 27.0 26.4 27.9 0.0
mtr 查看步驟
1.mtr 的功能是檢查在目的地址有丟包的情況下偎蘸,查出具體在哪一跳丟包庄蹋,然后反饋給機房,機房再反饋給運營商迷雪;
2.看mtr 的截圖 先看最后的目的地址是否有丟包限书,若最后一跳沒有丟包,說明線路ok;若最后一跳有丟包章咧,往下看倦西;
3.再看在路由情況,第一次丟包發(fā)生在哪一跳赁严,對應的查這一跳的丟包情況即可扰柠。
4.從圖中可以看出,最后一跳有丟包且第一次丟包發(fā)生在第5跳(202.97.33.230)疼约;
5.整理下郵件卤档,發(fā)給機房那邊,麻煩他們反饋給上海電信運營商程剥,等待他們處理.