fkeles

troubleshooting connectivity

Nov 16th, 2025
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.33 KB | Source Code | 0 0
  1. ## find ports listening
  2. netstat -an | grep 8000
  3. netstat -an | grep LISTEN
  4.  
  5. ## test connection
  6. telnet 10.0.3.30 8000
  7.  
  8. ## find ports listening
  9. sudo ss -tulpn | grep 8000
  10. tcp   LISTEN 0      10            0.0.0.0:8000      0.0.0.0:*    users:(("python3",pid=273874,fd=4))
  11.  
  12. ## firewall rules
  13. sudo iptables -L INPUT -n -v
  14. Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
  15.  pkts bytes target     prot opt in     out     source               destination        
  16. 6207K   25G ACCEPT     0    --  *      *       0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
  17.     4   336 ACCEPT     1    --  *      *       0.0.0.0/0            0.0.0.0/0          
  18.  260K   27M ACCEPT     0    --  lo     *       0.0.0.0/0            0.0.0.0/0          
  19.    13   780 ACCEPT     6    --  *      *       0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:22
  20.   247 10680 REJECT     0    --  *      *       0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited
  21.     0     0 ACCEPT     6    --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:8000
  22.     0     0 ACCEPT     6    --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:8000
  23.     0     0 ACCEPT     6    --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:8000
  24.  
  25. ## list firewll rules
  26. sudo iptables -L INPUT --line-numbers -n
  27. Chain INPUT (policy ACCEPT)
  28. num  target     prot opt source               destination        
  29. 1    ACCEPT     6    --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:3000
  30. 2    ACCEPT     0    --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
  31. 3    ACCEPT     1    --  0.0.0.0/0            0.0.0.0/0          
  32. 4    ACCEPT     0    --  0.0.0.0/0            0.0.0.0/0          
  33. 5    ACCEPT     6    --  0.0.0.0/0            0.0.0.0/0            tcp dpt:8000
  34. 6    ACCEPT     6    --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:22
  35. 7    REJECT     0    --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited
  36. 8    ACCEPT     6    --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:3000
  37.  
  38. ## delete line 5
  39. sudo iptables -D INPUT 6
  40.  
  41. ## add new rule above REJECT
  42. sudo iptables -I INPUT 5 -p tcp --dport 8000 -j ACCEPT
  43. sudo netfilter-persistent save
  44.  
  45. ## create server process to listen port 5432
  46. nc -l -p 5432
Advertisement
Add Comment
Please, Sign In to add comment