i need to open a port linux linux whm server

shufil

Well-Known Member
Mar 19, 2014
71
0
6
cPanel Access Level
Root Administrator
Hello,

I need to open port 8080, so I added to two IPtables rules:

iptables -A INPUT -m state --state NEW -m tcp -p tcp -d remoteserverip --dport 8080 -j ACCEPT
iptables -I OUTPUT -p tcp -d remoteserverip --sport 8080 --dport 8080 -j ACCEPT

The port still seems to be closed:
telnet localhost 8080
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused

Please advice .

Regards,
Shufil
 

shufil

Well-Known Member
Mar 19, 2014
71
0
6
cPanel Access Level
Root Administrator
Hello triantech,

CSF is not installed , only running iptable .

Regards,
Shufil

- - - Updated - - -

Hello,
netstat -apn | grep 8080 not give any reply ,
iptables -nL | grep 8080
ACCEPT tcp -- 0.0.0.0/0 remoteip state NEW tcp dpt:8080
ACCEPT tcp -- 0.0.0.0/0 rempteip tcp spt:8080 dpt:8080

Regards,
Shufil
 

shufil

Well-Known Member
Mar 19, 2014
71
0
6
cPanel Access Level
Root Administrator
Hello triantech,

CSF is not installed , only running iptable .

Regards,
Shufil

- - - Updated - - -

Hello,
netstat -apn | grep 8080 not give any reply ,
iptables -nL | grep 8080
ACCEPT tcp -- 0.0.0.0/0 remoteip state NEW tcp dpt:8080
ACCEPT tcp -- 0.0.0.0/0 rempteip tcp spt:8080 dpt:8080

Regards,
Shufil
also i added without -d
iptables -A INPUT ( output both udp and tcp ) -m state --state NEW -m udp -p udp --dport 8080 -j ACCEPT
so result is
iptables -nL | grep 8080
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8080
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 state NEW udp dpt:8080
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8080
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 state NEW udp dpt:8080

Regards,
Shufil
 

shufil

Well-Known Member
Mar 19, 2014
71
0
6
cPanel Access Level
Root Administrator
Shufil,

what exactly is running on that port? iS the service running? If not telnet would be showing
connection refused , as there is nothing running to connect :D
Hi triantech ,

Thanks for reply ,
You mean is this enough for port open , and how can we check a port open or not ?
netstat -apn | grep 8080 , not getting any reply .
 

24x7server

Well-Known Member
Apr 17, 2013
1,912
99
78
India
cPanel Access Level
Root Administrator
Twitter
Hi,

You have added correct rule in firewall to open a port 8080 but currently you are not running any services on port 8080 and due to that netstat command is not showing any output.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,270
463
Hello :)

You will need to ensure a service is listening for connections on port 8080 before it will respond to connection requests. Are you attempting to have a service such as Apache run on port 8080?

Thank you.
 

shufil

Well-Known Member
Mar 19, 2014
71
0
6
cPanel Access Level
Root Administrator
Hi,

You have added correct rule in firewall to open a port 8080 but currently you are not running any services on port 8080 and due to that netstat command is not showing any output.
Hello,

But i try to pass a url with port number 8080 using curl program , but still i getting error that is coult not connect host .
So i believe still that port is close .

- - - Updated - - -

Hello :)

You will need to ensure a service is listening for connections on port 8080 before it will respond to connection requests. Are you attempting to have a service such as Apache run on port 8080?

Thank you.
Hello,

Yes i need to add service http with port number , currently port 80 443 running with http .
 

shufil

Well-Known Member
Mar 19, 2014
71
0
6
cPanel Access Level
Root Administrator
HI Triantech ,

There seems port 80 and 443 in default , if we need to add other port we need to drop 80 or 443 ?

Regards,
Shufil
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,270
463
You can add multiple "Listen" entries in the Apache configuration file. Here is an example of the existing default entries:

Code:
# grep Listen /usr/local/apache/conf/httpd.conf
Listen 0.0.0.0:80
Listen [::]:80
    Listen 0.0.0.0:443
    Listen [::]:443
Documentation on making modifications to the Apache configuration file is available here:

Custom Directives Outside of a VirtualHost Tag

Thank you.
 

shufil

Well-Known Member
Mar 19, 2014
71
0
6
cPanel Access Level
Root Administrator
You can add multiple "Listen" entries in the Apache configuration file. Here is an example of the existing default entries:

Code:
# grep Listen /usr/local/apache/conf/httpd.conf
Listen 0.0.0.0:80
Listen [::]:80
    Listen 0.0.0.0:443
    Listen [::]:443
Documentation on making modifications to the Apache configuration file is available here:

Custom Directives Outside of a VirtualHost Tag

Thank you.

Hello,

Thanks , nice .

Regards,
Shufil