Hello,
firstly, thank you all who will help.
here is the situation:
I have PPTP server and mikrotik as a client. On diagram on the right side
mikrotik is behind Isp router and my router as well.
I have Apple TV connected to it on 192.168.4.36, gw 192.168.4.100, dns 192.168.4.100
on the mikrotik there is script sniffing predefined domains and fills firewall’s address list.
mangle prerouting marks the packets and they are sent to routing table which has its own gw to the pptp VPN. green line.
the rest of the traffic is going to the internet blue line.
this works perfectly.
on the other hand:
I also have (for testing) another mikrotik with another Apple TV on the diagram right side
mikrotik is also behind Isp router and my router as well.
I have Apple TV connected to it on 192.168.4.196, gw 192.168.4.188, dns 192.168.4.188
on the mikrotik there is the same script sniffing predefined domains and fills firewall’s address list.
mangle prerouting marks the packets and they are sent to routing table which has its own gw to the wireguard VPN. (there is no line, because it doesn’t work)
the rest of the traffic is going to the internet, blue line.
I have handshake and I can ping 192.168.100.1, the other side
BUT
as I mentioned all above work only with PPTP, not the testing with wireguard
goal is to make the wireguard run, and then transfer the settings to the first mikrotik (right) router and then turn the pptp off and have (just in case) the settings stored as a backup (because it works)…
thank you all for help
Here is a map:
here are the exports
PPTP
# 2023-10-19 19:50:40 by RouterOS 7.11.2
# software id = xxxx-xxxx
#
# model = RB750Gr3
# serial number = xxxxxxxxx
/interface pptp-client
add connect-to=81.xxx.xxx.xxx disabled=no max-mtu=1400 name=VPN_CZ user=pp31
/interface bridge
add name=bridge1
/interface list
add name=WAN
add name=LAN
/routing table
add fib name=CZ_VPN
/interface bridge port
add bridge=bridge1 ingress-filtering=no interface=ether1
add bridge=bridge1 ingress-filtering=no interface=ether2
add bridge=bridge1 ingress-filtering=no interface=ether4
add bridge=bridge1 ingress-filtering=no interface=ether5
add bridge=bridge1 ingress-filtering=no interface=ether3
add bridge=*9 ingress-filtering=no interface=WAN
/ip neighbor discovery-settings
set discover-interface-list=!dynamic
/ipv6 settings
set disable-ipv6=yes max-neighbor-entries=8192
/interface detect-internet
set detect-interface-list=all
/interface list member
add interface=ether1 list=LAN
add interface=ether2 list=LAN
add interface=ether3 list=LAN
add interface=ether4 list=LAN
add interface=ether5 list=LAN
add interface=VPN_CZ list=WAN
/ip dns
set allow-remote-requests=yes cache-size=4096KiB servers=8.8.4.4,8.8.8.8
/ip dns static
add forward-to=192.168.103.1 regexp=".*\\.o2tv\\.cz\$" type=FWD
add forward-to=192.168.103.1 regexp=".*\\.iol\\.cz\$" type=FWD
add forward-to=192.168.103.1 regexp=".*\\.ceskatelevize\\.cz\$" type=FWD
add forward-to=192.168.103.1 regexp=".*\\.czech-tv\\.cz\$" type=FWD
add disabled=yes forward-to=192.168.103.1 regexp=".*\\.cz\$" type=FWD
/ip firewall mangle
add action=mark-routing chain=prerouting comment="Sortie Voyo" \
dst-address-list=voyo new-routing-mark=CZ_VPN passthrough=yes \
src-address=192.168.4.36
add action=mark-routing chain=prerouting comment=ct dst-address-list=ct \
new-routing-mark=CZ_VPN passthrough=yes src-address=192.168.4.36
/ip firewall nat
add action=masquerade chain=srcnat out-interface=VPN_CZ
/ip route
add disabled=no dst-address=0.0.0.0/0 gateway=VPN_CZ routing-table=CZ_VPN
add disabled=yes dst-address=0.0.0.0/0 gateway=192.168.103.1 routing-table=CT
/system clock
set time-zone-name=Australia/Brisbane
/system note
set show-at-login=no
/system routerboard settings
set auto-upgrade=yes
/system scheduler
add interval=5s name=ct on-event=":global ajouteIP do={\r\
\n :if ([:len [/ip firewall address-list find address=\"\$nouvelleIP\" an\
d list=\"ct\"]] = 0) do={\r\
\n /ip firewall address-list add list=\"ct\" address=\$nouvelleIP timeo\
ut=00:05:00\r\
\n }\r\
\n}\r\
\n\r\
\n:local myServers { \"ivysilani\";\"ceskatelevize\";\"seznam\";\"stream\"\
;\"o2tv\";\"czech-tv\";\"iol\"}\r\
\n/ip dns cache all {\r\
\n :foreach i in=\$myServers do={\r\
\n :foreach j in=[find where (name~\$i)] do={\r\
\n :local myName [get \$j name]\r\
\n :local myType [get \$j type]\r\
\n :local myData [get \$j data]\r\
\n :if (\$myType = \"A\") do={\r\
\n \$ajouteIP nouvelleIP=\$myData\r\
\n }\r\
\n\r\
\n :if (\$myType = \"CNAME\") do={\r\
\n :local ipResolue [:resolve \"\$myData\"];\r\
\n \$ajouteIP nouvelleIP=\$ipResolue\r\
\n }\r\
\n }\r\
\n }\r\
\n}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-time=startup
add interval=5s name=voyo on-event=":global ajouteIP do={\r\
\n :if ([:len [/ip firewall address-list find address=\"\$nouvelleIP\" an\
d list=\"voyo\"]] = 0) do={\r\
\n /ip firewall address-list add list=\"voyo\" address=\$nouvelleIP tim\
eout=00:05:00\r\
\n }\r\
\n}\r\
\n\r\
\n:local myServers { \"voyo\";\"cra\";\"nova\";\"sledovanitv\";\"imedia\";\
\"sdn\"}\r\
\n/ip dns cache all {\r\
\n :foreach i in=\$myServers do={\r\
\n :foreach j in=[find where (name~\$i)] do={\r\
\n :local myName [get \$j name]\r\
\n :local myType [get \$j type]\r\
\n :local myData [get \$j data]\r\
\n :if (\$myType = \"A\") do={\r\
\n \$ajouteIP nouvelleIP=\$myData\r\
\n }\r\
\n\r\
\n :if (\$myType = \"CNAME\") do={\r\
\n :local ipResolue [:resolve \"\$myData\"];\r\
\n \$ajouteIP nouvelleIP=\$ipResolue\r\
\n }\r\
\n }\r\
\n }\r\
\n}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-time=startup
add interval=45m name=cloudns on-event="/tool fetch url=\"https://ipv4.cloudns\
.net/api/dynamicURL/\?q=NTE5MjU5NDozNDI5MTQxODY6MWMzMGFiYTZiMjI3ZWIwOTllNj\
dkOTRjMTM5ZmVkMjlhYjk4NjAwYzQ5MWRiZTRjNzk0YTA3MjIzZDdiMWQ3Mg\" mode=https" \
policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-time=startup
/system script
add dont-require-permissions=no name=voyo owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":\
global ajouteIP do={\r\
\n :if ([:len [/ip firewall address-list find address=\"\$nouvelleIP\" an\
d list=\"voyo\"]] = 0) do={\r\
\n /ip firewall address-list add list=\"voyo\" address=\$nouvelleIP tim\
eout=02:00:00\r\
\n }\r\
\n}\r\
\n\r\
\n:local myServers { \"voyo\";\"cra\";\"nova\"}\r\
\n/ip dns cache all {\r\
\n :foreach i in=\$myServers do={\r\
\n :foreach j in=[find where (name~\$i)] do={\r\
\n :local myName [get \$j name]\r\
\n :local myType [get \$j type]\r\
\n :local myData [get \$j data]\r\
\n :if (\$myType = \"A\") do={\r\
\n \$ajouteIP nouvelleIP=\$myData\r\
\n }\r\
\n\r\
\n :if (\$myType = \"CNAME\") do={\r\
\n :local ipResolue [:resolve \"\$myData\"];\r\
\n \$ajouteIP nouvelleIP=\$ipResolue\r\
\n }\r\
\n }\r\
\n }\r\
\n}"
add dont-require-permissions=no name=cloudns owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="/\
tool fetch url=\"https://ipv4.cloudns.net/api/dynamicURL/\?q=xxxxxxxxxxx\
xxxxxxxxxxxxx\" mode=https"
wireguards
# 2023-10-19 19:32:47 by RouterOS 7.11.2
# software id = xxxxx
#
# model = RB941-2nD
# serial number = xxxxxxxxx
/interface bridge
add name=bridge1
/interface wireless
set [ find default-name=wlan1 ] ssid=MikroTik
/interface wireguard
add listen-port=13231 mtu=1420 name=wireguard1
/interface list
add name=WAN
add name=LAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/routing table
add fib name=CZ_VPN
/interface bridge port
add bridge=bridge1 ingress-filtering=no interface=ether1
add bridge=bridge1 ingress-filtering=no interface=ether2
add bridge=bridge1 ingress-filtering=no interface=ether3
add bridge=bridge1 ingress-filtering=no interface=ether4
add bridge=*9 ingress-filtering=no interface=WAN
/ip neighbor discovery-settings
set discover-interface-list=!dynamic
/interface detect-internet
set detect-interface-list=all
/interface list member
add interface=ether1 list=LAN
add interface=ether2 list=LAN
add interface=ether3 list=LAN
add interface=ether4 list=LAN
add interface=wireguard1 list=WAN
/interface wireguard peers
add allowed-address=0.0.0.0/0 endpoint-address=81.x.x.x endpoint-port=\
13231 interface=wireguard1 persistent-keepalive=40s public-key=\
"xxxxxxxxxxxxxxxxxxx"
/ip address
add address=192.168.100.2/24 interface=wireguard1 network=192.168.100.0
/ip dhcp-client
add interface=bridge1 use-peer-dns=no
/ip dns
set allow-remote-requests=yes cache-size=4096KiB servers=8.8.8.8,8.8.4.4
/ip dns static
add forward-to=192.168.100.1 regexp=".*\\.o2tv\\.cz\$" type=FWD
add forward-to=192.168.100.1 regexp=".*\\.iol\\.cz\$" type=FWD
add forward-to=192.168.100.1 regexp=".*\\.ceskatelevize\\.cz\$" type=FWD
add forward-to=192.168.100.1 regexp=".*\\.czech-tv\\.cz\$" type=FWD
/ip firewall mangle
add action=mark-routing chain=prerouting comment="Sortie Voyo" \
dst-address-list=voyo new-routing-mark=CZ_VPN passthrough=yes \
src-address=192.168.4.196
add action=mark-routing chain=prerouting comment=ct dst-address-list=ct \
new-routing-mark=CZ_VPN passthrough=yes src-address=192.168.4.196
/ip firewall nat
add action=masquerade chain=srcnat out-interface=wireguard1
/ip route
add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=wireguard1 pref-src=\
"" routing-table=CZ_VPN scope=30 suppress-hw-offload=no target-scope=10
/system clock
set time-zone-name=Australia/Brisbane
/system note
set show-at-login=no
/system routerboard settings
set auto-upgrade=yes
/system scheduler
add interval=5s name=ct on-event=":global ajouteIP do={\r\
\n :if ([:len [/ip firewall address-list find address=\"\$nouvelleIP\" an\
d list=\"ct\"]] = 0) do={\r\
\n /ip firewall address-list add list=\"ct\" address=\$nouvelleIP timeo\
ut=00:05:00\r\
\n }\r\
\n}\r\
\n\r\
\n:local myServers { \"ivysilani\";\"ceskatelevize\";\"seznam\";\"stream\"\
;\"o2tv\";\"czech-tv\";\"iol\"}\r\
\n/ip dns cache all {\r\
\n :foreach i in=\$myServers do={\r\
\n :foreach j in=[find where (name~\$i)] do={\r\
\n :local myName [get \$j name]\r\
\n :local myType [get \$j type]\r\
\n :local myData [get \$j data]\r\
\n :if (\$myType = \"A\") do={\r\
\n \$ajouteIP nouvelleIP=\$myData\r\
\n }\r\
\n\r\
\n :if (\$myType = \"CNAME\") do={\r\
\n :local ipResolue [:resolve \"\$myData\"];\r\
\n \$ajouteIP nouvelleIP=\$ipResolue\r\
\n }\r\
\n }\r\
\n }\r\
\n}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-time=startup
add interval=5s name=voyo on-event=":global ajouteIP do={\r\
\n :if ([:len [/ip firewall address-list find address=\"\$nouvelleIP\" an\
d list=\"voyo\"]] = 0) do={\r\
\n /ip firewall address-list add list=\"voyo\" address=\$nouvelleIP tim\
eout=00:05:00\r\
\n }\r\
\n}\r\
\n\r\
\n:local myServers { \"voyo\";\"cra\";\"nova\";\"sledovanitv\";\"imedia\";\
\"sdn\"}\r\
\n/ip dns cache all {\r\
\n :foreach i in=\$myServers do={\r\
\n :foreach j in=[find where (name~\$i)] do={\r\
\n :local myName [get \$j name]\r\
\n :local myType [get \$j type]\r\
\n :local myData [get \$j data]\r\
\n :if (\$myType = \"A\") do={\r\
\n \$ajouteIP nouvelleIP=\$myData\r\
\n }\r\
\n\r\
\n :if (\$myType = \"CNAME\") do={\r\
\n :local ipResolue [:resolve \"\$myData\"];\r\
\n \$ajouteIP nouvelleIP=\$ipResolue\r\
\n }\r\
\n }\r\
\n }\r\
\n}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-time=startup