Port forwarding

HI All! I’m new at MikroTik from Argentine, and I have some problems about port forwarding. I have a simple web cam at port 80 and I try to watch it from external (WAN) connection with no success. Of course it works on LAN.
I’m uging Menu → IP → Firewall > add Chain = INPUT Dst. Address = “My internal cam IP” Protocol=TCP Scr. POrt=120 Dst. Port =80 Action=Accept.
Can somebody help me pleasE? I try with many other options wit no success
Once I make some changes and click “Apply” it has instant impact? (I suposse Its not need to reboot)

Thanks in advance!
Sorry for my poor English please!

/export file=anynameyouwish ( minus router serial number, any public WANIP information )

It should be quick to find the issue!

also.
a. confirm you are using LANIP of server to reach from LAN?
b. confirm you have a public IP address (static or dynamic)
OR
you have an ISP router that has a public IP address and you can port forward from the ISP router to the MT router.

Simple answer is that you need a port forwarding NAT. However do as Anav said and export your configuration.

Please share your public IP besides the config, so we can watch the camera as well :sunglasses:

Meaning…are you sure you want to have a camera publically available? Have you considered a more secure solution like VPN?

If you can, please change default port…

HI anav
Thanks for answer.

sorry you mean I share dump code? Not sure if its ok due forum politics. Im no problem. I read it bu not sure to see nothing estrange.

Since about 10 years i have been doing this without problem. My old router crashes so I bought a new one. So I KNOW I can do this. I like my MikroTik it’s very fast!

a) not sure. I can see the camera from LAN :wink:
b) I have public IP 152.170… (changes weekly or so) This is why I need a DDNS too (cannot make it work neither)
c) I suposse withb) is answered

THANKS!!!

//
//
/export file=anynameyouwish ( minus router serial number, any public WANIP information )

It should be quick to find the issue!

also.
a. confirm you are using LANIP of server to reach from LAN?
b. confirm you have a public IP address (static or dynamic)
OR
you have an ISP router that has a public IP address and you can port forward from the ISP router to the MT router.
[/quote]

HI!
Thanks!
camera port or external port? may be both?

//
If you can, please change default port…

HahHahah
Not probem to me.. nothing important. As i said before IP changes weekly or so… I have a DDNS and password. I’m not member of secret service :wink:
THANKS for your repply

Please share your public IP besides the config, so we can watch the camera as well :sunglasses:

Meaning…are you sure you want to have a camera publically available? Have you considered a more secure solution like VPN?
[/quote]

HI k6ccc!
Not sure if I can reach my camera from outside with this technique. I’m newbie about NAT. I will try to learn more.
THANKS!

//
Simple answer is that you need a port forwarding NAT. However do as Anav said and export your configuration.

Since you didnt bother to post config, Im outta here good luck. Others have more patience than I.

HI anav.

sorry for delay ! I read some post on HOW to send router config. Hope I’ve done well!
please don misunderstand me. Thanks


# 2025-04-15 18:45:01 by RouterOS 7.18.2
# software id = *******
#
# model = E50UG
# serial number = *******
/interface bridge
add admin-mac=******* auto-mac=no comment=defconf name=bridge
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/ip pool
add name=dhcp ranges=192.168.88.100-192.168.88.254
add name=vpn ranges=192.168.89.2-192.168.89.255
/ip dhcp-server
add address-pool=dhcp interface=bridge name=defconf
/ppp profile
set *FFFFFFFE local-address=192.168.89.1 remote-address=vpn
/disk settings
set auto-media-interface=bridge auto-media-sharing=yes auto-smb-sharing=yes
/interface bridge port
add bridge=bridge comment=defconf interface=ether2
add bridge=bridge comment=defconf interface=ether3
add bridge=bridge comment=defconf interface=ether4
add bridge=bridge comment=defconf interface=ether5
/ip neighbor discovery-settings
set discover-interface-list=LAN lldp-med-net-policy-vlan=1
/interface l2tp-server server
set enabled=yes use-ipsec=yes
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1 list=WAN
/interface ovpn-server server
add mac-address=FE:33:86:FA:C5:26 name=ovpn-server1
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge network=\
    192.168.88.0
/ip cloud
set ddns-enabled=yes update-time=no
/ip dhcp-client
add comment=defconf interface=ether1
/ip dhcp-server lease
add address=192.168.88.11 client-id=1:a8:20:66:12:3f:a2 mac-address=\
    A8:20:66:12:3F:A2 server=defconf
add address=192.168.88.20 client-id=1:d0:d2:b0:94:38:6e mac-address=\
    D0:D2:B0:94:38:6E server=defconf
add address=192.168.88.10 client-id=1:a0:36:bc:58:ae:a2 mac-address=\
    A0:36:BC:58:AE:A2 server=defconf
add address=192.168.88.21 mac-address=00:05:CD:A0:B9:E9 server=defconf
add address=192.168.88.30 client-id=1:90:f6:52:ee:76:6f mac-address=\
    90:F6:52:EE:76:6F server=defconf
add address=192.168.88.3 client-id=1:7c:f1:7e:66:84:a0 mac-address=\
    7C:F1:7E:66:84:A0 server=defconf
/ip dhcp-server network
add address=192.168.88.0/24 comment=defconf dns-server=192.168.88.1 gateway=\
    192.168.88.1
/ip dns
set allow-remote-requests=yes
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan type=A
/ip firewall filter
add action=accept chain=input comment=\
    "defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=accept chain=input comment="allow IPsec NAT" dst-port=4500 \
    protocol=udp
add action=accept chain=input comment="allow IKE" dst-port=500 protocol=udp
add action=accept chain=input comment="allow l2tp" dst-port=1701 protocol=udp
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
    invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment=\
    "defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=drop chain=input comment="defconf: drop all not coming from LAN" \
    in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" \
    ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" \
    ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" \
    connection-state=established,related hw-offload=yes
add action=accept chain=forward comment=\
    "defconf: accept established,related, untracked" connection-state=\
    established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" \
    connection-state=invalid
add action=drop chain=forward comment=\
    "defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat \
    connection-state=new in-interface-list=WAN
add action=passthrough chain=forward comment=CAM dst-address=192.168.88.30 \
    dst-port=80 protocol=udp src-port=120
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
    ipsec-policy=out,none out-interface-list=WAN
add action=masquerade chain=srcnat comment="masq. vpn traffic" src-address=\
    192.168.89.0/24
/ipv6 firewall address-list
add address=::/128 comment="defconf: unspecified address" list=bad_ipv6
add address=::1/128 comment="defconf: lo" list=bad_ipv6
add address=fec0::/10 comment="defconf: site-local" list=bad_ipv6
add address=::ffff:0.0.0.0/96 comment="defconf: ipv4-mapped" list=bad_ipv6
add address=::/96 comment="defconf: ipv4 compat" list=bad_ipv6
add address=100::/64 comment="defconf: discard only " list=bad_ipv6
add address=2001:db8::/32 comment="defconf: documentation" list=bad_ipv6
add address=2001:10::/28 comment="defconf: ORCHID" list=bad_ipv6
add address=3ffe::/16 comment="defconf: 6bone" list=bad_ipv6
/ipv6 firewall filter
add action=accept chain=input comment=\
    "defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
    invalid
add action=accept chain=input comment="defconf: accept ICMPv6" protocol=\
    icmpv6
add action=accept chain=input comment="defconf: accept UDP traceroute" \
    dst-port=33434-33534 protocol=udp
add action=accept chain=input comment=\
    "defconf: accept DHCPv6-Client prefix delegation." dst-port=546 protocol=\
    udp src-address=fe80::/10
add action=accept chain=input comment="defconf: accept IKE" dst-port=500,4500 \
    protocol=udp
add action=accept chain=input comment="defconf: accept ipsec AH" protocol=\
    ipsec-ah
add action=accept chain=input comment="defconf: accept ipsec ESP" protocol=\
    ipsec-esp
add action=accept chain=input comment=\
    "defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=input comment=\
    "defconf: drop everything else not coming from LAN" in-interface-list=\
    !LAN
add action=accept chain=forward comment=\
    "defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" \
    connection-state=invalid
add action=drop chain=forward comment=\
    "defconf: drop packets with bad src ipv6" src-address-list=bad_ipv6
add action=drop chain=forward comment=\
    "defconf: drop packets with bad dst ipv6" dst-address-list=bad_ipv6
add action=drop chain=forward comment="defconf: rfc4890 drop hop-limit=1" \
    hop-limit=equal:1 protocol=icmpv6
add action=accept chain=forward comment="defconf: accept ICMPv6" protocol=\
    icmpv6
add action=accept chain=forward comment="defconf: accept HIP" protocol=139
add action=accept chain=forward comment="defconf: accept IKE" dst-port=\
    500,4500 protocol=udp
add action=accept chain=forward comment="defconf: accept ipsec AH" protocol=\
    ipsec-ah
add action=accept chain=forward comment="defconf: accept ipsec ESP" protocol=\
    ipsec-esp
add action=accept chain=forward comment=\
    "defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=forward comment=\
    "defconf: drop everything else not coming from LAN" in-interface-list=\
    !LAN
/ppp secret
add name=vpn
/system clock
set time-zone-name=America/Argentina/Buenos_Aires
/system note
set show-at-login=no
/tool e-mail
set from="" server=none
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN



Since you didnt bother to post config, Im outta here good luck. Others have more patience than I.

Just put this in terminal adding cam local address in the code and reach the camera on public ip port 8081:

ip fi n add chain=dstnat in-interface-list=wan port=8081 protocol=tcp action=dst-nat to-addresses=cam_address to-ports=80

I would revise the following:
From:
add action=drop chain=forward comment=
“defconf: drop all from WAN not DSTNATed” connection-nat-state=!dstnat
connection-state=new in-interface-list=WAN
add action=passthrough chain=forward comment=CAM dst-address=192.168.88.30
dst-port=80 protocol=udp src-port=120

TO:
add action=accept chain=forward comment=“internet traffic” in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward comment=“port forwarding” connection-nat-state=dstnat
add action=drop chain=forward comment="drop all else:

For the port forwarding rule one needs to add the following:

/ip firewall address-list
add address=mynetname.net list=MYWAN comment=“resolve my WANIP using IP cloud”



/ip firewall nat
add action=masquerade chain=srcnat comment=“defconf: masquerade”
ipsec-policy=out,none out-interface-list=WAN
add action=masquerade chain=srcnat comment=“masq. vpn traffic” src-address=
192.168.89.0/24

add chain=dstnat action=dst-nat dst-address=MYWAN dst-port=80
protocol=tcp to-address=192.168.88.30

As noted, this makes your cameras susceptible to hacking from the outside and is not recommended,
Can you not use wireguard vpn, to access the router and then the camera??
Who is accessing the camera and from where and how( app, IP address??)

HI anav!
Thanks a lot!!
sadly still doesn’t work :frowning: but

I cannot import the configfile so I added it by advanced menu

I DELETE

add action=drop chain=forward comment=
“defconf: drop all from WAN not DSTNATed” connection-nat-state=!dstnat
connection-state=new in-interface-list=WAN
AND I DELETE
add action=passthrough chain=forward comment=CAM dst-address=192.168.88.30
dst-port=80 protocol=udp src-port=120[/size][/i][/b]

AND I ADD
add action=accept chain=forward comment=“internet traffic” in-interface-list=LAN out-interface-list=WAN
AND I ADD
add action=accept chain=forward comment=“port forwarding” connection-nat-state=dstnat
AND I ADD
add action=drop chain=forward comment="drop all else:[/i]

IN MENU IP → firewall → address-list
I ADD
add address=mynetname.net list=MYWAN comment=“resolve my WANIP using IP cloud”[/i]
(replace mynetname.net for xxxxxxx.xxxxxx.mynetname.net
(MYWAN is a new nae. is ok that or mus I replace it with some internal REAL name?

FINALLY in menu IP → firewall → nat
I ADD
add chain=dstnat action=dst-nat dst-address=MYWAN dst-port=80
protocol=tcp to-address=192.168.88.30
(I change dst-addres (an IP number) for Dst. Address List (it uses the MYWAN name)
(no source port?)


As noted, this makes your cameras susceptible to hacking from the outside and is not recommended,
OF course I understand this But I dont know a better option, that I can use
Can you not use wireguard vpn, to access the router and then the camera??
I have no idea
Who is accessing the camera and from where and how( app, IP address??)
Only me access the CAMERA , from a phone with an app so I need an IP or domain name to get directed. The app name is “ipcamviewer”

THANKS A LOT

So you are using a third party APP to access your feed.
Have you thought about the fact that you have to forward a port on your router to everyone in the world…
I have three different types of video cameras in the house and I dont forward a single port and I also use an APP to view them.

In other words, you should stop immediately what you are doing and remove the port forward and setup a wireguard connection to your router (not hard), and then you can view the cameras from INSIDE your router/home.

HI and thanks
I understand but I DONT AGREE
why> simply. My cam onlyworks a little (fwe hours a day)
Its beyond ddns
user and key
It works and I konw how to do that
but learn hot to setup a wireguard connection, find a program to do tha , config and so on is beyond my time. Thats all. Im not the FED :stuck_out_tongue:
thank you
(I will continue learning mikroik programing codes)