時(shí)間:2023-01-30 21:20:02 | 來(lái)源:建站知識(shí)
時(shí)間:2023-01-30 21:20:02 來(lái)源:建站知識(shí)
ping
命令是常用的網(wǎng)絡(luò)命令,它通常用來(lái)測(cè)試與目標(biāo)主機(jī)的連通性,我們經(jīng)常會(huì)說(shuō)“ping 一下某機(jī)器,看是不是開(kāi)著”、不能打開(kāi)網(wǎng)頁(yè)時(shí)會(huì)說(shuō)“你先 ping 網(wǎng)關(guān)地址 192.168.1.1 試試”。ping
探測(cè)到,通過(guò)防火墻設(shè)置了禁止 ping
或者在內(nèi)核參數(shù)中禁止 ping
,這樣就不能通過(guò) ping
確定該主機(jī)是否還處于開(kāi)啟狀態(tài)。ping
和 windows 下的 ping
稍有區(qū)別,linux 下 ping
不會(huì)自動(dòng)終止,需要按 ctrl+c
終止或者用參數(shù)-c
指定要求完成的回應(yīng)次數(shù)。ping [參數(shù)] [主機(jī)名或 IP 地址]
ping 192.168.120.205
輸出:[root@localhost ~]# ping 192.168.120.205PING 192.168.120.205 (192.168.120.205) 56(84) bytes of data.64 bytes from 192.168.120.205: icmp_seq=1 ttl=64 time=0.720 ms64 bytes from 192.168.120.205: icmp_seq=2 ttl=64 time=0.181 ms64 bytes from 192.168.120.205: icmp_seq=3 ttl=64 time=0.191 ms64 bytes from 192.168.120.205: icmp_seq=4 ttl=64 time=0.188 ms64 bytes from 192.168.120.205: icmp_seq=5 ttl=64 time=0.189 ms--- 192.168.120.205 ping statistics ---5 packets transmitted, 5 received, 0% packet loss, time 4000msrtt min/avg/max/mdev = 0.181/0.293/0.720/0.214 ms[root@localhost ~]#
說(shuō)明:ping 192.168.120.202
輸出:[root@localhost ~]# ping 192.168.120.202PING 192.168.120.202 (192.168.120.202) 56(84) bytes of data.From 192.168.120.204 icmp_seq=1 Destination Host UnreachableFrom 192.168.120.204 icmp_seq=2 Destination Host UnreachableFrom 192.168.120.204 icmp_seq=3 Destination Host UnreachableFrom 192.168.120.204 icmp_seq=4 Destination Host UnreachableFrom 192.168.120.204 icmp_seq=5 Destination Host UnreachableFrom 192.168.120.204 icmp_seq=6 Destination Host Unreachable--- 192.168.120.202 ping statistics ---8 packets transmitted, 0 received, +6 errors, 100% packet loss, time 7005ms, pipe 4[root@localhost ~]#
說(shuō)明:ping -b 192.168.120.1
輸出:[root@localhost ~]# routeKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface192.168.120.0 * 255.255.255.0 U 0 0 0 eth0192.168.0.0 192.168.120.1 255.255.0.0 UG 0 0 0 eth010.0.0.0 192.168.120.1 255.0.0.0 UG 0 0 0 eth0default 192.168.120.240 0.0.0.0 UG 0 0 0 eth0[root@localhost ~]# ping -b 192.168.120.1PING 192.168.120.1 (192.168.120.1) 56(84) bytes of data.64 bytes from 192.168.120.1: icmp_seq=1 ttl=255 time=2.02 ms64 bytes from 192.168.120.1: icmp_seq=2 ttl=255 time=1.83 ms64 bytes from 192.168.120.1: icmp_seq=3 ttl=255 time=1.68 ms64 bytes from 192.168.120.1: icmp_seq=4 ttl=255 time=1.98 ms64 bytes from 192.168.120.1: icmp_seq=5 ttl=255 time=1.88 ms--- 192.168.120.1 ping statistics ---5 packets transmitted, 5 received, 0% packet loss, time 4000msrtt min/avg/max/mdev = 1.682/1.880/2.020/0.129 ms
說(shuō)明:ping -c 10 192.168.120.206
輸出:[root@localhost ~]# ping -c 10 192.168.120.206PING 192.168.120.206 (192.168.120.206) 56(84) bytes of data.64 bytes from 192.168.120.206: icmp_seq=1 ttl=64 time=1.25 ms64 bytes from 192.168.120.206: icmp_seq=2 ttl=64 time=0.260 ms64 bytes from 192.168.120.206: icmp_seq=3 ttl=64 time=0.242 ms64 bytes from 192.168.120.206: icmp_seq=4 ttl=64 time=0.271 ms64 bytes from 192.168.120.206: icmp_seq=5 ttl=64 time=0.274 ms64 bytes from 192.168.120.206: icmp_seq=6 ttl=64 time=0.295 ms64 bytes from 192.168.120.206: icmp_seq=7 ttl=64 time=0.269 ms64 bytes from 192.168.120.206: icmp_seq=8 ttl=64 time=0.270 ms64 bytes from 192.168.120.206: icmp_seq=9 ttl=64 time=0.253 ms64 bytes from 192.168.120.206: icmp_seq=10 ttl=64 time=0.289 ms--- 192.168.120.206 ping statistics ---10 packets transmitted, 10 received, 0% packet loss, time 9000msrtt min/avg/max/mdev = 0.242/0.367/1.251/0.295 ms[root@localhost ~]#
說(shuō)明:ping -c 10 -i 0.5 192.168.120.206
輸出:[root@localhost ~]# ping -c 10 -i 0.5 192.168.120.206PING 192.168.120.206 (192.168.120.206) 56(84) bytes of data.64 bytes from 192.168.120.206: icmp_seq=1 ttl=64 time=1.24 ms64 bytes from 192.168.120.206: icmp_seq=2 ttl=64 time=0.235 ms64 bytes from 192.168.120.206: icmp_seq=3 ttl=64 time=0.244 ms64 bytes from 192.168.120.206: icmp_seq=4 ttl=64 time=0.300 ms64 bytes from 192.168.120.206: icmp_seq=5 ttl=64 time=0.255 ms64 bytes from 192.168.120.206: icmp_seq=6 ttl=64 time=0.264 ms64 bytes from 192.168.120.206: icmp_seq=7 ttl=64 time=0.263 ms64 bytes from 192.168.120.206: icmp_seq=8 ttl=64 time=0.331 ms64 bytes from 192.168.120.206: icmp_seq=9 ttl=64 time=0.247 ms64 bytes from 192.168.120.206: icmp_seq=10 ttl=64 time=0.244 ms--- 192.168.120.206 ping statistics ---10 packets transmitted, 10 received, 0% packet loss, time 4499msrtt min/avg/max/mdev = 0.235/0.362/1.241/0.294 ms[root@localhost ~]# ping -c 10 -i 0.01 192.168.120.206PING 192.168.120.206 (192.168.120.206) 56(84) bytes of data.64 bytes from 192.168.120.206: icmp_seq=1 ttl=64 time=0.244 ms64 bytes from 192.168.120.206: icmp_seq=2 ttl=64 time=0.195 ms64 bytes from 192.168.120.206: icmp_seq=3 ttl=64 time=0.219 ms64 bytes from 192.168.120.206: icmp_seq=4 ttl=64 time=0.204 ms64 bytes from 192.168.120.206: icmp_seq=5 ttl=64 time=3.56 ms64 bytes from 192.168.120.206: icmp_seq=6 ttl=64 time=1.93 ms64 bytes from 192.168.120.206: icmp_seq=7 ttl=64 time=0.193 ms64 bytes from 192.168.120.206: icmp_seq=8 ttl=64 time=0.193 ms64 bytes from 192.168.120.206: icmp_seq=9 ttl=64 time=0.202 ms64 bytes from 192.168.120.206: icmp_seq=10 ttl=64 time=0.211 ms--- 192.168.120.206 ping statistics ---10 packets transmitted, 10 received, 0% packet loss, time 90msrtt min/avg/max/mdev = 0.193/0.716/3.564/1.080 ms[root@localhost ~]#
說(shuō)明:ping -c 5 www.58.com
輸出:peida-VirtualBox ~ # ping -c 5 www.58.comPING www.58.com (211.151.111.30) 56(84) bytes of data.64 bytes from 211.151.111.30: icmp_req=1 ttl=49 time=14.7 ms64 bytes from 211.151.111.30: icmp_req=2 ttl=49 time=16.4 ms64 bytes from 211.151.111.30: icmp_req=3 ttl=49 time=15.2 ms64 bytes from 211.151.111.30: icmp_req=4 ttl=49 time=14.6 ms64 bytes from 211.151.111.30: icmp_req=5 ttl=49 time=19.9 ms--- www.58.com ping statistics ---5 packets transmitted, 5 received, 0% packet loss, time 20101msrtt min/avg/max/mdev = 14.618/16.192/19.917/1.965 mspeida-VirtualBox ~ #
說(shuō)明:ping -i 3 -s 1024 -t 255 192.168.120.206
輸出:[root@localhost ~]# ping -i 3 -s 1024 -t 255 192.168.120.206PING 192.168.120.206 (192.168.120.206) 1024(1052) bytes of data.1032 bytes from 192.168.120.206: icmp_seq=1 ttl=64 time=1.99 ms1032 bytes from 192.168.120.206: icmp_seq=2 ttl=64 time=0.694 ms1032 bytes from 192.168.120.206: icmp_seq=3 ttl=64 time=0.300 ms1032 bytes from 192.168.120.206: icmp_seq=4 ttl=64 time=0.481 ms1032 bytes from 192.168.120.206: icmp_seq=5 ttl=64 time=0.415 ms1032 bytes from 192.168.120.206: icmp_seq=6 ttl=64 time=0.600 ms1032 bytes from 192.168.120.206: icmp_seq=7 ttl=64 time=0.411 ms1032 bytes from 192.168.120.206: icmp_seq=8 ttl=64 time=0.281 ms1032 bytes from 192.168.120.206: icmp_seq=9 ttl=64 time=0.318 ms1032 bytes from 192.168.120.206: icmp_seq=10 ttl=64 time=0.362 ms1032 bytes from 192.168.120.206: icmp_seq=11 ttl=64 time=0.408 ms1032 bytes from 192.168.120.206: icmp_seq=12 ttl=64 time=0.445 ms1032 bytes from 192.168.120.206: icmp_seq=13 ttl=64 time=0.397 ms1032 bytes from 192.168.120.206: icmp_seq=14 ttl=64 time=0.406 ms1032 bytes from 192.168.120.206: icmp_seq=15 ttl=64 time=0.458 ms--- 192.168.120.206 ping statistics ---15 packets transmitted, 15 received, 0% packet loss, time 41999msrtt min/avg/max/mdev = 0.281/0.531/1.993/0.404 ms[root@localhost ~]#
說(shuō)明:關(guān)鍵詞:命令
客戶&案例
營(yíng)銷資訊
關(guān)于我們
客戶&案例
營(yíng)銷資訊
關(guān)于我們
微信公眾號(hào)
版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。