Skip to content

如何用正确的姿势来Ping

Tags:

有遗漏请补充。

  • Ping
  • Telnet
  • nc
  • nmap
  • nping
  • tcping

Ping

# -c count
ping -c3 www.hostloc.com

Telnet [host] [port]

nc -vz [host] [port]

# -v: verbose
# -z: just scan/don't send any data

nmap – 用于网络主机/端口的扫描

# -v, -vv: increase versbose level
# -A: Enable OS detection, version detection, script scanning, and traceroute
# -p <port ranges>: Only scan specified ports
#   Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080,S:9
# -sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans

# 只ping,不做端口扫描
nmap -v -sn 192.168.0.0/16 10.0.0.0/8
# scan 1 or a few ports on one host
nmap -p 443 www.google.com
nmap -p1-100 www.google.com
# udp scan
nmap -sU -p53 www.google.com
nmap -sU -p1-100 www.google.com

nping

# 可以看到是否有返回,以及来回的时间延迟
nping --tcp -p 443 www.google.com

tcping

apt install tcptraceroute bc
cd /usr/bin
wget -O tcping http://www.vdberg.org/\~richard/tcpping
chmod 755 tcping
tcping -x3 8.8.8.8 53
# 用法:tcpping [-d] [-c] [-C] [-w sec] [-q num] [-x count] ipaddress [port]
# -d 在每个响应时间前,打印时间戳
# -c 以列表形式显示
# -C 输出类似于fping工具中-C选项的结果
# -w 等待时间(默认 3)
# -r 每N秒重试一次(默认 1)
# -x 限定测试总时长 (默认 无限)

Leave a Reply

Your email address will not be published.