赞
踩
- 测试域名:
- # telnet baidu.com 80
- Trying 123.125.114.144...
- Connected to baidu.com (123.125.114.144). #==>出现Connected表示连通了,说
- 明百度的80端口开放的
- Escape character is '^]'. #==>按“ctrl+]”退出此地。
- ^]
- telnet> quit
- Connection closed.
- 测试IP地址:
- # telnet 108.5.16.139 7506
- Trying 108.5.16.139...
- Connected to static-108-5-16-139.nycmny.fios.verizon.net (108.5.16.139). #==>出
- 现Connected表示连通了,说明108.5.16.139的7506端口开放的
- Escape character is '^]'. #==>按“ctrl+]”退出此地
- ^]
- telnet> quit
- Connection closed.
如果写脚本通过telnet检查端口可以用下面的方法:
- # echo -e "\n"|telnet baidu.com 80|grep Connected
- Connection closed by foreign host.
- Connected to baidu.com (123.125.114.144).
- # nmap etiantian.org -p 80
- Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2012-07-22 17:22 PDT
- Interesting ports on 211.100.98.99:
- PORT STATE SERVICE
- 80/tcp open http
- Nmap finished: 1 IP address (1 host up) scanned in 0.417 seconds
如果写脚本通过nmap检查端口可以用下面的方法:
- PORT_COUNT=`nmap $ip_add -p $port|grep open|wc -l`
- [[ $PORT_COUNT -ge 1 ]] && echo "$ip_add $port is ok." || echo "$ip_add $port is unknown."
- # nc -w 10 8.8.8.8 53 && echo ok ||echo no
- ok
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。