Lord
Posts: 11
Joined: Sat Mar 18, 2017 12:03 pm

How to allow a port listening on a firewall?

Tue Apr 04, 2017 5:17 pm

Hi

I am trying to setup tcp server on raspberry pi 2.
"Rasbian Jessie with Pixel" os version installed on the device.

How to allow a port listening with "Raspberry Pi 2" on a firewall?
How to configure the firewall?

Thank you

drgeoff
Posts: 10765
Joined: Wed Jan 25, 2012 6:39 pm

Re: How to allow a port listening on a firewall?

Tue Apr 04, 2017 5:29 pm

Where is the firewall?

AFAIK Raspbian Jessie default installation and configuration has no firewall running.

If the firewall is your router's NAT, you need to consult the router's documentation. Usually you want to forward ports 80 and 443 to make a web server accessible from the WAN.

Be sure you understand the security implications.

Lord
Posts: 11
Joined: Sat Mar 18, 2017 12:03 pm

Re: How to allow a port listening on a firewall?

Tue Apr 04, 2017 5:48 pm

I know that the firewall does not come installed. How can I install?

Port has introduced on the router and its running now.

If ServerApp run on the Windows, all systems work because I configured this port on firewall but if ServerApp move from Windows to Raspberry, systems doesn't work on over internet connection. I am trying to solve this problem.

Lord
Posts: 11
Joined: Sat Mar 18, 2017 12:03 pm

Re: How to allow a port listening on a firewall?

Wed Apr 05, 2017 12:29 pm

+Up

Does nobody know?

User avatar
allfox
Posts: 452
Joined: Sat Jun 22, 2013 1:36 pm
Location: Guang Dong, China

Re: How to allow a port listening on a firewall?

Wed Apr 05, 2017 1:39 pm

I think by default, the firewall is already installed, namely the iptables, but by default, it would accept everything. It is exist, but not functioning as a firewall.

I think you should try connect to your App in LAN to make sure it does work.

sudo netstat -lnp would tell you what program is listening to network right now.

Ernst
Posts: 1334
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: How to allow a port listening on a firewall?

Wed Apr 05, 2017 1:49 pm

Lord wrote:I know that the firewall does not come installed. How can I install?

Port has introduced on the router and its running now.

If ServerApp run on the Windows, all systems work because I configured this port on firewall but if ServerApp move from Windows to Raspberry, systems doesn't work on over internet connection. I am trying to solve this problem.
What are you trying to do ? Are you trying to connect from the internet through a router to a Raspberry ?
If yes: did you update the configuration on the router ?
The road to insanity is paved with static ip addresses

Lord
Posts: 11
Joined: Sat Mar 18, 2017 12:03 pm

Re: How to allow a port listening on a firewall?

Wed Apr 05, 2017 2:40 pm

allfox wrote:I think by default, the firewall is already installed, namely the iptables, but by default, it would accept everything. It is exist, but not functioning as a firewall.

I think you should try connect to your App in LAN to make sure it does work.

sudo netstat -lnp would tell you what program is listening to network right now.
I used your code.
I saw my "PORT" that LISTENed by JAVA. (tcp6)

User avatar
allfox
Posts: 452
Joined: Sat Jun 22, 2013 1:36 pm
Location: Guang Dong, China

Re: How to allow a port listening on a firewall?

Wed Apr 05, 2017 3:02 pm

As you said tcp6, if it's not working, then it worth a try to initialize the ServerSocket object with the bind address "0.0.0.0". This should force things run on IPv4. I havn't write Java for years, so just give it a try.

While to my understanding, listening on IPv6 address "::" should handle IPv4 connection either, as those IPv4 connection would get a IPv6 mapping address. However in real would, I did witness Apps which only work with IPv4.

Return to “Troubleshooting”