Community discussions

MikroTik App
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Devices on LAN cannot access other devices on LAN via public IP

Tue Sep 13, 2022 6:40 pm

Hi,

I have set up a freepbx server on my LAN. I am using a Mikrotik RB 2011 iL RM. I want to use Acrobits Groundwire as a softphone for my phones. In the settings of Acrobits Groundwire you must define SIP User, SIP Password and SIP Domain.

For domain, when I enter my public IP and port for the internal FreePBX server, the phone registers correctly but only when I am external to the LAN, e.g. in a different WiFi network or using mobile data.

Also when I try to access my NAS via public IP it works externally but not internally. Typing public IP:5501 externally gets the server, internally it says site not found. The main problem is with the phones though, don't really care about accessing the NAS via web browser as we can access it with File explorer. Without the phones accessing the FreePBX, we can't actually use softphones unless we are external to the building.

Is this possible to fix?
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19107
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Devices on LAN cannot access other devices on LAN via public IP

Tue Sep 13, 2022 6:56 pm

Read up on Hairpin Nat. Item E - viewtopic.php?t=182373
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Re: Devices on LAN cannot access other devices on LAN via public IP

Tue Sep 13, 2022 8:02 pm

Read up on Hairpin Nat. Item E - viewtopic.php?t=182373
Hi,

I manually entered a firewall NAT rule with the following entries:

Chain: srcnat
Src. Address: 192.168.88.0/24
Dst. Address: 192.168.88.0/24
Action: masquerade

See attached image.

Is this following instructions correctly? My LAN is 192.168.88.0 - 192.168.88.254 as is default on mikrotik.
You do not have the required permissions to view the files attached to this post.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19107
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Devices on LAN cannot access other devices on LAN via public IP

Tue Sep 13, 2022 8:10 pm

Getting there..........
Would need to see firewall rules as well.

Is you WANIP static or dynamic public IP?
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Re: Devices on LAN cannot access other devices on LAN via public IP

Tue Sep 13, 2022 8:22 pm

Getting there..........
Would need to see firewall rules as well.

Is you WANIP static or dynamic public IP?
Hi, my IP is static. I have uploaded both filter rules and NAT if that is what you mean by firewall rules.
You do not have the required permissions to view the files attached to this post.
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Re: Devices on LAN cannot access other devices on LAN via public IP

Tue Sep 13, 2022 8:51 pm

Getting there..........
Would need to see firewall rules as well.

Is you WANIP static or dynamic public IP?
In your part E of your guide, it states this as an option:

2. CHANGING SUBNET OF SERVER

In this scenario, there is no requirement for a sourcenat rule addition as our effort is aimed at avoiding hairpin natting! In fact, there is no hairpin required because the server and users are now on a different subnet, HOWEVER, one has to ensure a properly formatted DST-NAT rule for the dynamic WANIP setup.

a. Fixed IP Static......... the standard DST-NAT rule will suffice.
add action=dst-nat chain=dstnat dst-address=47.123.12.89 dst-port=12566 protocol=tcp to=addresses=192.168.88.68

Is the part 'a. Fixed IP Static......... the standard DST-NAT rule will suffice.' the entirety of what you have to do? Or do you have to do something else to change the subnet of the server? I am guessing you have to do something else?
 
User avatar
k6ccc
Forum Guru
Forum Guru
Posts: 1490
Joined: Fri May 13, 2016 12:01 am
Location: Glendora, CA, USA (near Los Angeles)
Contact:

Re: Devices on LAN cannot access other devices on LAN via public IP

Tue Sep 13, 2022 9:41 pm

TheLorc, Rather than posting screen captures, doing an export on your configuration is a far better way because among other things, it shows all the details that the screen capture does not. To export and paste your configuration (and I'm assuming you are using WebFig or Winbox), open a terminal window, and type (without the quotes) "/export hide-sensitive file=any-filename-you-wish". Then open the files section and right click on the filename you created and select download in order to download the file to your computer. It will be a text file with whatever name you saved to with an extension of .rsc. Suggest you then open the .rsc file in your favorite text editor and redact any sensitive information. Then in your message here, click the code display icon in the toolbar above the text entry (the code display icon is the 7th one from the left and looks like a square with a blob in the middle). Then paste the text from the file in between the two code words in brackets.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19107
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Devices on LAN cannot access other devices on LAN via public IP

Tue Sep 13, 2022 11:04 pm

Getting there..........
Would need to see firewall rules as well.

Is you WANIP static or dynamic public IP?
In your part E of your guide, it states this as an option:

2. CHANGING SUBNET OF SERVER

In this scenario, there is no requirement for a sourcenat rule addition as our effort is aimed at avoiding hairpin natting! In fact, there is no hairpin required because the server and users are now on a different subnet, HOWEVER, one has to ensure a properly formatted DST-NAT rule for the dynamic WANIP setup.

a. Fixed IP Static......... the standard DST-NAT rule will suffice.
add action=dst-nat chain=dstnat dst-address=47.123.12.89 dst-port=12566 protocol=tcp to=addresses=192.168.88.68

Is the part 'a. Fixed IP Static......... the standard DST-NAT rule will suffice.' the entirety of what you have to do? Or do you have to do something else to change the subnet of the server? I am guessing you have to do something else?
Your mixing stuff up. If you change the server subnet so that the users accessing the server via the WANIP, are on a different subnet, you no longer need the additional hairpin source nat rule.
However the requirements for proper port forwarding format remain.
For fixed IP, as you have, the format above you used is correct (assuming dst-port is the same as to-ports)
There is also a requirement to have a firewall rule that allows in general port forwarding

What I can say is that if you do have a static fixed wanip the correct format for the standard required sourcenat rule is
add chain=srcnat action=src-nat to-addresses=47.123.12.89 out-interface=etherX
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Re: Devices on LAN cannot access other devices on LAN via public IP

Wed Sep 14, 2022 1:13 am



In your part E of your guide, it states this as an option:

2. CHANGING SUBNET OF SERVER

In this scenario, there is no requirement for a sourcenat rule addition as our effort is aimed at avoiding hairpin natting! In fact, there is no hairpin required because the server and users are now on a different subnet, HOWEVER, one has to ensure a properly formatted DST-NAT rule for the dynamic WANIP setup.

a. Fixed IP Static......... the standard DST-NAT rule will suffice.
add action=dst-nat chain=dstnat dst-address=47.123.12.89 dst-port=12566 protocol=tcp to=addresses=192.168.88.68

Is the part 'a. Fixed IP Static......... the standard DST-NAT rule will suffice.' the entirety of what you have to do? Or do you have to do something else to change the subnet of the server? I am guessing you have to do something else?
Your mixing stuff up. If you change the server subnet so that the users accessing the server via the WANIP, are on a different subnet, you no longer need the additional hairpin source nat rule.
However the requirements for proper port forwarding format remain.
For fixed IP, as you have, the format above you used is correct (assuming dst-port is the same as to-ports)
There is also a requirement to have a firewall rule that allows in general port forwarding

What I can say is that if you do have a static fixed wanip the correct format for the standard required sourcenat rule is
add chain=srcnat action=src-nat to-addresses=47.123.12.89 out-interface=etherX
"What I can say is that if you do have a static fixed wanip the correct format for the standard required sourcenat rule is
add chain=srcnat action=src-nat to-addresses=47.123.12.89 out-interface=etherX"

Is this the only configuration I need in order for the local device to access the server via public IP? Or are there more stuff? Kind of confused to be honest
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19107
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Devices on LAN cannot access other devices on LAN via public IP

Wed Sep 14, 2022 2:30 am

If you read the article you would also know that you need a firewall rule to ensure such traffic is allowed.
This comes standard as a default rule in the forward chain....
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=WAN

This does not suffice for the scenario at hand, instead move to this which provides clearly to the reader what is allowed traffic or not.
Thus replace with:
add action=accept chain=forward comment="allow internet traffic" in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward comment="allow port forwarding" connection-nat-state=dstnat
add action=drop chain=forward


Why is this better.
a. Instead of dropping all traffic from the WAN which is not natted, now you will be dropping
all wan to lan traffic not natted
all lan to wan traffic ****
all lan to lan traffic at layer 3.

hence we add in a rule to allow LAN to WAN traffic, but now you know you are doing it and so does the reader - clear!

b. By allowing dst nat more generally you ensure you allow traffic to the server coming from the LAN side and using the WANIP, vice actually coming in from the WAN side (externally) which the default rule doesnt permit.
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Re: Devices on LAN cannot access other devices on LAN via public IP

Wed Sep 14, 2022 5:06 pm

If you read the article you would also know that you need a firewall rule to ensure such traffic is allowed.
This comes standard as a default rule in the forward chain....
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=WAN

This does not suffice for the scenario at hand, instead move to this which provides clearly to the reader what is allowed traffic or not.
Thus replace with:
add action=accept chain=forward comment="allow internet traffic" in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward comment="allow port forwarding" connection-nat-state=dstnat
add action=drop chain=forward


Why is this better.
a. Instead of dropping all traffic from the WAN which is not natted, now you will be dropping
all wan to lan traffic not natted
all lan to wan traffic ****
all lan to lan traffic at layer 3.

hence we add in a rule to allow LAN to WAN traffic, but now you know you are doing it and so does the reader - clear!

b. By allowing dst nat more generally you ensure you allow traffic to the server coming from the LAN side and using the WANIP, vice actually coming in from the WAN side (externally) which the default rule doesnt permit.
Hi,

For some reason its still not working. I will try and factory reset the device and try from scratch, maybe I messed something up. Here is my code, i know its a lot to look through so if you dont want to thats fine
# sep/14/2022 15:02:37 by RouterOS 7.4
# software id = JCY8-AFLA
#
# model = RB2011iL
# serial number = E7DD0F73B4C5
/interface bridge
add admin-mac=DC:2C:6E:4C:59:6F auto-mac=no comment=defconf name=bridge
/interface ethernet
set [ find default-name=ether7 ] name=ether7-access
/interface pppoe-client
add add-default-route=yes disabled=no interface=ether1 name=pppoe-out1 \
    use-peer-dns=yes user=eircom
/interface wireguard
add listen-port=13231 mtu=1420 name=wireguard1
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
add comment=defconf name=MANAGE
add comment=defconf name=TRUSTED
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=dhcp ranges=192.168.88.10-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
/port
set 0 name=serial0
/ppp profile
set *FFFFFFFE dns-server=192.168.88.1 local-address=192.168.89.1 \
    remote-address=vpn
/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
add bridge=bridge comment=defconf interface=ether6
add bridge=bridge comment=defconf interface=ether8
add bridge=bridge comment=defconf interface=ether9
add bridge=bridge comment=defconf interface=ether10
/ip neighbor discovery-settings
set discover-interface-list=LAN
/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
add interface=pppoe-out1 list=WAN
add interface=ether7-access list=MANAGE
/interface pptp-server server
# PPTP connections are considered unsafe, it is suggested to use a more modern VPN protocol instead
set enabled=yes
/interface sstp-server server
set default-profile=default-encryption enabled=yes
/interface wireguard peers
add allowed-address=192.168.88.0/24 interface=wireguard1 public-key=\
    "1Of5xcGq53sXm6h8TKvkn7eGxNHEqom6fhBI8XDPg2I="
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge network=\
    192.168.88.0
add address=192.168.100.1/24 interface=wireguard1 network=192.168.100.0
add address=10.10.10.254/8 interface=bridge network=10.0.0.0
/ip cloud
set ddns-enabled=yes
/ip dhcp-client
add comment=defconf disabled=yes interface=ether1
/ip dhcp-server lease
add address=192.168.88.232 mac-address=00:21:9B:3C:13:ED server=defconf
add address=192.168.88.231 client-id=1:b4:2e:99:16:e1:d0 comment=\
    "Lorcan PC C1" mac-address=B4:2E:99:16:E1:D0 server=defconf
add address=192.168.88.218 client-id=1:0:1f:c1:1c:c9:80 mac-address=\
    00:1F:C1:1C:C9:80 server=defconf
add address=192.168.88.216 client-id=1:0:1f:c1:1c:c4:20 mac-address=\
    00:1F:C1:1C:C4:20 server=defconf
add address=192.168.88.215 client-id=1:0:1f:c1:1c:c4:1b mac-address=\
    00:1F:C1:1C:C4:1B server=defconf
add address=192.168.88.214 client-id=1:0:1f:c1:1c:c4:1c mac-address=\
    00:1F:C1:1C:C4:1C server=defconf
add address=192.168.88.213 client-id=1:0:1f:c1:1c:c4:8b mac-address=\
    00:1F:C1:1C:C4:8B server=defconf
add address=192.168.88.212 client-id=1:0:1f:c1:1c:c4:91 mac-address=\
    00:1F:C1:1C:C4:91 server=defconf
add address=192.168.88.211 client-id=1:0:1f:c1:1c:c9:7b mac-address=\
    00:1F:C1:1C:C9:7B server=defconf
add address=192.168.88.209 client-id=1:38:22:e2:9f:d:91 mac-address=\
    38:22:E2:9F:0D:91 server=defconf
add address=192.168.88.207 client-id=1:0:1f:c1:1c:c4:90 mac-address=\
    00:1F:C1:1C:C4:90 server=defconf
add address=192.168.88.206 client-id=1:0:1f:c1:1c:c4:8d mac-address=\
    00:1F:C1:1C:C4:8D server=defconf
add address=192.168.88.205 client-id=1:0:1f:c1:1c:c4:8f mac-address=\
    00:1F:C1:1C:C4:8F server=defconf
add address=192.168.88.204 client-id=1:0:1f:c1:1c:c4:92 mac-address=\
    00:1F:C1:1C:C4:92 server=defconf
add address=192.168.88.203 client-id=1:0:1f:c1:1c:c4:89 mac-address=\
    00:1F:C1:1C:C4:89 server=defconf
add address=192.168.88.202 client-id=1:0:1f:c1:1c:c4:1e comment=\
    "" mac-address=00:1F:C1:1C:C4:1E server=defconf
add address=192.168.88.201 client-id=1:0:1f:c1:1c:c4:22 mac-address=\
    00:1F:C1:1C:C4:22 server=defconf
add address=192.168.88.200 client-id=1:0:1f:c1:1c:c4:8c mac-address=\
    00:1F:C1:1C:C4:8C server=defconf
add address=192.168.88.199 client-id=1:0:1f:c1:1c:c4:1f mac-address=\
    00:1F:C1:1C:C4:1F server=defconf
add address=192.168.88.198 client-id=1:0:1f:c1:1c:c4:23 mac-address=\
    00:1F:C1:1C:C4:23 server=defconf
add address=192.168.88.196 client-id=1:90:9:d0:0:9:11 mac-address=\
    90:09:D0:00:09:11 server=defconf
add address=192.168.88.194 client-id=1:0:11:32:ae:a2:7f mac-address=\
    00:11:32:AE:A2:7F server=defconf
add address=192.168.88.165 client-id=1:0:1f:c1:1c:c4:8e mac-address=\
    00:1F:C1:1C:C4:8E server=defconf
add address=192.168.88.163 client-id=1:34:f6:2d:89:e4:82 mac-address=\
    34:F6:2D:89:E4:82 server=defconf
add address=192.168.88.154 client-id=1:0:1f:c1:1c:c4:8a mac-address=\
    00:1F:C1:1C:C4:8A server=defconf
add address=192.168.88.92 client-id=1:b8:ec:a3:fd:1d:1f mac-address=\
    B8:EC:A3:FD:1D:1F server=defconf
add address=192.168.88.91 client-id=1:b8:ec:a3:fd:1d:1c mac-address=\
    B8:EC:A3:FD:1D:1C server=defconf
add address=192.168.88.192 client-id=1:e0:91:f5:c0:c:88 mac-address=\
    E0:91:F5:C0:0C:88 server=defconf
add address=192.168.88.217 client-id=1:ec:8e:b5:d9:d7:82 comment="" \
    mac-address=EC:8E:B5:D9:D7:82 server=defconf
add address=192.168.88.27 mac-address=6C:2B:59:E6:FB:01 server=defconf
add address=192.168.88.38 client-id=1:0:11:32:b8:2c:31 comment=\
    "" mac-address=00:11:32:B8:2C:31 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
/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=accept chain=input comment="allow pptp" dst-port=1723 protocol=tcp
add action=accept chain=input comment="allow sstp" dst-port=443 protocol=tcp
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=accept chain=forward comment="allow internet traffic" \
    in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward comment="allow port forwarding" \
    connection-nat-state=dstnat
add action=drop chain=forward
/ip firewall nat
add action=masquerade chain=srcnat dst-address=192.168.88.0/24 src-address=\
    192.168.88.0/24
add action=src-nat chain=srcnat out-interface=pppoe-out1 to-addresses=\
    XX.XX.XX.XX
add action=dst-nat chain=dstnat dst-address=XX.XX.XX.XX dst-port=2000-65000 \
    in-interface-list=WAN protocol=udp to-addresses=192.168.88.27 to-ports=\
    2000-65000
add action=masquerade chain=srcnat comment="defconf: masquerade" \
    ipsec-policy=out,none out-interface-list=WAN
add action=dst-nat chain=dstnat comment="FreePBX Media UDP" dst-port=\
    2000-65001 in-interface-list=WAN protocol=udp to-addresses=192.168.88.27 \
    to-ports=2000-65001
add action=dst-nat chain=dstnat comment="FreePBX WebGUI" dst-port=8080 \
    in-interface-list=WAN protocol=tcp to-addresses=192.168.88.27 to-ports=\
    8080
add action=dst-nat chain=dstnat comment="FreePBX LetsEncrypt" dst-port=80 \
    in-interface-list=WAN protocol=tcp to-addresses=192.168.88.27 to-ports=80
add action=dst-nat chain=dstnat comment="FreePBX Tunnel TCP" dst-port=5090 \
    in-interface-list=WAN protocol=tcp to-addresses=192.168.88.27 to-ports=\
    5090
add action=dst-nat chain=dstnat comment="FreePBX SIP TCP" dst-port=5060 \
    in-interface-list=WAN protocol=tcp to-addresses=192.168.88.27 to-ports=\
    5060
add action=dst-nat chain=dstnat comment="FreePBX SIP TLS" dst-port=5061 \
    in-interface-list=WAN protocol=tcp to-addresses=192.168.88.27 to-ports=\
    5061
add action=dst-nat chain=dstnat dst-port=5500-5501 in-interface-list=WAN \
    protocol=tcp to-addresses=192.168.88.194 to-ports=5500-5501
/ip firewall service-port
set sip sip-timeout=59w3d15h
/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" 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 profile=default-encryption
/system clock
set time-zone-name=Europe/Dublin
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19107
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Devices on LAN cannot access other devices on LAN via public IP

Wed Sep 14, 2022 6:03 pm

IN SUMMARY your config bubble is about to be popped!!

(1) What are you doing here??
/interface wireguard peers
add allowed-address=192.168.88.0/24 interface=wireguard1 public-key=\
"1Of5xcGq53sXm6h8TKvkn7eGxNHEqom6fhBI8XDPg2I="


You have identified your own subnet as an allowed IP and on top of that have no entry for the client wireguard IP address or remote subnets if applicable?
Did you not read this.......... viewtopic.php?t=182340

(2) You have duplicate IP addresses assigned to the bridge ??????
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge network=\
192.168.88.0
add address=192.168.100.1/24 interface=wireguard1 network=192.168.100.0
add address=10.10.10.254/8 interface=bridge network=10.0.0.0

(3) Good to see the added forward firewall rules (the last 3 here)............. so you need to get rid of this first rule..
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=accept chain=forward comment="allow internet traffic" \
in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward comment="allow port forwarding" \
connection-nat-state=dstnat
add action=drop chain=forward


(4) You might have some conflicts but not sure between the correctly formatted rule and the default rule the router comes with.
add action=src-nat chain=srcnat out-interface=pppoe-out1 to-addresses=\
XX.XX.XX.XX
add action=masquerade chain=srcnat comment="defconf: masquerade" \
ipsec-policy=out,none out-interface-list=WAN


Suggest moving the missing bit to the correct rule. so that it looks like this
add action=src-nat chain=srcnat out-interface=pppoe-out1 to-addresses=\
XX.XX.XX.XX ipsec-policy=out,none

5. Your first dst-nat rule has the correct format and then you digress to the dynamic IP address format???
add action=dst-nat chain=dstnat dst-address=XX.XX.XX.XX dst-port=2000-65000 \
in-interface-list=WAN protocol=udp to-addresses=192.168.88.27 to-ports=\
2000-65000
add action=dst-nat chain=dstnat comment="FreePBX WebGUI" dst-port=8080 \
in-interface-list=WAN protocol=tcp to-addresses=192.168.88.27 to-ports=\
8080


Be consistent and use dst-address for all the dst-nat rules. Also if the to-ports is the same as dst-ports, it is not required to list them.

6. I dont understand the insanity of assigning ports 2-65000 to anything thats ridonkulous, what the heck for?

7. Duplicate rules..........
add action=dst-nat chain=dstnat dst-address=XX.XX.XX.XX dst-port=2000-65000 \
in-interface-list=WAN protocol=udp to-addresses=192.168.88.27 to-ports=\
2000-65000
add action=dst-nat chain=dstnat comment="FreePBX Media UDP" dst-port=\
2000-65001 in-interface-list=WAN protocol=udp to-addresses=192.168.88.27 \
to-ports=2000-65001


8. When you do such things you BREAK port forwarding rules. Specifically that a port cannot be port forwarded more than ONCE on the inbound side.
Or stated otherwise HOW is the Router supposed to know where to send ports if it gets port 8080 for example, how does it know where to send it when 8080 is covered in a different rule.

9. Finally the other issue with 2-65000 ports is that NONE of your ipsec ports will be seen by the router as they will all be diverted to your dst-nat rules...........................
Whatever you think your are doing its wrong! Forwarding ports has to be done with the full context of what is going in the rest of the config.
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Re: Devices on LAN cannot access other devices on LAN via public IP

Wed Sep 14, 2022 7:11 pm

IN SUMMARY your config bubble is about to be popped!!

(1) What are you doing here??
/interface wireguard peers
add allowed-address=192.168.88.0/24 interface=wireguard1 public-key=\
"1Of5xcGq53sXm6h8TKvkn7eGxNHEqom6fhBI8XDPg2I="


You have identified your own subnet as an allowed IP and on top of that have no entry for the client wireguard IP address or remote subnets if applicable?
Did you not read this.......... viewtopic.php?t=182340

(2) You have duplicate IP addresses assigned to the bridge ??????
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge network=\
192.168.88.0
add address=192.168.100.1/24 interface=wireguard1 network=192.168.100.0
add address=10.10.10.254/8 interface=bridge network=10.0.0.0

(3) Good to see the added forward firewall rules (the last 3 here)............. so you need to get rid of this first rule..
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=accept chain=forward comment="allow internet traffic" \
in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward comment="allow port forwarding" \
connection-nat-state=dstnat
add action=drop chain=forward


(4) You might have some conflicts but not sure between the correctly formatted rule and the default rule the router comes with.
add action=src-nat chain=srcnat out-interface=pppoe-out1 to-addresses=\
XX.XX.XX.XX
add action=masquerade chain=srcnat comment="defconf: masquerade" \
ipsec-policy=out,none out-interface-list=WAN


Suggest moving the missing bit to the correct rule. so that it looks like this
add action=src-nat chain=srcnat out-interface=pppoe-out1 to-addresses=\
XX.XX.XX.XX ipsec-policy=out,none

5. Your first dst-nat rule has the correct format and then you digress to the dynamic IP address format???
add action=dst-nat chain=dstnat dst-address=XX.XX.XX.XX dst-port=2000-65000 \
in-interface-list=WAN protocol=udp to-addresses=192.168.88.27 to-ports=\
2000-65000
add action=dst-nat chain=dstnat comment="FreePBX WebGUI" dst-port=8080 \
in-interface-list=WAN protocol=tcp to-addresses=192.168.88.27 to-ports=\
8080


Be consistent and use dst-address for all the dst-nat rules. Also if the to-ports is the same as dst-ports, it is not required to list them.

6. I dont understand the insanity of assigning ports 2-65000 to anything thats ridonkulous, what the heck for?

7. Duplicate rules..........
add action=dst-nat chain=dstnat dst-address=XX.XX.XX.XX dst-port=2000-65000 \
in-interface-list=WAN protocol=udp to-addresses=192.168.88.27 to-ports=\
2000-65000
add action=dst-nat chain=dstnat comment="FreePBX Media UDP" dst-port=\
2000-65001 in-interface-list=WAN protocol=udp to-addresses=192.168.88.27 \
to-ports=2000-65001


8. When you do such things you BREAK port forwarding rules. Specifically that a port cannot be port forwarded more than ONCE on the inbound side.
Or stated otherwise HOW is the Router supposed to know where to send ports if it gets port 8080 for example, how does it know where to send it when 8080 is covered in a different rule.

9. Finally the other issue with 2-65000 ports is that NONE of your ipsec ports will be seen by the router as they will all be diverted to your dst-nat rules...........................
Whatever you think your are doing its wrong! Forwarding ports has to be done with the full context of what is going in the rest of the config.
Well as you can see I dont really know what I am doing lol

(1) What are you doing here??
/interface wireguard peers
add allowed-address=192.168.88.0/24 interface=wireguard1 public-key=\
"1Of5xcGq53sXm6h8TKvkn7eGxNHEqom6fhBI8XDPg2I="


You have identified your own subnet as an allowed IP and on top of that have no entry for the client wireguard IP address or remote subnets if applicable?
Did you not read this.......... viewtopic.php?t=182340

I will delete this, I am not trying to get wireguard working at the moment, although i will be in future

(2) You have duplicate IP addresses assigned to the bridge ??????
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge network=\
192.168.88.0
add address=192.168.100.1/24 interface=wireguard1 network=192.168.100.0
add address=10.10.10.254/8 interface=bridge network=10.0.0.0

I may have done this to try get ether7-access working when the bridge was disabled or if i was locked out, not sure

6. I dont understand the insanity of assigning ports 2-65000 to anything thats ridonkulous, what the heck for?

I was having problems setting up FreePBX, like RTP not working, because it needed a certain port range. So I was not sure what port range it needed, so i just allowed all ports 2000 - 65000 to make sure it covered the required ports.

8. When you do such things you BREAK port forwarding rules. Specifically that a port cannot be port forwarded more than ONCE on the inbound side.
Or stated otherwise HOW is the Router supposed to know where to send ports if it gets port 8080 for example, how does it know where to send it when 8080 is covered in a different rule.

I have removed the duplicate rules. There are no overlapping rules now, as port 8080 is tcp and there is nothing overlapping tcp port 8080.

9. Finally the other issue with 2-65000 ports is that NONE of your ipsec ports will be seen by the router as they will all be diverted to your dst-nat rules...........................
Whatever you think your are doing its wrong! Forwarding ports has to be done with the full context of what is going in the rest of the config.

Changing to 10000 - 20000 instead of 2000 - 65000 stopped outgoing calls from working.

Also, I did the changes you said in this post but still my phone can't register when im on the private LAN and use the public IP. It works fine when I register using public IP when im external, or when i use the private LAN IP (192.168.88.27) when I am internal. So to register to the PBX, I need to use the internal IP when I am inside, and the external IP when I am outside. This would mean manually changing it each time I leave lol which is not great i guess

Can you see why it would not register from my code? Maybe i should try put it on a different subnet if the hairpin nat is not working
# sep/14/2022 17:14:25 by RouterOS 7.4
# software id = JCY8-AFLA
#
# model = RB2011iL
# serial number = E7DD0F73B4C5
/interface bridge
add admin-mac=DC:2C:6E:4C:59:6F auto-mac=no comment=defconf name=bridge
/interface ethernet
set [ find default-name=ether7 ] name=ether7-access
/interface pppoe-client
add add-default-route=yes disabled=no interface=ether1 name=pppoe-out1 \
    use-peer-dns=yes user=eircom
/interface wireguard
add listen-port=13231 mtu=1420 name=wireguard1
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
add comment=defconf name=MANAGE
add comment=defconf name=TRUSTED
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=dhcp ranges=192.168.88.10-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
/port
set 0 name=serial0
/ppp profile
set *FFFFFFFE dns-server=192.168.88.1 local-address=192.168.89.1 \
    remote-address=vpn
/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
add bridge=bridge comment=defconf interface=ether6
add bridge=bridge comment=defconf interface=ether8
add bridge=bridge comment=defconf interface=ether9
add bridge=bridge comment=defconf interface=ether10
/ip neighbor discovery-settings
set discover-interface-list=LAN
/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
add interface=pppoe-out1 list=WAN
add interface=ether7-access list=MANAGE
/interface pptp-server server
# PPTP connections are considered unsafe, it is suggested to use a more modern VPN protocol instead
set enabled=yes
/interface sstp-server server
set default-profile=default-encryption enabled=yes
/interface wireguard peers
add allowed-address=192.168.88.0/24 interface=wireguard1 public-key=\
    "1Of5xcGq53sXm6h8TKvkn7eGxNHEqom6fhBI8XDPg2I="
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge network=\
    192.168.88.0
add address=192.168.100.1/24 interface=wireguard1 network=192.168.100.0
/ip cloud
set ddns-enabled=yes
/ip dhcp-client
add comment=defconf disabled=yes interface=ether1
/ip dhcp-server lease
add address=192.168.88.232 mac-address=00:21:9B:3C:13:ED server=defconf
add address=192.168.88.231 client-id=1:b4:2e:99:16:e1:d0 comment=\
    "Lorcan PC C1" mac-address=B4:2E:99:16:E1:D0 server=defconf
add address=192.168.88.218 client-id=1:0:1f:c1:1c:c9:80 mac-address=\
    00:1F:C1:1C:C9:80 server=defconf
add address=192.168.88.216 client-id=1:0:1f:c1:1c:c4:20 mac-address=\
    00:1F:C1:1C:C4:20 server=defconf
add address=192.168.88.215 client-id=1:0:1f:c1:1c:c4:1b mac-address=\
    00:1F:C1:1C:C4:1B server=defconf
add address=192.168.88.214 client-id=1:0:1f:c1:1c:c4:1c mac-address=\
    00:1F:C1:1C:C4:1C server=defconf
add address=192.168.88.213 client-id=1:0:1f:c1:1c:c4:8b mac-address=\
    00:1F:C1:1C:C4:8B server=defconf
add address=192.168.88.212 client-id=1:0:1f:c1:1c:c4:91 mac-address=\
    00:1F:C1:1C:C4:91 server=defconf
add address=192.168.88.211 client-id=1:0:1f:c1:1c:c9:7b mac-address=\
    00:1F:C1:1C:C9:7B server=defconf
add address=192.168.88.209 client-id=1:38:22:e2:9f:d:91 mac-address=\
    38:22:E2:9F:0D:91 server=defconf
add address=192.168.88.207 client-id=1:0:1f:c1:1c:c4:90 mac-address=\
    00:1F:C1:1C:C4:90 server=defconf
add address=192.168.88.206 client-id=1:0:1f:c1:1c:c4:8d mac-address=\
    00:1F:C1:1C:C4:8D server=defconf
add address=192.168.88.205 client-id=1:0:1f:c1:1c:c4:8f mac-address=\
    00:1F:C1:1C:C4:8F server=defconf
add address=192.168.88.204 client-id=1:0:1f:c1:1c:c4:92 mac-address=\
    00:1F:C1:1C:C4:92 server=defconf
add address=192.168.88.203 client-id=1:0:1f:c1:1c:c4:89 mac-address=\
    00:1F:C1:1C:C4:89 server=defconf
add address=192.168.88.202 client-id=1:0:1f:c1:1c:c4:1e comment=\
    "lorcan phone" mac-address=00:1F:C1:1C:C4:1E server=defconf
add address=192.168.88.201 client-id=1:0:1f:c1:1c:c4:22 mac-address=\
    00:1F:C1:1C:C4:22 server=defconf
add address=192.168.88.200 client-id=1:0:1f:c1:1c:c4:8c mac-address=\
    00:1F:C1:1C:C4:8C server=defconf
add address=192.168.88.199 client-id=1:0:1f:c1:1c:c4:1f mac-address=\
    00:1F:C1:1C:C4:1F server=defconf
add address=192.168.88.198 client-id=1:0:1f:c1:1c:c4:23 mac-address=\
    00:1F:C1:1C:C4:23 server=defconf
add address=192.168.88.196 client-id=1:90:9:d0:0:9:11 mac-address=\
    90:09:D0:00:09:11 server=defconf
add address=192.168.88.194 client-id=1:0:11:32:ae:a2:7f mac-address=\
    00:11:32:AE:A2:7F server=defconf
add address=192.168.88.165 client-id=1:0:1f:c1:1c:c4:8e mac-address=\
    00:1F:C1:1C:C4:8E server=defconf
add address=192.168.88.163 client-id=1:34:f6:2d:89:e4:82 mac-address=\
    34:F6:2D:89:E4:82 server=defconf
add address=192.168.88.154 client-id=1:0:1f:c1:1c:c4:8a mac-address=\
    00:1F:C1:1C:C4:8A server=defconf
add address=192.168.88.92 client-id=1:b8:ec:a3:fd:1d:1f mac-address=\
    B8:EC:A3:FD:1D:1F server=defconf
add address=192.168.88.91 client-id=1:b8:ec:a3:fd:1d:1c mac-address=\
    B8:EC:A3:FD:1D:1C server=defconf
add address=192.168.88.192 client-id=1:e0:91:f5:c0:c:88 mac-address=\
    E0:91:F5:C0:0C:88 server=defconf
add address=192.168.88.217 client-id=1:ec:8e:b5:d9:d7:82 comment="Joyce PC" \
    mac-address=EC:8E:B5:D9:D7:82 server=defconf
add address=192.168.88.27 mac-address=6C:2B:59:E6:FB:01 server=defconf
add address=192.168.88.38 client-id=1:0:11:32:b8:2c:31 comment=\
    "Backup server" mac-address=00:11:32:B8:2C:31 server=defconf
add address=192.168.88.48 client-id=1:48:2c:a0:79:49:22 comment=\
    "lorcan phone" mac-address=48:2C:A0:79:49:22 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
/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=accept chain=input comment="allow pptp" dst-port=1723 protocol=tcp
add action=accept chain=input comment="allow sstp" dst-port=443 protocol=tcp
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=accept chain=forward comment="allow internet traffic" \
    in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward comment="allow port forwarding" \
    connection-nat-state=dstnat
add action=drop chain=forward
/ip firewall nat
add action=src-nat chain=srcnat ipsec-policy=out,none out-interface=\
    pppoe-out1 to-addresses=XX.XX.XX.XX
add action=masquerade chain=srcnat dst-address=192.168.88.0/24 src-address=\
    192.168.88.0/24
add action=src-nat chain=srcnat out-interface=ether1 to-addresses=\
    XX.XX.XX.XX
add action=masquerade chain=srcnat comment="defconf: masquerade" \
    ipsec-policy=out,none out-interface-list=WAN
add action=dst-nat chain=dstnat comment="FreePBX Media UDP" dst-address=\
    XX.XX.XX.XX dst-port=2000-65001 in-interface-list=WAN protocol=udp \
    to-addresses=192.168.88.27 to-ports=2000-65001
add action=dst-nat chain=dstnat comment="FreePBX WebGUI" dst-address=\
    XX.XX.XX.XX dst-port=8080 in-interface-list=WAN protocol=tcp \
    to-addresses=192.168.88.27 to-ports=8080
add action=dst-nat chain=dstnat comment="FreePBX LetsEncrypt" dst-address=\
    XX.XX.XX.XX dst-port=80 in-interface-list=WAN protocol=tcp to-addresses=\
    192.168.88.27 to-ports=80
add action=dst-nat chain=dstnat comment="FreePBX Tunnel TCP" dst-address=\
    XX.XX.XX.XX dst-port=5090 in-interface-list=WAN protocol=tcp \
    to-addresses=192.168.88.27 to-ports=5090
add action=dst-nat chain=dstnat comment="FreePBX SIP TCP" dst-address=\
    XX.XX.XX.XX dst-port=5060 in-interface-list=WAN protocol=tcp \
    to-addresses=192.168.88.27 to-ports=5060
add action=dst-nat chain=dstnat comment="FreePBX SIP TLS" dst-address=\
    XX.XX.XX.XX dst-port=5061 in-interface-list=WAN protocol=tcp \
    to-addresses=192.168.88.27 to-ports=5061
add action=dst-nat chain=dstnat dst-port=5500-5501 in-interface-list=WAN \
    protocol=tcp to-addresses=192.168.88.194 to-ports=5500-5501
/ip firewall service-port
set sip sip-timeout=59w3d15h
/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" 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 profile=default-encryption
/system clock
set time-zone-name=Europe/Dublin
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19107
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Devices on LAN cannot access other devices on LAN via public IP

Wed Sep 14, 2022 9:34 pm

Well the issue IBPX and VOIP phones are not a simple case of port forwarding and you are struggling to get plain port forwarding to work,
but will get there, first a good solid base config is needed and then the IBPX voip experts can focus on any unique requirements to solve your issue..........
Will take a look now at the latest config.

This is a good starting point..........
Also, I did the changes you said in this post but still my phone can't register when im on the private LAN and use the public IP. It works fine when I register using public IP when im external, or when i use the private LAN IP (192.168.88.27) when I am internal. So to register to the PBX, I need to use the internal IP when I am inside, and the external IP when I am outside. This would mean manually changing it each time I leave lol which is not great i guess
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19107
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Devices on LAN cannot access other devices on LAN via public IP  [SOLVED]

Wed Sep 14, 2022 9:44 pm

(1) Put the hairpin nat rule first, and remove the duplicate rule in yellow..
/ip firewall nat
add action=masquerade chain=srcnat dst-address=192.168.88.0/24 src-address=\
192.168.88.0/24

add action=src-nat chain=srcnat ipsec-policy=out,none out-interface=\
pppoe-out1 to-addresses=XX.XX.XX.XX
add action=src-nat chain=srcnat out-interface=ether1 to-addresses=\
XX.XX.XX.XX


(2) You didnt fix the format of one of your dst-nat rules _ This is most likely the route of your problems!!!

add action=dst-nat chain=dstnat comment="FreePBX Media UDP" dst-address=\
XX.XX.XX.XX
dst-port=2000-65001 in-interface-list=WAN protocol=udp \
to-addresses=192.168.88.27 to-ports=2000-65001
add action=dst-nat chain=dstnat comment="FreePBX WebGUI" dst-address=\
XX.XX.XX.XX
dst-port=8080 in-interface-list=WAN protocol=tcp \
to-addresses=192.168.88.27 to-ports=8080
add action=dst-nat chain=dstnat comment="FreePBX LetsEncrypt" dst-address=\
XX.XX.XX.XX
dst-port=80 in-interface-list=WAN protocol=tcp to-addresses=\
192.168.88.27 to-ports=80
add action=dst-nat chain=dstnat comment="FreePBX Tunnel TCP" dst-address=\
XX.XX.XX.XX
dst-port=5090 in-interface-list=WAN protocol=tcp \
to-addresses=192.168.88.27 to-ports=5090
add action=dst-nat chain=dstnat comment="FreePBX SIP TCP" dst-address=\
XX.XX.XX.XX
dst-port=5060 in-interface-list=WAN protocol=tcp \
to-addresses=192.168.88.27 to-ports=5060
add action=dst-nat chain=dstnat comment="FreePBX SIP TLS" dst-address=\
XX.XX.XX.XX
dst-port=5061 in-interface-list=WAN protocol=tcp \
to-addresses=192.168.88.27 to-ports=5061
add action=dst-nat chain=dstnat dst-port=5500-5501 in-interface-list=WAN \ MISSING dst-address=XXXXXXX
protocol=tcp to-addresses=192.168.88.194 to-ports=5500-5501

Remove this from your rules..................... !! Think about it, if you put a condition that the rule has to come from the WAN SIDE and you are trying to reach the server from the LAN via WANIP, it wont work!!! You have the correct dst-address=format except its missing from the last rule.
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Re: Devices on LAN cannot access other devices on LAN via public IP

Thu Sep 15, 2022 12:00 pm

(1) Put the hairpin nat rule first, and remove the duplicate rule in yellow..
/ip firewall nat
add action=masquerade chain=srcnat dst-address=192.168.88.0/24 src-address=\
192.168.88.0/24

add action=src-nat chain=srcnat ipsec-policy=out,none out-interface=\
pppoe-out1 to-addresses=XX.XX.XX.XX
add action=src-nat chain=srcnat out-interface=ether1 to-addresses=\
XX.XX.XX.XX


(2) You didnt fix the format of one of your dst-nat rules _ This is most likely the route of your problems!!!

add action=dst-nat chain=dstnat comment="FreePBX Media UDP" dst-address=\
XX.XX.XX.XX
dst-port=2000-65001 in-interface-list=WAN protocol=udp \
to-addresses=192.168.88.27 to-ports=2000-65001
add action=dst-nat chain=dstnat comment="FreePBX WebGUI" dst-address=\
XX.XX.XX.XX
dst-port=8080 in-interface-list=WAN protocol=tcp \
to-addresses=192.168.88.27 to-ports=8080
add action=dst-nat chain=dstnat comment="FreePBX LetsEncrypt" dst-address=\
XX.XX.XX.XX
dst-port=80 in-interface-list=WAN protocol=tcp to-addresses=\
192.168.88.27 to-ports=80
add action=dst-nat chain=dstnat comment="FreePBX Tunnel TCP" dst-address=\
XX.XX.XX.XX
dst-port=5090 in-interface-list=WAN protocol=tcp \
to-addresses=192.168.88.27 to-ports=5090
add action=dst-nat chain=dstnat comment="FreePBX SIP TCP" dst-address=\
XX.XX.XX.XX
dst-port=5060 in-interface-list=WAN protocol=tcp \
to-addresses=192.168.88.27 to-ports=5060
add action=dst-nat chain=dstnat comment="FreePBX SIP TLS" dst-address=\
XX.XX.XX.XX
dst-port=5061 in-interface-list=WAN protocol=tcp \
to-addresses=192.168.88.27 to-ports=5061
add action=dst-nat chain=dstnat dst-port=5500-5501 in-interface-list=WAN \ MISSING dst-address=XXXXXXX
protocol=tcp to-addresses=192.168.88.194 to-ports=5500-5501

Remove this from your rules..................... !! Think about it, if you put a condition that the rule has to come from the WAN SIDE and you are trying to reach the server from the LAN via WANIP, it wont work!!! You have the correct dst-address=format except its missing from the last rule.
Just wanted to say that our phone system is working, our phone carrier company has our public IP, and they are successfully sending calls to us. The deskphones are all provisioned and registered on the SIP Server. They all work fine, so the phone system is working, its just this softphone app won't work.

I have made the changes you suggested but sadly its not working. I think I will try put the server on a different subnet maybe that will work :)
# sep/15/2022 09:47:39 by RouterOS 7.4
# software id = JCY8-AFLA
#
# model = RB2011iL
# serial number = E7DD0F73B4C5
/interface bridge
add admin-mac=DC:2C:6E:4C:59:6F auto-mac=no comment=defconf name=bridge
/interface ethernet
set [ find default-name=ether7 ] name=ether7-access
/interface pppoe-client
add add-default-route=yes disabled=no interface=ether1 name=pppoe-out1 \
    use-peer-dns=yes user=eircom
/interface wireguard
add listen-port=13231 mtu=1420 name=wireguard1
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
add comment=defconf name=MANAGE
add comment=defconf name=TRUSTED
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=dhcp ranges=192.168.88.10-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
/port
set 0 name=serial0
/ppp profile
set *FFFFFFFE dns-server=192.168.88.1 local-address=192.168.89.1 \
    remote-address=vpn
/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
add bridge=bridge comment=defconf interface=ether6
add bridge=bridge comment=defconf interface=ether8
add bridge=bridge comment=defconf interface=ether9
add bridge=bridge comment=defconf interface=ether10
/ip neighbor discovery-settings
set discover-interface-list=LAN
/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
add interface=pppoe-out1 list=WAN
add interface=ether7-access list=MANAGE
/interface pptp-server server
# PPTP connections are considered unsafe, it is suggested to use a more modern VPN protocol instead
set enabled=yes
/interface sstp-server server
set default-profile=default-encryption enabled=yes
/interface wireguard peers
add allowed-address=192.168.88.0/24 interface=wireguard1 public-key=\
    "1Of5xcGq53sXm6h8TKvkn7eGxNHEqom6fhBI8XDPg2I="
/ip address
add address=192.168.88.1/24 comment=defconf interface=bridge network=\
    192.168.88.0
add address=192.168.100.1/24 interface=wireguard1 network=192.168.100.0
/ip cloud
set ddns-enabled=yes
/ip dhcp-client
add comment=defconf disabled=yes interface=ether1
/ip dhcp-server lease
add address=192.168.88.232 mac-address=00:21:9B:3C:13:ED server=defconf
add address=192.168.88.231 client-id=1:b4:2e:99:16:e1:d0 comment=\
    "Lorcan PC C1" mac-address=B4:2E:99:16:E1:D0 server=defconf
add address=192.168.88.218 client-id=1:0:1f:c1:1c:c9:80 mac-address=\
    00:1F:C1:1C:C9:80 server=defconf
add address=192.168.88.216 client-id=1:0:1f:c1:1c:c4:20 mac-address=\
    00:1F:C1:1C:C4:20 server=defconf
add address=192.168.88.215 client-id=1:0:1f:c1:1c:c4:1b mac-address=\
    00:1F:C1:1C:C4:1B server=defconf
add address=192.168.88.214 client-id=1:0:1f:c1:1c:c4:1c mac-address=\
    00:1F:C1:1C:C4:1C server=defconf
add address=192.168.88.213 client-id=1:0:1f:c1:1c:c4:8b mac-address=\
    00:1F:C1:1C:C4:8B server=defconf
add address=192.168.88.212 client-id=1:0:1f:c1:1c:c4:91 mac-address=\
    00:1F:C1:1C:C4:91 server=defconf
add address=192.168.88.211 client-id=1:0:1f:c1:1c:c9:7b mac-address=\
    00:1F:C1:1C:C9:7B server=defconf
add address=192.168.88.209 client-id=1:38:22:e2:9f:d:91 mac-address=\
    38:22:E2:9F:0D:91 server=defconf
add address=192.168.88.207 client-id=1:0:1f:c1:1c:c4:90 mac-address=\
    00:1F:C1:1C:C4:90 server=defconf
add address=192.168.88.206 client-id=1:0:1f:c1:1c:c4:8d mac-address=\
    00:1F:C1:1C:C4:8D server=defconf
add address=192.168.88.205 client-id=1:0:1f:c1:1c:c4:8f mac-address=\
    00:1F:C1:1C:C4:8F server=defconf
add address=192.168.88.204 client-id=1:0:1f:c1:1c:c4:92 mac-address=\
    00:1F:C1:1C:C4:92 server=defconf
add address=192.168.88.203 client-id=1:0:1f:c1:1c:c4:89 mac-address=\
    00:1F:C1:1C:C4:89 server=defconf
add address=192.168.88.202 client-id=1:0:1f:c1:1c:c4:1e comment=\
    "lorcan phone" mac-address=00:1F:C1:1C:C4:1E server=defconf
add address=192.168.88.201 client-id=1:0:1f:c1:1c:c4:22 mac-address=\
    00:1F:C1:1C:C4:22 server=defconf
add address=192.168.88.200 client-id=1:0:1f:c1:1c:c4:8c mac-address=\
    00:1F:C1:1C:C4:8C server=defconf
add address=192.168.88.199 client-id=1:0:1f:c1:1c:c4:1f mac-address=\
    00:1F:C1:1C:C4:1F server=defconf
add address=192.168.88.198 client-id=1:0:1f:c1:1c:c4:23 mac-address=\
    00:1F:C1:1C:C4:23 server=defconf
add address=192.168.88.196 client-id=1:90:9:d0:0:9:11 mac-address=\
    90:09:D0:00:09:11 server=defconf
add address=192.168.88.194 client-id=1:0:11:32:ae:a2:7f mac-address=\
    00:11:32:AE:A2:7F server=defconf
add address=192.168.88.165 client-id=1:0:1f:c1:1c:c4:8e mac-address=\
    00:1F:C1:1C:C4:8E server=defconf
add address=192.168.88.163 client-id=1:34:f6:2d:89:e4:82 mac-address=\
    34:F6:2D:89:E4:82 server=defconf
add address=192.168.88.154 client-id=1:0:1f:c1:1c:c4:8a mac-address=\
    00:1F:C1:1C:C4:8A server=defconf
add address=192.168.88.92 client-id=1:b8:ec:a3:fd:1d:1f mac-address=\
    B8:EC:A3:FD:1D:1F server=defconf
add address=192.168.88.91 client-id=1:b8:ec:a3:fd:1d:1c mac-address=\
    B8:EC:A3:FD:1D:1C server=defconf
add address=192.168.88.192 client-id=1:e0:91:f5:c0:c:88 mac-address=\
    E0:91:F5:C0:0C:88 server=defconf
add address=192.168.88.217 client-id=1:ec:8e:b5:d9:d7:82 comment="Joyce PC" \
    mac-address=EC:8E:B5:D9:D7:82 server=defconf
add address=192.168.88.27 mac-address=6C:2B:59:E6:FB:01 server=defconf
add address=192.168.88.38 client-id=1:0:11:32:b8:2c:31 comment=\
    "Backup server" mac-address=00:11:32:B8:2C:31 server=defconf
add address=192.168.88.48 client-id=1:48:2c:a0:79:49:22 comment=\
    "lorcan phone" mac-address=48:2C:A0:79:49:22 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
/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=accept chain=input comment="allow pptp" dst-port=1723 protocol=tcp
add action=accept chain=input comment="allow sstp" dst-port=443 protocol=tcp
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=accept chain=forward comment="allow internet traffic" \
    in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward comment="allow port forwarding" \
    connection-nat-state=dstnat
add action=drop chain=forward
/ip firewall nat
add action=masquerade chain=srcnat dst-address=192.168.88.0/24 src-address=\
    192.168.88.0/24
add action=src-nat chain=srcnat ipsec-policy=out,none out-interface=\
    pppoe-out1 to-addresses=XX.XX.XX.XX
add action=masquerade chain=srcnat comment="defconf: masquerade" \
    ipsec-policy=out,none out-interface-list=WAN
add action=dst-nat chain=dstnat comment="FreePBX Media UDP" dst-address=\
    XX.XX.XX.XX dst-port=2000-65001 protocol=udp to-addresses=192.168.88.27 \
    to-ports=2000-65001
add action=dst-nat chain=dstnat comment="FreePBX WebGUI" dst-address=\
    XX.XX.XX.XX dst-port=8080 protocol=tcp to-addresses=192.168.88.27 \
    to-ports=8080
add action=dst-nat chain=dstnat comment="FreePBX LetsEncrypt" dst-address=\
    XX.XX.XX.XX dst-port=80 protocol=tcp to-addresses=192.168.88.27 \
    to-ports=80
add action=dst-nat chain=dstnat comment="FreePBX Tunnel TCP" dst-address=\
    XX.XX.XX.XX dst-port=5090 protocol=tcp to-addresses=192.168.88.27 \
    to-ports=5090
add action=dst-nat chain=dstnat comment="FreePBX SIP TCP" dst-address=\
    XX.XX.XX.XX dst-port=5060 protocol=tcp to-addresses=192.168.88.27 \
    to-ports=5060
add action=dst-nat chain=dstnat comment="FreePBX SIP TLS" dst-address=\
    XX.XX.XX.XX dst-port=5061 protocol=tcp to-addresses=192.168.88.27 \
    to-ports=5061	
add action=dst-nat chain=dstnat dst-address=XX.XX.XX.XX dst-port=5500-5501 \
    protocol=tcp to-addresses=192.168.88.194 to-ports=5500-5501
/ip firewall service-port
set sip sip-timeout=59w3d15h
/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" 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 profile=default-encryption
/system clock
set time-zone-name=Europe/Dublin
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
Thanks for the help
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Re: Devices on LAN cannot access other devices on LAN via public IP

Thu Sep 15, 2022 12:41 pm

Actually it seems to be working for my Synology NAS. When I type https://mypublicIP:5501 it goes to the Synology server (although it says it is not secure)

When I type my Synology NAS dynamic DNS hostname into my browser like so: https://myDDNS.net:5501 it goes to the Synology NAS web access site with connection secure in the top left certificate.

So the rule has fixed the hairpin NAT issue as this would not work before. To access the web GUI of my NAS I would have to type the local IP. When external, I could type the DDNS:5501, but internally it would not work, and it now does.

Still not working with the SIP though. To clarify, when I turn off wifi and go on mobile data, it registers and works fine. So the issue does still seem to be the fact I am in my wifi network and connecting to the public IP.

Another strange thing I noticed with mikrotik is that I can't access my FreePBX web GUI externally. When I had my Cisco meraki device I had port forwarded port 8080 to the freepbx web GUI. Externally I could connect to my public IP:8080 and log into the freepbx web gui. With the mikrotik, even externally I can't connect to the web GUI. I don't really mind not being able to do that, but just thinking it could be related to the issue of SIP not registering internally...
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Re: Devices on LAN cannot access other devices on LAN via public IP

Thu Sep 15, 2022 2:26 pm

(1) Put the hairpin nat rule first, and remove the duplicate rule in yellow..
/ip firewall nat
add action=masquerade chain=srcnat dst-address=192.168.88.0/24 src-address=\
192.168.88.0/24

add action=src-nat chain=srcnat ipsec-policy=out,none out-interface=\
pppoe-out1 to-addresses=XX.XX.XX.XX
add action=src-nat chain=srcnat out-interface=ether1 to-addresses=\
XX.XX.XX.XX


(2) You didnt fix the format of one of your dst-nat rules _ This is most likely the route of your problems!!!

add action=dst-nat chain=dstnat comment="FreePBX Media UDP" dst-address=\
XX.XX.XX.XX
dst-port=2000-65001 in-interface-list=WAN protocol=udp \
to-addresses=192.168.88.27 to-ports=2000-65001
add action=dst-nat chain=dstnat comment="FreePBX WebGUI" dst-address=\
XX.XX.XX.XX
dst-port=8080 in-interface-list=WAN protocol=tcp \
to-addresses=192.168.88.27 to-ports=8080
add action=dst-nat chain=dstnat comment="FreePBX LetsEncrypt" dst-address=\
XX.XX.XX.XX
dst-port=80 in-interface-list=WAN protocol=tcp to-addresses=\
192.168.88.27 to-ports=80
add action=dst-nat chain=dstnat comment="FreePBX Tunnel TCP" dst-address=\
XX.XX.XX.XX
dst-port=5090 in-interface-list=WAN protocol=tcp \
to-addresses=192.168.88.27 to-ports=5090
add action=dst-nat chain=dstnat comment="FreePBX SIP TCP" dst-address=\
XX.XX.XX.XX
dst-port=5060 in-interface-list=WAN protocol=tcp \
to-addresses=192.168.88.27 to-ports=5060
add action=dst-nat chain=dstnat comment="FreePBX SIP TLS" dst-address=\
XX.XX.XX.XX
dst-port=5061 in-interface-list=WAN protocol=tcp \
to-addresses=192.168.88.27 to-ports=5061
add action=dst-nat chain=dstnat dst-port=5500-5501 in-interface-list=WAN \ MISSING dst-address=XXXXXXX
protocol=tcp to-addresses=192.168.88.194 to-ports=5500-5501

Remove this from your rules..................... !! Think about it, if you put a condition that the rule has to come from the WAN SIDE and you are trying to reach the server from the LAN via WANIP, it wont work!!! You have the correct dst-address=format except its missing from the last rule.
Hi, it is now working (although the Push notifications part of acrobits groundwire is not, i think that might not be related to mikrotik) thank you very much Anav!

I think disabling sip in Service ports , in combination with all the hairpin nat rules you stated, got it working. When i had the synology NAS working but not the SIP registration, disabling sip in service ports got the SIP working it seems. Thanks again :)
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19107
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Devices on LAN cannot access other devices on LAN via public IP

Thu Sep 15, 2022 2:27 pm

Yes I dont see anything that would cause issues here.......... do you have SIP alg enabled, most recommend not doing so.

1. You didnt remove this duplicate rule........... Dont think it will cause issues but it should be removed.
/ip firewall nat
add action=masquerade chain=srcnat dst-address=192.168.88.0/24 src-address=\
192.168.88.0/24
add action=src-nat chain=srcnat ipsec-policy=out,none out-interface=\
pppoe-out1 to-addresses=XX.XX.XX.XX

add action=masquerade chain=srcnat comment="defconf: masquerade" \
ipsec-policy=out,none out-interface-list=WAN
 
TheLorc
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 82
Joined: Mon Jul 18, 2022 4:53 am

Re: Devices on LAN cannot access other devices on LAN via public IP

Thu Sep 15, 2022 11:48 pm

Yes I dont see anything that would cause issues here.......... do you have SIP alg enabled, most recommend not doing so.

1. You didnt remove this duplicate rule........... Dont think it will cause issues but it should be removed.
/ip firewall nat
add action=masquerade chain=srcnat dst-address=192.168.88.0/24 src-address=\
192.168.88.0/24
add action=src-nat chain=srcnat ipsec-policy=out,none out-interface=\
pppoe-out1 to-addresses=XX.XX.XX.XX

add action=masquerade chain=srcnat comment="defconf: masquerade" \
ipsec-policy=out,none out-interface-list=WAN
Hi, yes it was SIP ALG. Disabling it allowed my phone to register. Thanks for the help

Who is online

Users browsing this forum: itsbenlol, wsantos and 29 guests