{"id":1259,"date":"2018-08-15T08:44:46","date_gmt":"2018-08-15T13:44:46","guid":{"rendered":"http:\/\/blog.ls-al.com\/?p=1259"},"modified":"2018-08-15T08:44:46","modified_gmt":"2018-08-15T13:44:46","slug":"test-tcp-open-port","status":"publish","type":"post","link":"https:\/\/blog.ls-al.com\/test-tcp-open-port\/","title":{"rendered":"Test Tcp Open Port"},"content":{"rendered":"
If you don't have telnet or nc installed and want to quickly test firewall traffic to a server and specific port you can try this. It needs a new enough bash but still pretty quick and handy.<\/p>\n
Good test port is open<\/p>\n
\r\n$ timeout 1 bash -c 'cat < \/dev\/null > \/dev\/tcp\/172.18.10.66\/1521'\r\n$ echo $?\r\n0\r\n<\/pre>\nPort not open<\/p>\n
\r\n$ timeout 1 bash -c 'cat < \/dev\/null > \/dev\/tcp\/172.18.10.66\/15'\r\n$ echo $?\r\n124\r\n<\/pre>\nGood test port is open to google FQDN<\/p>\n
\r\n$ timeout 1 bash -c 'cat < \/dev\/null > \/dev\/tcp\/google.com\/80'\r\n[opc@ocilxeasdbt02 ~]$ echo $?\r\n0\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"If you don’t have telnet or nc installed and want to quickly test firewall traffic to a server and specific<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-1259","post","type-post","status-publish","format-standard","hentry","category-bash"],"_links":{"self":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/1259","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/comments?post=1259"}],"version-history":[{"count":0,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/1259\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/media?parent=1259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/categories?post=1259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/tags?post=1259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}