Network useful commands

Detect services and ports

  • Linux

    nmap -sn <ip_address>  # ip alive? 
    nmap -sn -Pn <ip_address> # Check for all host online if ip alive
    netstat -tulpn # check your network services udp tcp
    ss -nlptau # check your network services udp tcp
    route -n # gateway, ip 
    ip a # network interfaces
    ip route show or route
    sudo ufw enable # disable or status
    sudo ufw deny from <ip_address> to any port 80
    sudo ufw deny from <ip_address> to any
    
  • Windows

    netstat -an # check services and port
    netsh firewall show state # check firewall state
    netsh firewall show config # check firewall configuration