Difference between revisions of "Network Utils"

From Wasya Wiki
Jump to: navigation, search
(how to tell if port 80 is listening? What is listening on a particular port?)
 
Line 33: Line 33:
 
=== how to tell if port 80 is listening? What is listening on a particular port? ===
 
=== how to tell if port 80 is listening? What is listening on a particular port? ===
  
netstat -plnt
+
  netstat -plnt
netstat -tunlp
+
  netstat -tunlp
 +
  netstat -an -ptcp | grep LISTEN
  
lsof -nP -i4TCP:$PORT | grep LISTEN
+
  lsof -nP -i4TCP:$PORT | grep LISTEN
lsof -i:1433
+
  lsof -i:1433
 
+
 
+
netstat -an -ptcp | grep LISTEN
+
  
 
=== Port Forward ===
 
=== Port Forward ===

Latest revision as of 00:46, 6 April 2024

ubuntu static ip

From: https://vitux.com/how-to-configure-networking-with-netplan-on-ubuntu/

 ## didn't work
 /etc/netplan/*
 sudo netplan apply
 systemctl restart network-manager
 ## worked
 /etc/network/interfaces
 sudo ifdown enp0s8
 sudo ifup enp0s8


Q&A

Count the number of connections

 netstat -ant | awk '{print $6}' | sort | uniq -c | sort -n

verify connectivity

 nslookup myexampledb.xxxx.us-east-1.rds.amazonaws.com 
 telnet <RDS endpoint> <port number>

network traffic by-process

sudo tcpdump -k NP | grep Sublime

check that a node is pingable in bash

while ! ping -c1 bjjc_spec_22.ubuntu14 &>/dev/null; do :; done ;

how do I know if the system trusts the certificate?

you use curl

how to tell if port 80 is listening? What is listening on a particular port?

 netstat -plnt
 netstat -tunlp
 netstat -an -ptcp | grep LISTEN
 lsof -nP -i4TCP:$PORT | grep LISTEN
 lsof -i:1433

Port Forward

ncat --sh-exec "ncat 10.0.1.117 22" -l 2289
ssh -L 8080:127.0.0.1:8080 -L 8081:127.0.0.1:8081 developer@133.111.111.111

What's running on my ports?

sudo netstat -ltnp
netstat -anp | grep :443 | grep LISTEN

or

 lsof -i -P -n | grep LISTEN

Rename a wireless interface

ip link set wlp5s0 name wlan0

Security

List nodes in the network:

sudo arp-scan -l --interface=wlan0

This is better than wireshark and tcpdump:

ngrep port 3000
ngrep -d any -W byline port 5000

Troubleshoot

RTNETLINK answers: File exists

 sudo ip addr flush dev wlan0