I have this web application called HaasBot (running on Mono 5) which I want to run on my Raspberry Pi 3 with Raspbian Stretch Lite (Terminal only!) as a server internally in my network only. Using SSH to do this by the way. The Pi has the OS freshly installed, no other things besides than dirmngr (as I recall correctly) and Mono 5 are installed. Iptables was installed by default. The whole OS is updated and upgraded to it*s latest state of course. The web app can not be considered "installed", because it was just a zip file I extracted, so nothing big there. Also no firewall installed, I also own no hardware firewall. We have a fritzbox and a network-security-server in our business network, where I am connected to. But as said, would need to open the port first anyway since it is required anyway before I can start finding the error with the fritzbox or the network-security-server. My own little network runs closed behind the main network where the fritzbox and the network-security-server is sitting infront of. My Wireless Lan router and the LAN hub (Pi connected by LAN cable of course) are just forwarding the connection to my very own little network.
The application itself is running, it needs the port 8090 and 8092. 8090 seems for incoming connections and 8092 for outgoing connections because when I try to access the web application from another computer's browser by typing in http://192.168.1.202:8090/ it loads my splash page, tries to receive data from the internet but doesn't finish doing so. Current state: Still the web app does not receive any data. It is stuck at the splash page where it says "Connecting to Haasonline Trade Server" Also the web app can only be accessed when typing in "http://192.168.1.202:8090/" in the browser, trying "http://192.168.1.202:8092/" doesn't display the web app
Checking for closed ports with
nmap -p 8092 192.168.1.202
it responds with
PORT: 8092/tcp STATE: closed SERVICE: unknown
Checking it with the port 8090 says the port is opened. Update: As of now it still says the port 8092 is closed. Before I can go and find the error somewhere else I would need to get and keep that port opened anyway first.
I did try Google with several differnt searches and asked here and there, but still no luck getting the port 8092 opened. I only know that if I get it opened and everything works, that I need to enter this command to keep it saved in case I need to reboot my Pi:
iptables-save >/etc/iptable
or to restore the default settings I would need to do this:
iptables-restore </etc/iptables
The command to open the port I already tried was:
sudo iptables -A INPUT -p tcp --dport 8092 -j ACCEPT
and it didn't open the port.
I also was told to run this command to open the port which maybe could help:
iptables -t nat -A PREROUTING -i lo -p tcp -d 127.0.0.1 --dport 8092 -j DNAT --to-destination 192.168.1.202:8092
Update this command also didn't do the trick But now I am getting confused of what is right and what is the wrong command and maybe wanted to get it confirmed here how to do it correctly.
Using the command
netstat -tnlp
responds with 3 lines where I find 1 line containing the internal network IP and the port 8090, it goes as following:
PROTO: tcp RECV-Q: 0 SEND-Q: 0 LOCAL ADDRESS: 192.168.1.202:8090 FOREIGN ADDRESS: 0.0.0.0:* STATE: LISTEN PID/Program name: 608/mono
Could anyone shed some light into this? I honestly do not understand these flags from all these commands and would be more comfortable simply editing a file with
sudo nano
to get this iptables thing right. But if not possible and I really get told the correct command, I would also be fine just pasting it into my ssh command window as a 1 liner-command with several flags that are puzzling me.
Thanks to everyone who could help me out with the correct solution and maybe an ELI5 explanation why the first command did not work.
Thanks again!
PS: Displaying the commands as code doesn't quite work for me here on raspberrypi.stackexchange. Also would love to get help for that! Until then hope you guys still can read it.
sudo iptables -L
. It should show three chains with a default policy ofACCEPT
and not much else. If this isn't the case, edit what's there into the question. "Displaying the commands as code doesn't quite work for me" -> Highlight and use the{ }
icon in the editor top bar. There's also a handy?
help icon there, far right.