2-测试网络连接


使用ping命令测试网络连通性

[root@test2 jason]# ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.237 ms
64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=1.11 ms
64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.661 ms
64 bytes from 192.168.0.1: icmp_seq=4 ttl=64 time=0.910 ms
^C
--- 192.168.0.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3429ms
rtt min/avg/max/mdev = 0.237/0.730/1.115/0.328 ms
[root@test2 jason]#

限制ping的次数

[root@test2 jason]# ping -c 3 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.773 ms
64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=1.80 ms
64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=1.38 ms

--- 192.168.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2005ms
rtt min/avg/max/mdev = 0.773/1.321/1.805/0.425 ms
[root@test2 jason]#

-c count

Stop after sending count ECHO_REQUEST packets. With deadline option, 
ping waits for count ECHO_REPLY packets, until the timeout expires.

man ping


使用nslookup命令测试DNS域名解析(实验机为Ubuntu真机)

➜  ~ nslookup www.baidu.com
Server:        127.0.1.1
Address:    127.0.1.1#53

Non-authoritative answer:
www.baidu.com    canonical name = www.a.shifen.com.
Name:    www.a.shifen.com
Address: 61.135.169.125    //解析出来的IP地址
Name:    www.a.shifen.com   
Address: 61.135.169.121    //解析出来的IP地址

➜  ~

man nslookup

man traceroute



results matching ""

    No results matching ""