Table of Contents
What you will read?
Opening a TCP port on Kali Linux is useful for hosting services, setting up development tools, or testing penetration tools that require incoming connections.
Step 1: Check if the firewall is enabled
Kali Linux does not always have iptables or ufw enabled by default:
sudo iptables -L
If this returns a list of rules, the firewall is active. Otherwise, it’s empty or minimal.
Step 2: Open a TCP port with iptables
To allow incoming TCP traffic on, for example, port 8080:
sudo iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
You can replace 8080 with the port you want to open.
Step 3: Save your iptables rules
By default, iptables rules are not persistent. To save them:
sudo apt install iptables-persistent
sudo netfilter-persistent save
These commands install and save the firewall rules across reboots.
Step 4: Verify the open port
To check if the port is open and listening:
sudo netstat -tuln | grep 8080
Or, use:
sudo ss -tuln | grep 8080
You should see the port listed if a service is listening on it.
Opening TCP ports in Kali Linux can be done via iptables or ufw. Always make sure to only open necessary ports for security reasons.
Follow DropVPS on Google
Add DropVPS as a preferred source to see our latest VPS guides and tutorials surfaced first in Google Search and AI Overviews.
Need a Linux Server for This?
Run Debian, Ubuntu, or any Linux distro on DropVPS — fast NVMe SSD, full root access, and 24/7 support. Perfect for everything you just read.
- Full Root Access
- Debian & Ubuntu Ready
- 99.99% Uptime
- 24/7 Support
No commitment · Cancel anytime
