LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-19-2014, 01:26 PM   #1
nasridine
Member
 
Registered: Jan 2010
Posts: 52

Rep: Reputation: 15
how to open port 8080 for listening when firewall is not running


We have an internal cluster that runs on Centos. We do not turn on iptables purposefully. I am developing some web application which needs to talk to localhost through port 8080. However telnet 127.0.0.1:8080 could not connect. Is there a way to open port 8080 for listening without messing with the firewall?

We do not intend to turn on firewall. So commands like this is not an option:
iptables -A INPUT -m state --state NEW -p tcp --dport 8080 -j ACCEPT
 
Old 09-19-2014, 01:36 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
There has to be some application listening for connections on port 8080, what do you want that application to be/do?
 
Old 09-19-2014, 01:37 PM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
What's listening on 8080?
Something has to 'answer' for
Code:
telnet 127.0.0.1 8080
to 'work'.

Code:
lsof -i :8080
can be used to show what's serving on port 8080
 
Old 09-19-2014, 01:44 PM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,325

Rep: Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919
i would set the port number in /etc/ssh/sshd_config to 8080 then restart sshd.

or maybe hax something up like this:
Code:
[schneidz@hyper ~]$ cat ./stuff/netcat.ksh
#!/bin/bash
PL=$(find /root/user/music -name "*.mp3")
NUM=$(echo $PL |wc -w)
{
while true; do
r=$(($RANDOM%$NUM))
s=$(echo $PL |cut -d ' ' -f$r)
echo "HTTP/1.0 200 OK\nContent-Type: audio/x-mp3stream\n\n"
dd if=$s bs=1024
done
} | nc -l -s address -p 8080
 
Old 09-19-2014, 01:44 PM   #5
nasridine
Member
 
Registered: Jan 2010
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by suicidaleggroll View Post
There has to be some application listening for connections on port 8080, what do you want that application to be/do?
I tried to run some simply jersey application which needs to talk to http://localhost:8080
 
Old 09-19-2014, 01:46 PM   #6
nasridine
Member
 
Registered: Jan 2010
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Habitual View Post
What's listening on 8080?
Something has to 'answer' for
Code:
telnet 127.0.0.1 8080
to 'work'.

Code:
lsof -i :8080
can be used to show what's serving on port 8080
connection refused for telnet command. "lsof -i :8080" returns nothing
 
Old 09-19-2014, 01:48 PM   #7
nasridine
Member
 
Registered: Jan 2010
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by schneidz View Post
i would set the port number in /etc/ssh/sshd_config to 8080 then restart sshd.

or maybe hax something up like this:
Code:
[schneidz@hyper ~]$ cat ./stuff/netcat.ksh
#!/bin/bash
PL=$(find /root/user/music -name "*.mp3")
NUM=$(echo $PL |wc -w)
{
while true; do
r=$(($RANDOM%$NUM))
s=$(echo $PL |cut -d ' ' -f$r)
echo "HTTP/1.0 200 OK\nContent-Type: audio/x-mp3stream\n\n"
dd if=$s bs=1024
done
} | nc -l -s address -p 8080
In the current /etc/ssh/sshd_config, Port line is commented out.
 
Old 09-19-2014, 01:48 PM   #8
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,325

Rep: Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919
is telnetd running ?; you should probably try running sshd instead.

^ what happens when you uncomment it (changing it to 8080) and restart the ssh server ?
 
Old 09-19-2014, 01:50 PM   #9
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by nasridine View Post
I tried to run some simply jersey application which needs to talk to http://localhost:8080
localhost:8080 is not a destination, it's a path. There has to be something on the other side of that path for your jersey application to connect to. When you open the connection, your jersey application is not talking to localhost:8080, it's talking to some other application through localhost:8080.

So, what application is it supposed to connect to? telnetd? sshd? apache? some custom program?

Last edited by suicidaleggroll; 09-19-2014 at 01:52 PM.
 
Old 09-19-2014, 01:51 PM   #10
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by schneidz View Post
is telnetd running ?; you should probably try running sshd instead.

^ what happens when you uncomment it (changing it to 8080) and restart the ssh server ?
What leads you to believe it's sshd that he wants to connect to? I haven't seen him mention any server application that he wants to connect to yet, apart maybe from telnetd since that's the client he's trying to use.

Last edited by suicidaleggroll; 09-19-2014 at 01:53 PM.
 
Old 09-19-2014, 01:58 PM   #11
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,325

Rep: Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919Reputation: 919
what is jersey application.

i was answering in general the process to configure any server to listen to a particular port. ssh and netcat just seemed like easy examples.
 
Old 09-19-2014, 02:07 PM   #12
nasridine
Member
 
Registered: Jan 2010
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by suicidaleggroll View Post
localhost:8080 is not a destination, it's a path. There has to be something on the other side of that path for your jersey application to connect to. When you open the connection, your jersey application is not talking to localhost:8080, it's talking to some other application through localhost:8080.

So, what application is it supposed to connect to? telnetd? sshd? apache? some custom program?
Sorry, I did not understand the question. It is connecting to a grizzly container. https://grizzly.java.net/
 
Old 09-19-2014, 02:09 PM   #13
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Have you started this grizzly container, with it configured to listen on port 8080?
 
Old 09-19-2014, 02:22 PM   #14
nasridine
Member
 
Registered: Jan 2010
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by suicidaleggroll View Post
Have you started this grizzly container, with it configured to listen on port 8080?
I don't think I need to configure the Grizzly (or maybe I am wrong). Basically following the Jersey tutorial here.
https://jersey.java.net/nonav/docume...ject-structure

Running this simple example did not have any error. Only when I tried to communicate with the resource using "curl http://localhost:8080/myapp/myresource", it complained "couldn't connect to host".
 
Old 09-19-2014, 02:27 PM   #15
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
You'll need to start up grizzly at some point. The documentation you posted has this little nugget buried in it
Quote:
Now that we have verified that the project compiles and that the unit test passes, we can execute the application in a standalone mode. To do this, run the following maven command:

mvn exec:java

The application starts and you should soon see the following notification in your console:

May 26, 2013 8:08:45 PM org.glassfish.grizzly.http.server.NetworkListener start
INFO: Started listener bound to [localhost:8080]
May 26, 2013 8:08:45 PM org.glassfish.grizzly.http.server.HttpServer start
INFO: [HttpServer] Started.
Jersey app started with WADL available at http://localhost:8080/myapp/application.wadl

Hit enter to stop it...
This informs you that the application has been started and it's WADL descriptor is available at http://localhost:8080/myapp/application.wadl URL. You can retrieve the WADL content by executing a curl http://localhost:8080/myapp/application.wadl command in your console or by typing the WADL URL into your favorite browser.
See the part in bold. Those messages indicate that grizzly has been started and is listening on port 8080.
 
  


Reply

Tags
firewall, iptables


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tomcat6 stops listening on port 80 when i change from port 8080 to port 80 trongthect Linux - Server 1 07-27-2012 05:41 PM
[SOLVED] Tomcat6 stops listening when i change from port 8080 Droa Linux - Server 7 07-26-2012 03:56 PM
My Apache is not listening on port 8080 wachira Linux - Server 2 12-02-2010 02:09 PM
access 8080 web server port through squid running on 8080 sunethj Linux - Networking 11 05-18-2007 02:38 AM
firewall.rc.config says :"open port 8080" but nmap says port is closed saavik Linux - Security 2 02-14-2002 12:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration