Hi.
Maybe someone can point me in the right direction.
Problem: I have created list of allowed IP adresses who can access our server from outside.
Everything is working for :80 port. Allowed users can access it and work. Problem is with SSH connection. Developers cant SSH into server. They can reach :80 ofcourse.
This works:
add action=masquerade chain=srcnat
add action=dst-nat chain=dstnat comment=“SM inbound :80” dst-port=80
in-interface=ether1 protocol=tcp src-address-list=AllowedUsers
to-addresses=192.168.0.99 to-ports=80
This doesn’t work:
add action=dst-nat chain=dstnat comment=“inbound SSH from WAN to local host”
dst-port=1227 in-interface=ether1 log=yes protocol=tcp src-address-list=
AllowedUsers to-addresses=192.168.0.99 to-ports=22
I have tried to make firewall filter rule allowing :1227 port etc. Have searched forum for couple of days. No solution has helped me yet. After every new rule, i always ask them to try connection.
/ip firewall filter
add action=accept chain=input comment=\
"Accept established and related packets" connection-state=\
established,related
add action=accept chain=input comment=\
"Accept all connections from local network" in-interface=bridge1
add action=accept chain=input comment="Accept OpenVPN" dst-port=1194 \
protocol=tcp
add action=accept chain=input comment="Accept ICMP" protocol=icmp
add action=drop chain=input comment="Drop invalid packets" connection-state=\
invalid
add action=drop chain=input comment=\
"Drop all packets which are not destined to routes IP address" \
dst-address-type=!local
add action=drop chain=input comment=\
"Drop all packets which does not have unicast source IP address" \
src-address-type=!unicast
add action=drop chain=input comment="Drop all packets from public internet whi\
ch should not exist in public network" in-interface=ether1 \
src-address-list=NotPublic
add action=accept chain=forward comment=\
"Accept established and related packets" connection-state=\
established,related
add action=accept chain=forward comment="Allow DSTNAT connections to WAN" \
connection-nat-state=dstnat connection-state=established,related,new
add action=fasttrack-connection chain=forward comment="Fasttrack filter" \
connection-state=established,related
add action=accept chain=forward comment="accept in ipsec policy" \
ipsec-policy=in,ipsec
add action=accept chain=forward comment="accept out ipsec policy" \
ipsec-policy=out,ipsec
add action=drop chain=forward comment="Drop invalid packets" \
connection-state=invalid
add action=drop chain=forward comment=\
"Drop new connections from internet which are not dst-natted" \
connection-nat-state=!dstnat connection-state=new in-interface=ether1
add action=drop chain=forward comment="Drop all packets from public internet w\
hich should not exist in public network" in-interface=ether1 \
src-address-list=NotPublic
add action=drop chain=forward comment="Drop all packets from local network to \
internet which should not exist in public network" dst-address-list=\
NotPublic in-interface=bridge1
add action=drop chain=forward comment="Drop all packets in local network which\
\_does not have local network address" in-interface=bridge1 src-address=\
!192.168.0.0/24
/ip firewall nat
add action=masquerade chain=srcnat
add action=dst-nat chain=dstnat comment="SM inbound :80" dst-port=80 \
in-interface=ether1 protocol=tcp src-address-list=AllowedUsers \
to-addresses=192.168.0.99 to-ports=80
add action=dst-nat chain=dstnat comment="inbound SSH from WAN to local host" \
dst-port=1227 in-interface=ether1 log=yes protocol=tcp src-address-list=\
AllowedUsers to-addresses=192.168.0.99 to-ports=22
add action=dst-nat chain=dstnat comment="xxxxxx" dst-address=\
xxx.xxx.xxx.xxx dst-port=3389 log=yes protocol=tcp to-addresses=\
192.168.0.32 to-ports=3389
add action=dst-nat chain=dstnat comment=xxxxxxx dst-address=xxx.xxx.xxx.xxx \
dst-port=104 log=yes protocol=tcp to-addresses=192.168.0.30 to-ports=104
Log file, they tried connecting couple of times
12:37:14 firewall,info 1 prerouting: in:ether1 out:(unknown 0), src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->Our_outer_IP:1227, len 52
12:37:14 firewall,info dstnat: in:ether1 out:(unknown 0), src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->Our_outer_IP:1227, len 52
12:37:14 firewall,info 3 forward: in:ether1 out:bridge1, src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->192.168.0.99:22, NAT s.s.s.s.s.s.ss->(Our_outer_IP:1227->192.168.0.99:22), len 52
12:37:14 firewall,info 4 postrouting: in:(unknown 0) out:bridge1, src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->192.168.0.99:22, NAT s.s.s.s.s.s.ss->(Our_outer_IP:1227->192.168.0.99:22), len 52
12:37:30 firewall,info 1 prerouting: in:ether1 out:(unknown 0), src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->Our_outer_IP:1227, len 52
12:37:30 firewall,info dstnat: in:ether1 out:(unknown 0), src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->Our_outer_IP:1227, len 52
12:37:30 firewall,info 3 forward: in:ether1 out:bridge1, src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->192.168.0.99:22, NAT s.s.s.s.s.s.ss->(Our_outer_IP:1227->192.168.0.99:22), len 52
12:37:30 firewall,info 4 postrouting: in:(unknown 0) out:bridge1, src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->192.168.0.99:22, NAT s.s.s.s.s.s.ss->(Our_outer_IP:1227->192.168.0.99:22), len 52
12:37:31 firewall,info 1 prerouting: in:ether1 out:(unknown 0), src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->Our_outer_IP:1227, NAT (s.s.s.s.s.s.ss->192.168.0.1:50366)->(Our_outer_IP:1227->192.168.0.99:22), len 52
12:37:31 firewall,info 3 forward: in:ether1 out:bridge1, src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->192.168.0.99:22, NAT (s.s.s.s.s.s.ss->192.168.0.1:50366)->(Our_outer_IP:1227->192.168.0.99:22), len 52
12:37:31 firewall,info 4 postrouting: in:(unknown 0) out:bridge1, src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->192.168.0.99:22, NAT (s.s.s.s.s.s.ss->192.168.0.1:50366)->(Our_outer_IP:1227->192.168.0.99:22), len 52
12:37:33 firewall,info 1 prerouting: in:ether1 out:(unknown 0), src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->Our_outer_IP:1227, NAT (s.s.s.s.s.s.ss->192.168.0.1:50366)->(Our_outer_IP:1227->192.168.0.99:22), len 52
12:37:33 firewall,info 3 forward: in:ether1 out:bridge1, src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->192.168.0.99:22, NAT (s.s.s.s.s.s.ss->192.168.0.1:50366)->(Our_outer_IP:1227->192.168.0.99:22), len 52
12:37:33 firewall,info 4 postrouting: in:(unknown 0) out:bridge1, src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->192.168.0.99:22, NAT (s.s.s.s.s.s.ss->192.168.0.1:50366)->(Our_outer_IP:1227->192.168.0.99:22), len 52
12:37:37 firewall,info 1 prerouting: in:ether1 out:(unknown 0), src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->Our_outer_IP:1227, NAT (s.s.s.s.s.s.ss->192.168.0.1:50366)->(Our_outer_IP:1227->192.168.0.99:22), len 52
12:37:37 firewall,info 3 forward: in:ether1 out:bridge1, src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->192.168.0.99:22, NAT (s.s.s.s.s.s.ss->192.168.0.1:50366)->(Our_outer_IP:1227->192.168.0.99:22), len 52
12:37:37 firewall,info 4 postrouting: in:(unknown 0) out:bridge1, src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->192.168.0.99:22, NAT (s.s.s.s.s.s.ss->192.168.0.1:50366)->(Our_outer_IP:1227->192.168.0.99:22), len 52
12:37:45 firewall,info 1 prerouting: in:ether1 out:(unknown 0), src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->Our_outer_IP:1227, len 52
12:37:45 firewall,info dstnat: in:ether1 out:(unknown 0), src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->Our_outer_IP:1227, len 52
12:37:45 firewall,info 3 forward: in:ether1 out:bridge1, src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->192.168.0.99:22, NAT s.s.s.s.s.s.ss->(Our_outer_IP:1227->192.168.0.99:22), len 52
12:37:45 firewall,info 4 postrouting: in:(unknown 0) out:bridge1, src-mac xx.x.x.x.x.x, proto TCP (SYN), s.s.s.s.s.s.ss->192.168.0.99:22, NAT s.s.s.s.s.s.ss->(Our_outer_IP:1227->192.168.0.99:22), len 52