Bernard Pietraga

3 Simple Linux Networking Tricks

3 linux networking tips

Just 3 simple and useful Linux networking tricks which sometimes can be useful to quickly achieve what you want. This is nothing special, just handy examples.

Get the external IP from within the node

Lets say you have node behind WAF, Load Balancer and 7 proxies. Just make sure you have capability to make egress traffic.

curl ipinfo.io/ip

You got your internet facing IP. If this domain is down, there are a myriad of others online.

Get open ports with lsof

Simple lsof command is all you need.

sudo lsof -nP -iTCP -iUDP

Fuzzy find Operating System of the node

This uses nmap to guess node operating system based on networking stack characteristics. The TCP/IP stack leaks this information.

nmap -O $HOST_IP

nmap docs on this

If you want to make it a bit harder to guess your system, you can do it with eBPF.