I’ve done some more testing and can’t make sense of this.
I can successfully DSTNAT TCP 8080 traffic from the internet to Device B on TCP port 80 (just a test to the Device B webfig app) - DSTNAT works from Device A to Device B:
http://mikrotik2020.duckdns.org
[admin@MikroTik] /ip/firewall> nat/ pr
Flags: X - disabled, I - invalid; D - dynamic
0 ;;; defconf: masquerade
chain=srcnat action=masquerade out-interface-list=WAN log=no log-prefix="" ipsec-policy=out,none
1 ;;; ;;; force DNS
chain=dstnat action=dst-nat to-addresses=192.168.10.2 protocol=udp src-address=!192.168.10.2 dst-address=!192.168.10.2 in-interface=bridge dst-port=53 log=no log-prefix=""
2 ;;; ;;; force DNS
chain=srcnat action=masquerade protocol=udp src-address=192.168.10.0/24 dst-address=192.168.10.2 dst-port=53 log=no log-prefix=""
3 ;;; DSTNAT for Device B WireGuard
chain=dstnat action=dst-nat to-addresses=192.168.10.5 to-ports=13232 protocol=udp in-interface=lte1 dst-port=13232 log=no log-prefix=""
4 ;;; DSTNAT for Device B webfig
chain=dstnat action=dst-nat to-addresses=192.168.10.5 to-ports=80 protocol=tcp in-interface=lte1 dst-port=8080 log=yes log-prefix="8080_dstnat"
[admin@MikroTik] /ip/firewall>
I can make a successful Wireguard connection to Device B from inside the LAN so I know the Device B WireGuard keys are working.
I still can’t make a connection to the Device B WireGuard from the internet via the DSTNAT rule above. I don’t understand why, if I can DSTNAT the port 8080 traffic, why I wouldn’t be able to DSTNAT the WireGuard traffic.
Device A - 192.168.10.1 / Public IP on WAN:
IP Addresses:
[admin@MikroTik] > ip address/ print
Flags: D - DYNAMIC
Columns: ADDRESS, NETWORK, INTERFACE
# ADDRESS NETWORK INTERFACE
;;; defconf
0 192.168.10.1/24 192.168.10.0 ether1
1 D 123.209.117.65/32 123.209.117.65 lte1
[admin@MikroTik] >
Routes:
[admin@MikroTik] > ip route/ pr
Flags: D - DYNAMIC; A - ACTIVE; C - CONNECT, m - MODEM
Columns: DST-ADDRESS, GATEWAY, DISTANCE
DST-ADDRESS GATEWAY D
DAm 0.0.0.0/0 lte1 2
DAC 123.209.117.65 lte1 0
DAC 192.168.10.0/24 bridge 0
[admin@MikroTik] >
Firewall Rules:
[admin@MikroTik] > /ip fire ex
# sep/09/2020 20:32:55 by RouterOS 7.1beta2
# software id = 8DD5-P647
#
# model = RBD53G-5HacD2HnD
# serial number = C8CA0CB0B626
/ip firewall address-list
add address=192.168.10.11-192.168.10.255 list=lan_clients
add address=192.168.10.100 list=support
/ip 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 log=yes log-prefix=drop
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 log=yes log-prefix=drop
add action=accept chain=forward comment="defconf: accept in ipsec policy" disabled=yes ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" disabled=yes ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related
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
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=out,none out-interface-list=WAN
add action=dst-nat chain=dstnat comment=";;; force DNS" dst-address=!192.168.10.2 dst-port=53 in-interface=bridge protocol=udp src-address=!192.168.10.2 to-addresses=192.168.10.2
add action=masquerade chain=srcnat comment=";;; force DNS" dst-address=192.168.10.2 dst-port=53 protocol=udp src-address=192.168.10.0/24
add action=dst-nat chain=dstnat comment="DSTNAT for Device B WireGuard" dst-port=13232 in-interface=lte1 protocol=udp to-addresses=192.168.10.5 to-ports=13232
add action=dst-nat chain=dstnat comment="DSTNAT for Device B webfig" dst-port=8080 in-interface=lte1 log=yes log-prefix=8080_dstnat protocol=tcp to-addresses=192.168.10.5 to-ports=80
[admin@MikroTik] >
Device B - 192.168.10.5:
IP Addresses:
[admin@MikroTik] > ip address/ print
Columns: ADDRESS, NETWORK, INTERFACE
# ADDRESS NETWORK INTERFACE
0 192.168.10.5/24 192.168.10.0 ether1
1 192.168.201.1/24 192.168.201.0 wireguard1
[admin@MikroTik] >
Routes:
[admin@MikroTik] > ip route/ pr
Flags: D - DYNAMIC; A - ACTIVE; C - CONNECT, S - STATIC, m - MODEM
Columns: DST-ADDRESS, GATEWAY, DISTANCE
# DST-ADDRESS GATEWAY D
0 AS 0.0.0.0/0 192.168.10.1 1
DAC 192.168.10.0/24 bridge 0
DAC 192.168.201.0/24 wireguard1 0
[admin@MikroTik] >
Firewall Rules:
[admin@MikroTik] > /ip fire ex
# sep/09/2020 20:28:42 by RouterOS 7.1beta2
# software id = 50RA-6BBJ
#
# model = RBcAPGi-5acD2nD
# serial number = BECD0C73D111
[admin@MikroTik] >
WireGuard Config:
[admin@MikroTik] /interface/wireguard> export
# sep/09/2020 20:41:56 by RouterOS 7.1beta2
# software id = 50RA-6BBJ
#
# model = RBcAPGi-5acD2nD
# serial number = BECD0C73D111
/interface wireguard
add listen-port=13232 mtu=1420 name=wireguard1 private-key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
/interface wireguard peers
add allowed-address=192.168.201.10/32 endpoint=100.103.197.44:61497 interface=wireguard1 persistent-keepalive=25 preshared-key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" public-key=\
"meLYM9lu4ViXIOkwB8qCre452hBwV9asGJ/2DIzuiCQ="
[admin@MikroTik] /interface/wireguard>
I am hoping this is just something stupid in the config but I feel its a bug in WireGuard in routerOS 7. I have done this type on thing for years on Ubiquiti EdgeOS without an issue. I just don’t think the problem is in my config.