0

Imagine having an unix based system S1 - any common Linux distro with the most common out of the box setup - inside a network setup N1 which features a firewall F1 allowing some ports P1 and P2 forwarding from the internet to the machine through an external IP X1.

After configuring the firewall, you want to test on that clean Linux machine wether after serving some not-already deployed services you will be able to access them on X1:P1 and X1:P2.

Is there anything inside the operating system which will allow me to listen to that ports and help me testing the outbound connection? Any way to ask the OS to handle and reply on those ports? I know unix has built in support for accessing specific ports with virtual devices on a very useful and simple way: cat < /dev/tcp/127.0.0.1/22. Is there anything inverse for listening on the ports? Any built in util which starts a service on an arbitrary port and prints anything to console when receiving some raw data? Any crazy trick like re-setting the ping service to any arbitrary port?


Disclaimer: no, this isn't same as Test if a port on a remote system is reachable (without telnet), on this question the target service is not already deployed, and I want to test reachability despite nothing is listening yet with the aid of the OS.

Áxel Costas Pena
  • 900
  • 4
  • 13
  • 29
  • Define "*built in* util". `netcat` (aka `nc`) is quite standard but you may need to install it. There are at least two implementations. And there is `ncat`; and there is `socat`. – Kamil Maciorowski May 04 '20 at 16:51
  • And what you call a "built in support for accessing specific ports with virtual devices on a very useful and simple way" is probably a feature of your shell, not the OS. Compare [this question](https://unix.stackexchange.com/q/494389/108618). – Kamil Maciorowski May 04 '20 at 16:56
  • @KamilMaciorowski it's a good question, and it was on my head then I wrote the question. When someone asks about how to do some thing on shell he recives answers on this order of precedence: shell native binnaries are always the best option, then, people use to suggest other binnaries which may require installation but are very popular, well known and installed on lots of machines across the workd after a sysadmin has worked on intensive tasks on the machine, and last option are "hey look at this project on github it says it does what you do". – Áxel Costas Pena May 04 '20 at 17:36
  • @KamilMaciorowski I'd love answers of type built in shell binnaries, and will also like a lot answers of commonly used binnaries even if they require installation - telnet is a perfect example - because I don't mind installing them and leave them installed. Won't want to install any unknown software since its only existence on the machine should be studied and documented. So, which words can I use to briefly explain I am looking for those options? Native binnaries and common tools known by everyone. Thank you for advice :) – Áxel Costas Pena May 04 '20 at 17:38

0 Answers0