Access NVR from the internet with Mikrotik port forwarding

I had to set up access to a Hikvision NVR on local network. Port forward from the public IP of ISP was done. My job was setting port forwarding on Mikrotik router which was connected to the NVR.

It was a lot of hours wasted until I figured it out from lots of forum reading and YouTube videos watching 😀

/ip firewall filter
add action=dst-nat chain=dstnat dst-address=192.168.100.115 dst-port=58000 \
    protocol=tcp to-addresses=192.168.88.3 to-ports=8000
add action=dst-nat chain=dstnat dst-address=192.168.100.115 dst-port=56911 \
    log=yes protocol=tcp to-addresses=192.168.88.3 to-ports=6911

The dst-address had to be the IP address of the router from the WAN side. Check in Quick Set

Mikrotik NAT port fowarding

Advertisements

Hikvision NVR camera stream watching on LG TV

LG Smart World contains the Smart IPTV app
ss_2018-10-13-11-58-51

What’s needed is creating a m3u playlist file with the RTSP stream URLs

#EXTM3U
#EXTINF:0,group-title="Kamera",Hatso resz
rtsp://admin:PASSWORD@192.168.88.3:6911/Streaming/Channels/101
#EXTINF:0,group-title="Kamera",Utca
rtsp://admin:PASSWORD@192.168.88.3:6911/Streaming/Channels/201

The m3u file can be uploaded via https://siptv.app/mylist/. You could upload it on a shared web hosting or on your own public web server that can realtime provide updated m3u file.

Installing Plex Media Server on a remote host

Finally nailed it. I installed Plex Media Server on a remote host and after visiting the http://REMOTE_HOST_IP:32400/web I had no add server option.

In a forum thread I found the add server URL part, just add #!/setup http://raspi:32400/web/index.html#!/setup
But I got Setup is not allowed for shared servers. error

ss_2018-09-30-08-28-38
Setup is not allowed for shared servers.

I ended up with port forwarding to the remote host
ssh -L 32400:raspi:32400

To be able to add server I had to connect to localhost http://localhost:32400/web/index.html#!/setup

Plex media server setup wizard

More info about troubleshooting remote access is at https://support.plex.tv/articles/200931138-troubleshooting-remote-access/

Traefik test drive Docker container discovery

Simple config for testing Traefik with Docker:

# traefik.toml
debug = true

[api]
entryPoint = 'traefik'
debug = true

[docker]
endpoint = 'unix:///var/run/docker.sock'
domain = 'docker.localhost'
watch = true

Run Traefik in a docker container:

docker run --rm -l traefik -p 8080:8080 -p 80:80 \
    -v $PWD/traefik.toml:/etc/traefik/traefik.toml \
    -v /var/run/docker.sock:/var/run/docker.sock traefik

Fire up one docker compose setup and visit http://localhost:8080

Dual monitor Awesome WM with xrandr

I struggled a couple of days until I figured it out that setting up dual monitor via xrandr is needed after X started and before aweome started, so in between.

The solution was adding xrandr exec line into my .xinitrc

# ~/.xinitrc
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

function VGAConnected {
   ! xrandr | grep "^VGA-1" | grep disconnected
}
if VGAConnected; then
    xrandr --output eDP-1-1 --mode 1920x1080 --primary \
           --output VGA-1-1 --mode 1920x1080 --rotate normal --right-of eDP-1-1
fi

exec awesome -c .config/awesome/rc.lua

to get the screen names (eDP-1-1, VGA-1-1, etc.) just run xrandr without args.