{"id":197,"date":"2019-01-12T23:38:30","date_gmt":"2019-01-13T07:38:30","guid":{"rendered":"http:\/\/35.243.195.209\/?p=197"},"modified":"2021-04-19T19:28:26","modified_gmt":"2021-04-20T02:28:26","slug":"ping-a-specific-port-of-a-host","status":"publish","type":"post","link":"https:\/\/nanzhou.cc\/index.php\/2019\/01\/12\/ping-a-specific-port-of-a-host\/","title":{"rendered":"Ping a Specific Port of a Host"},"content":{"rendered":"<h2>Summary<\/h2>\n<p>In this post, I will introduce how to &#8220;ping&#8221; a specific port in a host.<\/p>\n<h2>Details<\/h2>\n<p>Usually to test the connectivity, we will use the command <code>ping<\/code>. However, ping will typically send ICMP ECHO_REQUEST packets to network hosts. In ICMP, there are no ports. But in many cases (especially when we have a server and wanner refactor the firewall options), we want to know that a port is open, closed, or filtered.<\/p>\n<p>Luckily we have the powerful tool <a href=\"https:\/\/nmap.org\">nmap<\/a>, which works cross platform. We can easily download it by <code>apt-get<\/code> or <code>brew<\/code>.<\/p>\n<p>We present typical examples below.<\/p>\n<pre><code class=\"bash\">FighterNandeMBP:~$ nmap 116.85.33.228 -p 22\nStarting Nmap 7.70 ( https:\/\/nmap.org ) at 2019-01-12 23:33 PST\nNmap scan report for 116.85.33.228\nHost is up (0.34s latency).\n\nPORT   STATE SERVICE\n22\/tcp open  ssh\n\nNmap done: 1 IP address (1 host up) scanned in 0.90 seconds\nFighterNandeMBP:~$ nmap 116.85.33.228 -p 3306\nStarting Nmap 7.70 ( https:\/\/nmap.org ) at 2019-01-12 23:34 PST\nNmap scan report for 116.85.33.228\nHost is up (0.32s latency).\n\nPORT     STATE SERVICE\n3306\/tcp open  mysql\n\nNmap done: 1 IP address (1 host up) scanned in 3.28 seconds\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Summary In this post, I will introduce how to &#8220;ping&#8221; a specific port in a host. Details Usually to test the connectivity, we will use the command ping. However, ping will typically send ICMP ECHO_REQUEST packets to network hosts. In ICMP, there are no ports. But in many cases (especially when we have a server&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-197","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/posts\/197","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/comments?post=197"}],"version-history":[{"count":3,"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/posts\/197\/revisions"}],"predecessor-version":[{"id":1593,"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/posts\/197\/revisions\/1593"}],"wp:attachment":[{"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/media?parent=197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/categories?post=197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/tags?post=197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}