Port already in use?
-
Hello,
I’m trying to set up Monocle Gateway, but Alexa can’t show my cameras.
I think the port 443 is already in use on my machine by node-red.
How to solve the issue?
ThanksJul 31 21:39:43 homeserver systemd[1]: Started Monocle Gateway Service. Jul 31 21:39:43 homeserver monocle-gateway[18842]: ****************************************************************** Jul 31 21:39:43 homeserver monocle-gateway[18842]: * __ __ ___ _ _ ___ ___ _ ___ * Jul 31 21:39:43 homeserver monocle-gateway[18842]: * | \/ |/ _ \| \| |/ _ \ / __| | | __| * Jul 31 21:39:43 homeserver monocle-gateway[18842]: * | |\/| | (_) | .` | (_) | (__| |__| _| * Jul 31 21:39:43 homeserver monocle-gateway[18842]: * |_| |_|\___/|_|\_|\___/ \___|____|___| * Jul 31 21:39:43 homeserver monocle-gateway[18842]: * * Jul 31 21:39:43 homeserver monocle-gateway[18842]: ****************************************************************** Jul 31 21:39:44 homeserver monocle-gateway[18842]: ------------------------------------------------- Jul 31 21:39:44 homeserver monocle-gateway[18842]: MONOCLE RUNTIME ENVIRONMENT Jul 31 21:39:44 homeserver monocle-gateway[18842]: ------------------------------------------------- Jul 31 21:39:44 homeserver monocle-gateway[18842]: VERSION = 0.0.4 Jul 31 21:39:44 homeserver monocle-gateway[18842]: OS/ARCH = linux/x64 Jul 31 21:39:44 homeserver monocle-gateway[18842]: PROCESS = monocle-gateway (PID=18842) Jul 31 21:39:44 homeserver monocle-gateway[18842]: TIMESTAMP = 2019-07-31T19:39:44.384Z Jul 31 21:39:44 homeserver monocle-gateway[18842]: ------------------------------------------------- Jul 31 21:39:44 homeserver monocle-gateway[18842]: MONOCLE GATEWAY SERVICE (Version: 0.0.4) Jul 31 21:39:44 homeserver monocle-gateway[18842]: ------------------------------------------------- Jul 31 21:39:44 homeserver monocle-gateway[18842]: [Monocle Starting] Jul 31 21:39:44 homeserver monocle-gateway[18842]: [Monocle Connecting] Jul 31 21:39:44 homeserver monocle-gateway[18842]: [Monocle Started] Jul 31 21:39:44 homeserver monocle-gateway[18842]: [RTSP Server Starting] Jul 31 21:39:44 homeserver monocle-gateway[18842]: [RTSP Server Listening] 0.0.0.0:8555 (RTSP) Jul 31 21:39:44 homeserver monocle-gateway[18842]: [RTSP Server Listening] 0.0.0.0:443 (RTSP-TLS) Jul 31 21:39:44 homeserver monocle-gateway[18842]: [RTSP Proxy Started] (PID=18861) Jul 31 21:39:44 homeserver monocle-gateway[18842]: [RTSP Server Listening] 0.0.0.0:8554 (PROXY) Jul 31 21:39:44 homeserver monocle-gateway[18842]: [RTSP Server Started] Jul 31 21:39:44 homeserver monocle-gateway[18842]: 2019-07-31T19:39:44.507Z [ERROR] [PROXY SERVER ERROR] Error: listen EADDRINUSE 0.0.0.0:443 Jul 31 21:39:44 homeserver monocle-gateway[18842]: [ '[PROXY SERVER ERROR]', Jul 31 21:39:44 homeserver monocle-gateway[18842]: { Error: listen EADDRINUSE 0.0.0.0:443 Jul 31 21:39:44 homeserver monocle-gateway[18842]: at Object._errnoException (util.js:1031:13) Jul 31 21:39:44 homeserver monocle-gateway[18842]: at _exceptionWithHostPort (util.js:1052:20) Jul 31 21:39:44 homeserver monocle-gateway[18842]: at Server.setupListenHandle [as _listen2] (net.js:1367:14) Jul 31 21:39:44 homeserver monocle-gateway[18842]: at listenInCluster (net.js:1408:12) Jul 31 21:39:44 homeserver monocle-gateway[18842]: at doListen (net.js:1523:7) Jul 31 21:39:44 homeserver monocle-gateway[18842]: at _combinedTickCallback (internal/process/next_tick.js:141:11) Jul 31 21:39:44 homeserver monocle-gateway[18842]: at process._tickCallback (internal/process/next_tick.js:180:9) Jul 31 21:39:44 homeserver monocle-gateway[18842]: at Function.Module.runMain (pkg/prelude/bootstrap.js:1299:13) Jul 31 21:39:44 homeserver monocle-gateway[18842]: at startup (bootstrap_node.js:227:16) Jul 31 21:39:44 homeserver monocle-gateway[18842]: at bootstrap_node.js:649:3 Jul 31 21:39:44 homeserver monocle-gateway[18842]: errno: 'EADDRINUSE', Jul 31 21:39:44 homeserver monocle-gateway[18842]: code: 'EADDRINUSE', Jul 31 21:39:44 homeserver monocle-gateway[18842]: syscall: 'listen', Jul 31 21:39:44 homeserver monocle-gateway[18842]: address: '0.0.0.0', Jul 31 21:39:44 homeserver monocle-gateway[18842]: port: 443 } ] Jul 31 21:39:44 homeserver monocle-gateway[18842]: 2019-07-31T19:39:44.526Z [ERROR] [RTSP Server Error] listen EADDRINUSE 0.0.0.0:443 Jul 31 21:39:44 homeserver monocle-gateway[18842]: [ '[RTSP Server Error]', 'listen EADDRINUSE 0.0.0.0:443' ] Jul 31 21:39:44 homeserver monocle-gateway[18842]: [Monocle Connected] Jul 31 21:39:44 homeserver monocle-gateway[18842]: [RTSP Server Registered] Jul 31 21:39:45 homeserver monocle-gateway[18842]: ------------------------------------------------- Jul 31 21:39:45 homeserver monocle-gateway[18842]: MONOCLE RTSP SERVICE - INITIALIZED Jul 31 21:39:45 homeserver monocle-gateway[18842]: ------------------------------------------------- Jul 31 21:39:45 homeserver monocle-gateway[18842]: FQDN = a49b87ea-d059-44c5-900f-7a3b4123a9e1.mproxy.io Jul 31 21:39:45 homeserver monocle-gateway[18842]: HOST = 192.168.178.10 Jul 31 21:39:45 homeserver monocle-gateway[18842]: PORT = 443 Jul 31 21:39:45 homeserver monocle-gateway[18842]: -------------------------------------------------
-
You can check to see what processes are already using port 443 using the following command:
(ref: https://www.cyberciti.biz/faq/unix-linux-check-if-port-is-in-use-command/)$ sudo lsof -i -P -n | grep LISTEN uv4l 334 root 4u IPv4 13349 0t0 TCP *:8080 (LISTEN) sshd 463 root 3u IPv4 11156 0t0 TCP *:22 (LISTEN) sshd 463 root 4u IPv6 11158 0t0 TCP *:22 (LISTEN) monocle-g 759 monocle 13u IPv4 489943 0t0 TCP *:8555 (LISTEN) monocle-g 759 monocle 15u IPv4 489944 0t0 TCP *:443 (LISTEN) monocle-p 774 monocle 3u IPv4 495953 0t0 TCP *:8554 (LISTEN)
If something else is already using port 443, you will need to change that application to use an alternate port.
Monocle Gateway requires port 443 because Alexa device will only connect to stream on port 443. (and we need Alexa to connect to the gateway.)
Other options would be to move the gateway to another server. Add an additional IP interface (or simply assign a secondary IP) so that Monocle get’s its own dedicated network/IP to listen on and the other app can remain on the existing. Docker containers, Virtual servers, etc. All these options of course require a little more advanced setup and networking knowledge to make sure you get it all configured correctly.
Let us know how it goes and which path you are going to try.
Thanks, Robert
-
Hey Robert,
thanks for your reply. In fact, another service was active at 443. I stopped it and the error message above does not come anymore. Unfortunately, Alexa still can not see my camera. I do not know where to look, why the camera does not work.I would like to move the gateway to a Docker container, which gets its own IP address on my server. Is there somewhere a guide? I think that will also interest many other people.
Thanks! :)
-
For Docker images of Monocle Gateway, please see:
- https://monoclecam.com/monocle-gateway/install/docker
- https://hub.docker.com/r/monoclecam/monocle-gateway
These are based on Alpine images. Pay close attention to the networking notes, the networking mode is very important for the Monocle Gateway.
Honestly, I would try to get it working first before going the Docker route. Once you have your cameras at least working, then you can move it into a Docker container.
Any log data from the now listening Monocle Gateway as you ask Alexa for a camera stream?
Thanks, Robert
-
This is the tail, when I ask my Echo Show 5 for the camera:
Aug 05 18:55:31 homeserver systemd[1]: Started Monocle Gateway Service. Aug 05 18:55:31 homeserver monocle-gateway[29981]: ****************************************************************** Aug 05 18:55:31 homeserver monocle-gateway[29981]: * __ __ ___ _ _ ___ ___ _ ___ * Aug 05 18:55:31 homeserver monocle-gateway[29981]: * | \/ |/ _ \| \| |/ _ \ / __| | | __| * Aug 05 18:55:31 homeserver monocle-gateway[29981]: * | |\/| | (_) | .` | (_) | (__| |__| _| * Aug 05 18:55:31 homeserver monocle-gateway[29981]: * |_| |_|\___/|_|\_|\___/ \___|____|___| * Aug 05 18:55:31 homeserver monocle-gateway[29981]: * * Aug 05 18:55:31 homeserver monocle-gateway[29981]: ****************************************************************** Aug 05 18:55:32 homeserver monocle-gateway[29981]: ------------------------------------------------- Aug 05 18:55:32 homeserver monocle-gateway[29981]: MONOCLE RUNTIME ENVIRONMENT Aug 05 18:55:32 homeserver monocle-gateway[29981]: ------------------------------------------------- Aug 05 18:55:32 homeserver monocle-gateway[29981]: VERSION = 0.0.4 Aug 05 18:55:32 homeserver monocle-gateway[29981]: OS/ARCH = linux/x64 Aug 05 18:55:32 homeserver monocle-gateway[29981]: PROCESS = monocle-gateway (PID=29981) Aug 05 18:55:32 homeserver monocle-gateway[29981]: TIMESTAMP = 2019-08-05T16:55:32.039Z Aug 05 18:55:32 homeserver monocle-gateway[29981]: ------------------------------------------------- Aug 05 18:55:32 homeserver monocle-gateway[29981]: MONOCLE GATEWAY SERVICE (Version: 0.0.4) Aug 05 18:55:32 homeserver monocle-gateway[29981]: ------------------------------------------------- Aug 05 18:55:32 homeserver monocle-gateway[29981]: [Monocle Starting] Aug 05 18:55:32 homeserver monocle-gateway[29981]: [Monocle Connecting] Aug 05 18:55:32 homeserver monocle-gateway[29981]: [Monocle Started] Aug 05 18:55:32 homeserver monocle-gateway[29981]: [RTSP Server Starting] Aug 05 18:55:32 homeserver monocle-gateway[29981]: [RTSP Server Listening] 0.0.0.0:8555 (RTSP) Aug 05 18:55:32 homeserver monocle-gateway[29981]: [RTSP Server Listening] 0.0.0.0:443 (RTSP-TLS) Aug 05 18:55:32 homeserver monocle-gateway[29981]: [RTSP Proxy Started] (PID=29993) Aug 05 18:55:32 homeserver monocle-gateway[29981]: [RTSP Server Listening] 0.0.0.0:8554 (PROXY) Aug 05 18:55:32 homeserver monocle-gateway[29981]: [RTSP Server Started] Aug 05 18:55:32 homeserver monocle-gateway[29981]: [Monocle Connected] Aug 05 18:55:32 homeserver monocle-gateway[29981]: [RTSP Server Registered] Aug 05 18:55:32 homeserver monocle-gateway[29981]: ------------------------------------------------- Aug 05 18:55:32 homeserver monocle-gateway[29981]: MONOCLE RTSP SERVICE - INITIALIZED Aug 05 18:55:32 homeserver monocle-gateway[29981]: ------------------------------------------------- Aug 05 18:55:32 homeserver monocle-gateway[29981]: FQDN = a49b87ea-d059-44c5-900f-7a3b4123a9e1.mproxy.io Aug 05 18:55:32 homeserver monocle-gateway[29981]: HOST = 192.168.178.10 Aug 05 18:55:32 homeserver monocle-gateway[29981]: PORT = 443 Aug 05 18:55:32 homeserver monocle-gateway[29981]: ------------------------------------------------- Aug 05 18:55:54 homeserver monocle-gateway[29981]: ------------------------------------------------- Aug 05 18:55:54 homeserver monocle-gateway[29981]: INITIALIZE RTSP STREAM: Kamera Eingang Aug 05 18:55:54 homeserver monocle-gateway[29981]: ------------------------------------------------- Aug 05 18:55:54 homeserver monocle-gateway[29981]: - NAME : Kamera Eingang Aug 05 18:55:54 homeserver monocle-gateway[29981]: - LABEL : PRIMARY Aug 05 18:55:54 homeserver monocle-gateway[29981]: - URL : rtsp://192.168.178.19:554/11 Aug 05 18:55:54 homeserver monocle-gateway[29981]: - UUID : STREAM:3b68dfe7-6a05-4d42-be13-da1bd4215fc6 Aug 05 18:55:54 homeserver monocle-gateway[29981]: - SESS : c22d9df3-d3e5-4349-929c-47ce4468df52 Aug 05 18:55:54 homeserver monocle-gateway[29981]: - MODIF : Mon Aug 05 2019 18:53:00 GMT+0200 (CEST) Aug 05 18:55:54 homeserver monocle-gateway[29981]: - TAGS : @noaudio,@proxy-tcp Aug 05 18:55:54 homeserver monocle-gateway[29981]: ------------------------------------------------- Aug 05 18:55:54 homeserver monocle-gateway[29981]: 2019-08-05T16:55:54.588Z [INFO] [RTSP PROXY] REGISTERING STREAM [Kamera Eingang/PRIMARY]; (STREAM:3b68dfe7-6a05-4d42-be13-da1bd4215fc6) Aug 05 18:55:54 homeserver monocle-gateway[29981]: 2019-08-05T16:55:54.600Z [DEBUG] <RTSP-PROXY> [REQUEST] --> [REGISTER] rtsp://192.168.178.19:554/11 Aug 05 18:55:54 homeserver monocle-gateway[29981]: 2019-08-05T16:55:54.600Z [TRACE] <RTSP-PROXY> [REQUEST] --> [HEADERS] { Aug 05 18:55:54 homeserver monocle-gateway[29981]: "cseq": "1", Aug 05 18:55:54 homeserver monocle-gateway[29981]: "transport": "reuse_connection=0;preferred_delivery_protocol=interleaved;proxy_url_suffix=STREAM:3b68dfe7-6a05-4d42-be13-da1bd4215fc6;username=admin;password=hailer05" Aug 05 18:55:54 homeserver monocle-gateway[29981]: } Aug 05 18:55:54 homeserver monocle-gateway[29981]: 2019-08-05T16:55:54.601Z [DEBUG] <RTSP-PROXY> [RESPONSE] <-- [200 (OK)] <cseq=1> (session=undefined) Aug 05 18:55:54 homeserver monocle-gateway[29981]: 2019-08-05T16:55:54.601Z [TRACE] <RTSP-PROXY> [RESPONSE] <-- [HEADERS] { Aug 05 18:55:54 homeserver monocle-gateway[29981]: "cseq": "1", Aug 05 18:55:54 homeserver monocle-gateway[29981]: "date": "Mon, Aug 05 2019 16:55:54 GMT" Aug 05 18:55:54 homeserver monocle-gateway[29981]: } Aug 05 18:55:56 homeserver monocle-gateway[29981]: ------------------------------------------------- Aug 05 18:55:56 homeserver monocle-gateway[29981]: INITIALIZE RTSP STREAM: Kamera Eingang Aug 05 18:55:56 homeserver monocle-gateway[29981]: ------------------------------------------------- Aug 05 18:55:56 homeserver monocle-gateway[29981]: - NAME : Kamera Eingang Aug 05 18:55:56 homeserver monocle-gateway[29981]: - LABEL : PRIMARY Aug 05 18:55:56 homeserver monocle-gateway[29981]: - URL : rtsp://192.168.178.19:554/11 Aug 05 18:55:56 homeserver monocle-gateway[29981]: - UUID : STREAM:3b68dfe7-6a05-4d42-be13-da1bd4215fc6 Aug 05 18:55:56 homeserver monocle-gateway[29981]: - SESS : bae6ded6-dd6b-4c1c-bfc8-a03d5322a053 Aug 05 18:55:56 homeserver monocle-gateway[29981]: - MODIF : Mon Aug 05 2019 18:53:00 GMT+0200 (CEST) Aug 05 18:55:56 homeserver monocle-gateway[29981]: - TAGS : @noaudio,@proxy-tcp Aug 05 18:55:56 homeserver monocle-gateway[29981]: ------------------------------------------------- Aug 05 18:55:57 homeserver monocle-gateway[29981]: ------------------------------------------------- Aug 05 18:55:57 homeserver monocle-gateway[29981]: INITIALIZE RTSP STREAM: Kamera Eingang Aug 05 18:55:57 homeserver monocle-gateway[29981]: ------------------------------------------------- Aug 05 18:55:57 homeserver monocle-gateway[29981]: - NAME : Kamera Eingang Aug 05 18:55:57 homeserver monocle-gateway[29981]: - LABEL : PRIMARY Aug 05 18:55:57 homeserver monocle-gateway[29981]: - URL : rtsp://192.168.178.19:554/11 Aug 05 18:55:57 homeserver monocle-gateway[29981]: - UUID : STREAM:3b68dfe7-6a05-4d42-be13-da1bd4215fc6 Aug 05 18:55:57 homeserver monocle-gateway[29981]: - SESS : d2ea0e9c-f5f5-4da9-a283-32068052ab5a Aug 05 18:55:57 homeserver monocle-gateway[29981]: - MODIF : Mon Aug 05 2019 18:53:00 GMT+0200 (CEST) Aug 05 18:55:57 homeserver monocle-gateway[29981]: - TAGS : @noaudio,@proxy-tcp Aug 05 18:55:57 homeserver monocle-gateway[29981]: -------------------------------------------------
These are my settings in the gateway:
I use Zoneminder on my network to stream my cameras. With the settings here, the image works fine in Zoneminder and VLC. What am I doing wrong?
Thanks!
-
Are you using a Fritzbox on your network?
If so, search the forums for “Fritzbox” and/or “DNS Rebinding” these routers must have some additional configuration to permit the DNS hostname resolution for the Monocle Gateway.If you log, I can see that the camera’s are tagged correctly and we are getting the request from Alexa and notifying your Monocle Gateway instance. What’s missing is the Alexa device making a TCP connection to the gateway to start the stream.
Thanks, Robert
-
Hello!
@Monocle said in Port already in use?:
Monocle Gateway requires port 443 because Alexa device will only connect to stream on port 443. (and we need Alexa to connect to the gateway.)
Does the Camera Requests from Amazon/Alexa connect to :443/api ?
If yes, is it possible to bind the monocle gateway to an other port (and using apache proxypass to rewrite Amazons Request on 443/https) ?
I have used the following in the past for an HA-Bridge setup to achive something similiar (Export various Devices as Hue Devices to Amazon)
/etc/apache2/sites-enabled/000-default.conf -> ProxyPass /api [URL]http://localhost:8080/api[/URL] nocanon ProxyPassReverse /api [URL]http://localhost:8080/api[/URL] ProxyRequests Off Allow EncodedSlashes NoDecode <Proxy [URL]http://localhost:8080/api*[/URL]> Order deny,allow Allow from all </Proxy> load prox in the bash: a2enmod proxy a2enmod proxy_http a2enmod headers
Best,
Jan -
@SchmuFoo (Jan)
Yes, the Alexa devices will only connect via RTSP to port 443.
You can override the SSL hosted port used by Monocle Gateway by overriding thertsp.ssl.port
property inmonocle.properties
as in the example below where port 8443 is used instead.#-------------------------------------- # RTSP SERVICE PROPERTIES #-------------------------------------- rtsp.ssl.port=8443
You can also use a proxy server, but not NGINX or APACHE. You will need a TCP proxy server as the cameras use RTPS and not HTTP. You may be able to use something like
stunnel
,HA Proxy
or maybetraefik
something that does full TCP proxying. In this case you may have to have a valid SSL certificate at the terminating proxy server using your own domain record.If terminating your own SSL cert and providing your own DNS hostname, you would also need to update these properties:
#-------------------------------------- # RTSP SERVICE REGISTRATION OVERRIDES #-------------------------------------- #rtsp.register.fqdn= #rtsp.register.host=
Let me know if this is something you decide to pursue if you run into any trouble perhaps I can help.
Thanks, Robert