How to Open Port in Linux

How to open port in Linux

First, you should disable selinux, edit file /etc/sysconfig/selinux so it looks like this:

SELINUX=disabled
SELINUXTYPE=targeted

Save file and restart system.

Then you can add the new rule to iptables:

iptables -A INPUT -m state --state NEW -p tcp --dport 8080 -j ACCEPT

and restart iptables with /etc/init.d/iptables restart

If it doesn't work you should check other network settings.

Open port on Centos 8

  1. Check port status

    netstat -na | grep 61009
  2. Check port status in iptables

    iptables-save | grep 61009
  3. Add the port

    # vi /etc/services
    service-name port/protocol [aliases ...] [# comment]
  4. Open port in the firewall

    # firewall-cmd --zone=public --add-port=61009/tcp --permanent
    success
    # firewall-cmd --reload
    success
    # iptables-save | grep 61009
    -A IN_public_allow -p tcp -m tcp --dport 61009 -m conntrack --ctstate NEW -j ACCEPT
  5. Check added port status

    lsof -i -P |grep http
    netstat -na |grep 61009

How to open port 80 for node server on local machine?

Paste the output from

netstat -ptuln

command.I think the problem is that your web server runs on local address and can not be reachable for other machines in network.

centos 7 open port is open but not working

In some countries port 5060 is blocked by ISP
what i understand you opened the port in your virtual machine.
you need to open the port in VPS host panel security group as well.



Related Topics



Leave a reply



Submit