Advertisement
metalx1000

Server with loopback only using iptables

Apr 14th, 2025
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. # list iptables rules
  2. sudo iptables -L
  3.  
  4. # clear iptables rules
  5. sudo iptables -F INPUT
  6.  
  7. #start server
  8. busybox nc -l -p 8888
  9.  
  10. # connect with client
  11. busybox nc localhost:8888
  12. busybox nc 127.0.0.1:8888
  13. busybox nc 192.168.1.158:8888
  14.  
  15. # block incoming traffic on port 8888
  16. sudo iptables -A INPUT -p tcp --dport 8888 -j REJECT
  17.  
  18. #start server
  19. busybox nc -l -p 8888
  20.  
  21. # connect with client - now only working with localhost
  22. busybox nc localhost:8888
  23. busybox nc 127.0.0.1:8888
  24. busybox nc 192.168.1.158:8888
  25.  
  26.  
  27.  
  28. # clear iptables rules
  29. sudo iptables -F INPUT
  30. # list iptables rules
  31. sudo iptables -L
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement