Hello Sindy, thanks for your reply!
I would say the reason is either firewall misconfiguration or something broken in 6.48.1. You mention Android as an initiator but you haven't explicitly specified that you use IKEv2. The src-address and dst-address of the policy suggest that you do, so do you run some recent Android version which supports IKEv2 natively or do you use a 3rd party VPN application, like Strongswan?
I'm using native Android 10 IPSec IKEv2 support on Samsung S9+
Here is the Mikrotik config exported (with some sensitive data removed )
# feb/15/2021 08:50:37 by RouterOS 6.48.1
# software id = xxxxxx
#
# model = RB4011iGS+
# serial number = xxxxxxxx
/interface bridge
add admin-mac=XX:XX:XX:XX:XX:XX auto-mac=no comment=defconf name=bridge
/interface ethernet
set [ find default-name=ether1 ] name=ether1-WAN
/interface ethernet switch port
set 0 default-vlan-id=0
set 1 default-vlan-id=0
set 2 default-vlan-id=0
set 3 default-vlan-id=0
set 4 default-vlan-id=0
set 5 default-vlan-id=0
set 6 default-vlan-id=0
set 7 default-vlan-id=0
set 8 default-vlan-id=0
set 9 default-vlan-id=0
set 10 default-vlan-id=0
set 11 default-vlan-id=0
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=xxxxxxxxx
/ip ipsec policy group
add name=ipsec-group
/ip ipsec profile
set [ find default=yes ] enc-algorithm=aes-256,aes-192,aes-128 hash-algorithm=\
sha256
add enc-algorithm=aes-256,aes-192,aes-128 name=ipsec-profile
/ip ipsec peer
add exchange-mode=ike2 local-address=192.168.0.253 name=user1 passive=yes \
profile=ipsec-profile send-initial-contact=no
/ip ipsec proposal
set [ find default=yes ] auth-algorithms=sha256,sha1 enc-algorithms=\
aes-256-cbc,aes-256-gcm,aes-192-cbc,aes-192-gcm,aes-128-cbc,aes-128-gcm \
lifetime=8h
add enc-algorithms="aes-256-cbc,aes-256-ctr,aes-256-gcm,aes-192-cbc,aes-192-ctr,\
aes-192-gcm,aes-128-cbc,aes-128-ctr,aes-128-gcm" lifetime=8h name=\
ipsec-proposal pfs-group=none
/ip pool
add name=dhcp ranges=192.168.178.2-192.168.178.254
add name=vpn-pool ranges=192.168.8.10-192.168.8.99
add name=ipsec-pool ranges=192.168.100.2-192.168.100.99
/ip dhcp-server
add address-pool=dhcp disabled=no interface=bridge lease-time=2h name=defconf
/ip ipsec mode-config
add address-pool=ipsec-pool address-prefix-length=32 name=ipsec-config \
split-include=0.0.0.0/0 system-dns=no
/ppp profile
set *0 use-ipv6=default
add dns-server=192.168.8.250 local-address=192.168.8.250 name=vpn-profile \
remote-address=vpn-pool use-compression=no use-encryption=required \
use-ipv6=default
/system logging action
set 0 memory-lines=10000
/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=ether7
add bridge=bridge comment=defconf interface=ether8
add bridge=bridge comment=defconf interface=ether9
add bridge=bridge comment=defconf interface=ether10
add bridge=bridge comment=defconf interface=sfp-sfpplus1
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1-WAN list=WAN
/interface ovpn-server server
set auth=sha1 certificate=server-certificate cipher=aes192,aes256 \
default-profile=vpn-profile enabled=yes require-client-certificate=yes
/ip address
add address=192.168.178.1/24 comment=defconf interface=bridge network=\
192.168.178.0
add address=192.168.0.253/24 interface=ether1-WAN network=192.168.0.0
/ip cloud
set ddns-enabled=yes ddns-update-interval=5m
/ip dhcp-client
add comment=defconf interface=ether1-WAN
/ip dhcp-server network
add address=192.168.178.0/24 comment=defconf gateway=192.168.178.1 netmask=24
/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="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=accept chain=input comment="allow OpenVPN" dst-port=1194 protocol=\
tcp
add action=accept chain=input in-interface-list=dynamic protocol=tcp \
src-address=192.168.8.0/24
add action=accept chain=input comment="L2TP/IPSec rules" dst-port=500,4500 \
protocol=udp
add action=accept chain=input protocol=ipsec-esp
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=accept chain=forward 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=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=drop chain=input comment="defconf: drop all not coming from LAN" \
in-interface-list=!LAN
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
out-interface-list=WAN src-address=192.168.178.0/24
/ip ipsec identity
add generate-policy=port-strict mode-config=ipsec-config peer=user1 \
policy-template-group=ipsec-group remote-id=key-id:user1
/ip ipsec policy
add dst-address=192.168.100.0/24 group=ipsec-group proposal=ipsec-proposal \
src-address=0.0.0.0/0 template=yes
/ip ipsec settings
set accounting=no
/ip route
add distance=1 gateway=192.168.0.254
/ppp secret
add name=mobile profile=vpn-profile service=ovpn
/system clock
set time-zone-name=Europe/Rome
/system identity
set name=xxxxxxxxx
/system ntp client
set enabled=yes primary-ntp=108.61.73.243 secondary-ntp=138.68.201.49
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
I included also OpenVPN server configuration...that works perfectly.
When you try to access some web page from the Android via the VPN, does /ip ipsec installed-sa print interval=1s show that the Android -> Mikrotik SA receives some packets? If it does, it is a firewall issue; if it doesn't, it may be a routing issue at Android side or the NAT detection may have failed. Do the src-address and dst-address of the installed SAs show only the public IP address of the Android device or also the port?
Yes, I can see packets from Android to Mikrotik. But I can not see what is wrong on firewall...
> /ip ipsec installed-sa print interval=1
Flags: H - hw-aead, A - AH, E - ESP
0 HE spi=an hex number src-address=x.x.x.x:4255 dst-address=192.168.0.253:4500
state=mature enc-algorithm=aes-gcm enc-key-size=288
enc-key="something long :)"
addtime=feb/15/2021 09:06:21 expires-in=7h58m33s add-lifetime=6h24m/8h
current-bytes=47085 current-packets=228 replay=128
1 HE spi=another hex number src-address=192.168.0.253:4500 dst-address=x.x.x.x:4255
state=mature enc-algorithm=aes-gcm enc-key-size=288
enc-key="other boring long stuff :)"
add-lifetime=6h24m/8h replay=128
-- [Q quit|D dump|C-z pause]
I also tried to remove all the "drop" rules from firewall (so, no firewall :) ) with the same result...ports on the remote android side is also shown.
A question: the IKEv2 tunnel should create also a dynamic routing rule when establishes? (similar to the OpenVPN server....). Meanwhile when an openvpn connection sets I can see a routing dynamic rule on the list, I don't see the same for the IPSec IKEv2 connection...
Thanks!