Thanks for posting this. I've spent about 3 days trying to get this concept to work but so far without success.
I'm usually fairly network literate, but Mikrotik RouterOS pushes me well outside my comfort zone!
What I am really struggling to grasp is how to relate my IP addresses with the addresses in the script.
The only thing I am sure of is that I need to replace the MAC address in the script with the mac address of the WAN port of my UDMP.
My IP addresses:
1) 192.168.4.1 UDMP's lan address
2) WAN IP address 45.153.x.x (offered by DHCP from the ISP)
3) Mikrotik Router IP address 192.168.88.1
Script IP addresses:
192.168.0.2/24 I don't know what this address relates to and why do I need it
192.168.0.0 It seems that I should substitute this with my internal network address 192.168.4.0
100.64.1.1 - Should I substitute this address for my WAN address 45.153.x.x?
192.168.0.1 - Should I substitute this with my internal router address 192.168.4.1?
@TheWeegee
can i get the full concept please.
Have the pppoe & the pub ip-address (100.64.1.0) been provided from the same ISP?
Here is the config that I am using for this I have changed the MAC address and IP addresses but otherwise it’s a working example
/interface ethernet
set [ find default-name=ether1 ] comment="LAN MGMT"
set [ find default-name=ether2 ] comment="FTTP ONT" mtu=1508
set [ find default-name=ether3 ] comment="Fortigate WAN1"
/ip dhcp-server
add add-arp=yes interface=ether3 lease-time=5m name=server-wan
/ip vrf
add interfaces=ether3 name=vrf-wan
/ppp profile
add name=pppoe on-down=":local passInterface \"ether3\";\r\
\n\r\
\n## Code\r\
\n\r\
\n/ip/dhcp-server/disable [ find interface=\$passInterface disabled=no ]" on-up=":local passInterface \"ether3\";\r\
\n:local passMACAddress \"94:ff:3c:xx:xx:xx\";\r\
\n\r\
\n### Internal varaibles\r\
\n\r\
\n:local ip \$\"local-address\";\r\
\n:local passVRFName [ /ip/vrf/get [ find interfaces=\$passInterface ] name ];\r\
\n:local dhcpServerName [ /ip/dhcp-server/get [ find interface=\$passInterface ] name ];\r\
\n:local ipPoolName \"pass-through-ip\";\r\
\n:local gatewayVRF (\$passInterface . \"@\" . \$passVRFName);\r\
\n:local gatewayAddressCidr [ /ip/address/get [ ( [ find interface=\$passInterface]->0 ) ] address ];\r\
\n:local gatewayAddress [ :pick \$gatewayAddressCidr 0 [ :find \$gatewayAddressCidr \"/\" ] ];\r\
\n:local dhcpServerPool [ /ip/dhcp-server/get [ find interface=\$passInterface ] address-pool ];\r\
\n:local commentIdentifier \"pppoe pass through script\";\r\
\n\r\
\n### Code\r\
\n\r\
\n/ip/dhcp-server/lease/remove [ find server=\$dhcpServerName ];\r\
\n/log/info message=\"Removing old dhcp leases from server \$dhcpServerName\";\r\
\n\r\
\n:if ( [ :len \$passMACAddress ] = 0 ) do={\r\
\n\r\
\n :if ( \$dhcpServerPool = \"static-only\" ) do={\r\
\n \r\
\n /ip/pool/add name=\$ipPoolName ranges=\$ip;\r\
\n /ip/dhcp-server/set [ find interface=\$passInterface ] address-pool=\$ipPoolName;\r\
\n } else={\r\
\n /ip/pool/set [ find name=\$dhcpServerPool ] ranges=\$ip;\r\
\n }\r\
\n \r\
\n /log/info message=\"Updated dhcp range to \$ip\";\r\
\n \r\
\n} else={\r\
\n /ip/dhcp-server/lease/add server=\$dhcpServerName mac-address=\$passMACAddress address=\$ip;\r\
\n /ip/dhcp-server/set [ find interface=\$passInterface ] address-pool=\"static-only\";\r\
\n /ip/pool/remove [ find name=\$ipPoolName ];\r\
\n /log/info message=\"Added dhcp lease for pass through device (\$passMACAddress)\";\r\
\n}\r\
\n\r\
\n:local dhcpNetworks [ /ip/dhcp-server/network/find comment=\$commentIdentifier ];\r\
\n\r\
\n:if ( [ :len \$dhcpNetworks ] > 0) do={\r\
\n \r\
\n :local first [ :toid (\$dhcpNetworks->0)];\r\
\n /ip/dhcp-server/network/remove [ find comment!=\$commentIdentifier address=\"\$ip/32\" ];\r\
\n /ip/dhcp-server/network/set \$first address=\"\$ip/32\" comment=\$commentIdentifier gateway=\$gatewayAddress netmask=32;\r\
\n} else={\r\
\n /ip/dhcp-server/network/add comment=\$commentIdentifier address=\"\$ip/32\" gateway=\$gatewayAddress netmask=32 dns-server=8.8.8.8;\r\
\n}\r\
\n\r\
\n/ip/dhcp-server/network/remove [ find comment=\$commentIdentifier address!=\"\$ip/32\" ];\r\
\n\r\
\n/ip/route/remove [ find routing-table=\$passVRFName static=yes ];\r\
\n/ip/route/add dst-address=\$ip gateway=\$gatewayVRF routing-table=\$passVRFName;\r\
\n\r\
\n/ip/dhcp-server/enable [ find interface=\$passInterface disabled=yes ];"
/interface pppoe-client
add add-default-route=yes disabled=no interface=ether2 max-mru=1500 max-mtu=1500 name=pppoe-vodafone profile=pppoe user=pppoeuser
/ip address
add address=192.168.0.2/24 interface=ether1 network=192.168.0.0
add address=100.64.1.1 interface=ether3 network=100.64.1.1
/ip dns
set servers=192.168.0.1
/ip vrf
add interfaces=ether2,pppoe-vodafone name=vrf-ont
/ip firewall mangle
add action=mark-routing chain=prerouting dst-address=!100.64.1.1 in-interface=ether3 log-prefix=WAN new-routing-mark=vrf-ont
add action=mark-routing chain=prerouting in-interface=pppoe-vodafone log-prefix=PPPOE new-routing-mark=vrf-wan
/ip route
add disabled=no dst-address=0.0.0.0/0 gateway=192.168.0.1 routing-table=main suppress-hw-offload=no
/system identity
set name=PPPoE_Client
[/quote]